Skip to content
Tcl Source Code History Of Ticket 3102850fff
Login

History Of Ticket 3102850fff

Artifacts Associated With Ticket 3102850fff

  1. Ticket change [0462769e46] (rid 119992) by hm2k on 2010-11-04 11:42:27:

    1. assignee initialized to: "patthoyts"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      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.
      
    4. foundin initialized to: "None"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "hm2k"
    10. subsystem initialized to: "29. http Package"
    11. title initialized to: "Does not follow redirects"
    12. type initialized to: "Bug"
  2. Ticket change [8d43b710ff] (rid 127899) by hm2k on 2010-11-04 18:43:08:

    1. assignee changed to: "nobody"
  3. Ticket change [8575676e99] (rid 131318) by hm2k on 2010-11-04 18:43:26:

    1. title changed to: "HTTP does not follow redirects"
  4. Ticket change [934f0a36b1] (rid 105790) by dkf on 2010-11-04 20:35:20:

    1. assignee changed to: "patthoyts"
  5. Ticket change [faedd1c104] (rid 91972) by dkf on 2010-11-04 20:36:09:

    1. icomment:
      Redirect handling ought to be a configurable feature (default: on)
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. priority changed to: "7 High"
    5. username: "dkf"
  6. Ticket change [6434700b5c] (rid 92719) by kjnash on 2012-10-30 10:27:22:

    1. icomment:
      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).
      
      
    2. login: "kjnash"
    3. mimetype: "text/plain"
    4. username: "kjnash"
  7. Ticket change [ba356d478b] (rid 204061) by kjnash on 2022-09-10 12:17:07:

    1. closer changed to: "nobody"
    2. comment changed to:
      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.
      
    3. icomment:
      Bug [3612478] is a duplicate of this one.  I have closed that bug, and copied Harald's comments below:
      (kjnash)
      
      IMHO it would be helpful, if http::geturl would follow redirects automatically (or with an option).
      
      Following http://wiki.tcl.tk/1475
      
      Thus 
      ::http::geturl $url -followredirect 1
      would do:
      proc geturl_followRedirects {url args} {
           while {1} {
              set token [eval [list http::geturl $url] $args]
              switch -glob [http::ncode $token] {
                 30[1237] { ### redirect - see below ### }
                 default  { return $token }
              }
              upvar #0 $token state
              array set meta [set ${token}(meta)]
              if {![info exist meta(Location)]} {
                 return $token
              }
              set url $meta(Location)
              unset meta
           }
        }
      
      Thank you,
      - Harald
      
    4. login: "kjnash"
    5. mimetype: "text/x-fossil-plain"
    6. severity changed to: "Minor"