INETS-How to handle redirection

Ingela Anderton <>
Mon Sep 19 09:56:51 CEST 2005


Sanjaya Vitharana wrote:
> Hi...!!!
> 
> Can any body help me to handle the get request in inets when REDIRECTION done by the PHP script. (or any other script in websever) ???
> 
> i.e.
> when get request made to below page
> http://scr.int/vm/dialout.php?key=c&session=abc
> 
> the PHP Script redirect it to
> http://scr.int/vm/index2.xml?key=c&session=abc
> 
> this is working on the web browser without any problem.
> 
> But my inets client don't get any reply for the same request & time out happens.
> 
> all other requests are working, but when redirection on the PHP Script inets don't get any reply from web serer, i tried with increasing timeout, but it also fails. may be when redirection on the Script there will be any other way to handle it in inets.
> 
> I'm using 
> 
> handle_info({http, {RequestId, Result}}, State) ->
> 
> to catch the webserver reply & and request type is Asynchronous.
> 
> Need help from to handle the redirection properly in inets???
Have you tried setting the option {autoredirect, false}? Do you get
the redirect answer then? The intes client will automaticly try to
redirect the request. If it gets a redirect more than four times
in a row it should give up.

You could try the following trace commands to get some more info
about what happens. (If it does not seem to be what is expected
you can send me the printouts and I will look at them.)
dbg:tracer()
dbg:p(all, [call]).
dbg:tpl(httpc_response, redirect, [{'_', [], [{return_trace}]}]).

-- 
/Ingela - OTP team








More information about the erlang-questions mailing list