[erlang-questions] Inets unencoding question

Michael McDaniel <>
Thu Oct 26 06:56:22 CEST 2006


On Wed, Oct 25, 2006 at 09:20:07PM -0600, Brad Marshall wrote:
> I'm using http:request and it calls http_uri:parse_http.  
> Http_uri:parse_http seems to unencode the request as part of its parsing. 
> I.e. %25 becomes %.  Unfortunately, the web service I'm calling requires a
> digital signature with the request, so the request no longer matches the
> digital signature.
> 
> I'm not sure of the reasoning behind this, and I'm certainly open to
> discussion to the contrary, but this seems like a bug.  I've tried this
> request in other http clients (Perl, Java) and neither performs an unencode.
>  Also, this particular implementation seems to violate the RFC whereby
> multiple unencoding is not allowed as it may alter the intent of the URI
> (the http_uri:parse_http unencoding is recursing on the unencoded portion).
> 
> Given my very light Erlang skills it's entirely possible I'm
> mis-interpreting the processing but my tests seem to bear this out.  Can
> anyone confirm or deny?  Or suggest a means of turning this off?  Or explain
> why this is correct?
> 
> Thanks,
> brad
> 
> ________________________________________________


 I dug up the following old code I had.  I compile
 and run my_module:geturl("http://some.url.domain.com").
 that contains a %25 and I can see the %25, not a '.'

 Can you post some code you think is behaving badly
 and a URL to test with ?

  geturl(Url) ->
   application:start(inets),
   X = http:request(Url),
   case X of
    {ok, { {_Version, 200, _ReasonPhrase}, _Headers,
  Body} } ->
     Body;
    _ -> X
  end.


~Michael



More information about the erlang-questions mailing list