Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-885

Url encoded strings never get decoded? How do we fix this?

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.4
    • 0.5
    • JavaScript - Compiler
    • None

    Description

      This is for the test java server that was written to test the client.
      Suppose you have a method such as testString(theTestString)
      If you call it from the javascript like so:

      client.testString("hello man");
      The string that your server implementation sees will be all crazy and url encoded.

      public static void testString(string theTestString) {
      // Inside here that string looks like "hello%20man".
      }
      We need it to be urlencoded when coming across the wire because we're using JSON as the protocol, but once it gets to thrift server code, it needs to be normal.

      So what's going on here? Inside of strings (of javascript objects) things like quotes and spaces are escaped. This is fine, but I do not believe that is part of the TJSONProtocol. This is something that is specific to having a js thrift client am I right? So where do we fix this?
      Edit: I had proposed a code fix which I do not believe to be the correct solution. Deleting- see future post for what I believe to be correct.

      Attachments

        1. charEscapingFix.diff
          2 kB
          Jordan
        2. THRIFT-885_jordans_patch_and_testcase.patch
          6 kB
          Roger Meier
        3. THRIFT-885_remove_encodeURIComponent.patch
          0.4 kB
          Roger Meier
        4. THRIFT-885_testcase_only.patch
          3 kB
          Roger Meier

        Issue Links

          Activity

            People

              tjake T Jake Luciani
              jordo Jordan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: