[erlang-questions] http:request - {autoredirect, true} with HTTP 302

Ingela Anderton <>
Mon Nov 20 09:08:43 CET 2006



Hi !

The intention is that 302 (301, 303 and 307) should be redirected
automatically only if the request method was get or head.  (As in your
case). The http client used to be too generous in its redirecting but
unfortunately it seems when restricting it the 302 code became too
restricted, that will be fixed for the next release.


> Hi
> 
> How the HTTP Error Code 302, should work with {autoredirect,true} in erlang http:request .... ???
> 
> I have expected to reach the final destination with {autoredirect,true}. But it stops in a half way with empty result when HTTP Error Code 302 comes.
> 
> Regards,
> 
> Sanjaya Vitharana
> 
> 
> [ wavenet1]$  links -source "http://localhost/cf/ivr_test.php?cli=114526000|2421996,N/A&ch=6&serverid=1"
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> <IVR auth="111">
> <accept></accept>
> <key no="a">http://203.115.0.73/cf/sc1/_menu/answer.php</key>
> <session>a1163751629114526000</session>
> </IVR>
> 
> 1> URL="http://localhost/cf/ivr_test.php?cli=114526000|2421996,N/A&ch=6&serverid=1".             
> "http://localhost/cf/ivr_test.php?cli=114526000|2421996,N/A&ch=6&serverid=1"
> 
> 
> 18> http:request(get, {URL, []}, [{timeout, 10000},{autoredirect,true}],[]).
> {ok,{{"HTTP/1.1",302,"Found"},
>      [{"cache-control",
>        "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"},
>       {"connection","Keep-Alive"},
>       {"date","Fri, 17 Nov 2006 08:44:25 GMT"},
>       {"pragma","no-cache"},
>       {"location",
>        "http://203.115.0.73/cf/sc1/_menu/index.php?cli=114526000&session=a1163753065114526000&serverid=1"},
>       {"server","Apache/2.0.54 (Unix) PHP/5.0.3"},
>       {"content-length","0"},
>       {"content-type","text/html"},
>       {"expires","Thu, 19 Nov 1981 08:52:00 GMT"},
>       {"x-powered-by","PHP/5.0.3"},
>       {"set-cookie","PHPSESSID=a1163753065114526000; path=/"},
>       {"keep-alive","timeout=15, max=100"}],
>      []}}
> 19> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://www.erlang.org/pipermail/erlang-questions/attachments/20061117/9a7dec41/attachment-0001.html
> 
> ------------------------------
>
-- 
Ingela

Ericsson AB - OTP team









More information about the erlang-questions mailing list