Menu

#4747 HTTP does not follow redirects

open
7
2010-11-04
2010-11-04
HM2K
No

I am referring to redirects such as the 301 HTTP redirect which is when a page has moved permanently.

At present the http package does not appear to follow such redirects.

This is not the nature of which http was intended to be used and should be fixed accordingly.

Discussion

  • HM2K

    HM2K - 2010-11-04
    • assigned_to: patthoyts --> nobody
     
  • HM2K

    HM2K - 2010-11-04
    • summary: Does not follow redirects --> HTTP does not follow redirects
     
  • Donal K. Fellows

    • assigned_to: nobody --> patthoyts
     
  • Donal K. Fellows

    • priority: 5 --> 7
     
  • Donal K. Fellows

    Redirect handling ought to be a configurable feature (default: on)

     
  • kjnash

    kjnash - 2012-10-30

    I suggest that following redirects is not a suitable feature for the http::geturl which implements a single HTTP request.

    The redirect problem is not simple because RFC 2616 insists we MUST have user confirmation in certain cases: a POST when the response code is 301, 302, or 307. This means that http::geturl must either refuse these redirects, or provide hooks for user interaction.

    I suggest that Tcllib is a better place for redirection code than the http package itself.

    I have a wrapper library for package http that provides the necessary code to follow redirects, and handle authorization (401), including hooks for user interaction. I intend to offer this code to Tcllib when it is finished (I am still fixing bugs right now).