develooper Front page | perl.libwww | Postings from December 2001

redirect and RFC2068 stuff

Thread Next
Tatsuhiko Miyagawa
December 4, 2001 09:27
redirect and RFC2068 stuff
Message ID:
LWP::UserAgent says:

  sub redirect_ok
      # RFC 2068, section 10.3.2 and 10.3.3 say:
      #  If the 30[12] status code is received in response to a request other
      #  than GET or HEAD, the user agent MUST NOT automatically redirect the
      #  request unless it can be confirmed by the user, since this might
      #  change the conditions under which the request was issued.
      # Note that this routine used to be just:
      #  return 0 if $_[1]->method eq "POST";  return 1;

But many browsers[1] allow redirecting POST request without any
confirmation by users. The point is that the redirected request 
is changed to 'GET', instead of 'POST'.

  Client => Server
    POST /redir.cgi 
  Server => Client
    Location: ./get.cgi
  Client => Server
    GET /get.cgi

If we use request_redirectable with LWP::UA, the last request
stays as 'POST' method, instead of 'GET'.

Is this behaviour considered bug, or feature? If the latter, is
there any nicer way to avoid this?

[1] Experimented with WinNN 4.78, WinIE 5.5, w3m/0.2.1 on FreeBSD.

Tatsuhiko Miyagawa <>

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About