https requests with parameters failing using 13b04 httpc module

Jebu Ittiachen <>
Wed Apr 28 13:01:28 CEST 2010


Hi,

  After moving to R13B04 oauth requests to fireeagle for the service I run
at http://tweetaloc.nowwhat.in has been failing with an error "Invalid OAuth
signature" from the server side. The same code has been working fine on
R13B03.

  Digging thru it looks like httpc is sending the host header as host:port
for ports other than 80. Here is the debug logs

[inets httpc trace 60 <0.170.0> 2010:04:28 09:46:58 4773] send
   Content: [{module,httpc_request},
             {line,109},
             {message,["GET"," ",

"/api/0.1/user?oauth_signature=HQf3ptyWHf%2BUZB0pbJz6oto%2F1%2B0%3D&oauth_token=XXXXXXXXXXXX&oauth_version=1.0&oauth_nonce=eMTdPddq2ReYDd0d8SKbK633iQcqRIs%2FjEuj9p%2F0%2F2w%3D&oauth_timestamp=1272448018&oauth_signature_method=HMAC-SHA1&oauth_consumer_key=XXXXXXXXXXXX",
                       " ","HTTP/1.1","\r\n",
                       "te: \r\nhost:
fireeagle.yahooapis.com:443\r\nconnection:
keep-alive\r\n",
                       "\r\n",[]]}]

  Following patch fixes the issue atleast for this case, but not sure if the
spec says the host header should have the port or not

--- /tmp/httpc.erl 2010-04-28 16:26:39.000000000 +0530
+++ lib/inets/src/http_client/httpc.erl 2010-04-28 16:27:12.000000000 +0530
@@ -895,6 +895,8 @@
     throw({error, {bad_option, Option, BadValue}}).


+header_host(Host, 443 = _Port) ->
+    Host;
 header_host(Host, 80 = _Port) ->
     Host;
 header_host(Host, Port) ->


--
Jebu Ittiachen



More information about the erlang-bugs mailing list