I'm using Delphi TREST framework and filling parameters thanks to the TRESTRequestParameterList object.

I'm using Delphi TREST framework and filling parameters thanks to the TRESTRequestParameterList object.

I need to pass a parameter string like this : S1111x/54647
My parameter will wrongly be put in the request's HTTP header. TRESTRequest.Execute will fails because the URL not correctly formated :

I will get this

http://mywebservice/Products/Infos/S1111x/54647

instead of this

http://mywebservice/Products/Infos/S1111x%754647

Is this my "responsibility" to escape this char or must this be done by the TREST framework ?

Comments

  1. "My parameter will wrongly be put in the request's HTTP header." Except that you then referred to a URL, not a header. I'm curious as to what the parameter name is in your scenario? If the parameter value is indeed S1111x/54647, then it is being encoded incorrectly, because the / character would normally be encoded to %2F,, which is prohibited (at least by default) in URLs on some servers, e.g. Apache. That it apparently ends up as %7 is invalid, since encoding results in 2 characters after the %, or if it ends up as %75 (which is: u), then it's dropping one of your characters. Either way: it's bad.

    ReplyDelete
  2. David Nottage​​ you are right, I was referencing to the URL generation.

    I'm working with an Android scanner. I'm sending scanned code to a web service. Some of these QRCode are does have such values.

    When filling urlsegment parameters, Delphi Rest client framework doesn't check for "special" chars and store values without encoding them.

    To solves this, I'm using HttpEncode for all scanned values. Glasfish server is then accepting my get request.

    ReplyDelete

Post a Comment