Skip to content

CGI Location #1597

@bradfitz

Description

@bradfitz
Should http/cgi default to a 3xx status if the child returns a "Location"
header but no explicit status?

http://www.ietf.org/rfc/rfc3875

Also, might want to support server-fetched redirects if the caller opts-in by defining a
FetchingRedirectClient *http.Client in their handler struct:


6.3.2.  Location

   The Location header field is used to specify to the server that the
   script is returning a reference to a document rather than an actual
   document (see sections 6.2.3 and 6.2.4).  It is either an absolute
   URI (optionally with a fragment identifier), indicating that the
   client is to fetch the referenced document, or a local URI path
   (optionally with a query string), indicating that the server is to
   fetch the referenced document and return it to the client as the
   response.

      Location        = local-Location | client-Location
      client-Location = "Location:" fragment-URI NL
      local-Location  = "Location:" local-pathquery NL
      fragment-URI    = absoluteURI [ "#" fragment ]
      fragment        = *uric
      local-pathquery = abs-path [ "?" query-string ]
      abs-path        = "/" path-segments
      path-segments   = segment *( "/" segment )
      segment         = *pchar
      pchar           = unreserved | escaped | extra
      extra           = ":" | "@" | "&" | "=" | "+" | "$" | ","

   The syntax of an absoluteURI is incorporated into this document from
   that specified in RFC 2396 [2] and RFC 2732 [7].  A valid absoluteURI
   always starts with the name of scheme followed by ":"; scheme names
   start with a letter and continue with alphanumerics, "+", "-" or ".".
   The local URI path and query must be an absolute path, and not a
   relative path or NULL, and hence must start with a "/".

   Note that any message-body attached to the request (such as for a
   POST request) may not be available to the resource that is the target
   of the redirect.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions