Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perlfaq9: Location: versus URI: CGI header #1805

Closed
p5pRT opened this issue Apr 9, 2000 · 5 comments
Closed

perlfaq9: Location: versus URI: CGI header #1805

p5pRT opened this issue Apr 9, 2000 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Apr 9, 2000

Migrated from rt.perl.org#3064 (status was 'resolved')

Searchable as RT3064$

@p5pRT
Copy link
Author

p5pRT commented Apr 9, 2000

From flavell@mail.cern.ch

This refers to the perlfaq9 that's distributed with 5.6.0, which in
this regard is substantially the same as in the previous version.

There seem to be a couple of discrepancies in this, of which
the specific point I'm addressing here is the claim made here​:

=head2 How do I redirect to another page?

Instead of sending back a C<Content-Type> as the headers of your
reply, send back a C<Location​:> header. Officially this should be a
  ^^^^^^^^^^
C<URI​:> header, so the CGI.pm module (available from CPAN) sends back
both​:

There have been several discussions of this point in recent months on
comp.lang.perl.misc, but no-one seems to be able to find any
authoritative grounds for this claim - which seems to have surfaced
late in 1995 in relation to CGI.pm, and been religiously copied
thereafter, but which I have been unable to find mentioned in any
other context - outside of Perl - where the CGI is discussed.

So, the claim that the URI header is the "official" one and that
Location​: is obsolete/obsolescent seems to be found only in the Perl
FAQ9 and in the documentation for CGI.pm (and in answers that are
based on one or the other), but to have no basis in any of the
currently valid specifications for the CGI and for HTTP.

For background please feel free to check this copy of a posting to
c.l.p.m, <Pine.GHP.4.21.0004091506180.10937-100000@​hpplus01.cern.ch> :

http​://ppewww.ph.gla.ac.uk/~flavell/www/cgiperl2.html

Prompted by earlier discussion on c.l.p.m, which addressed this and
other points about FAQ9, I had put together - with the help of the
other participants of the usenet group - some suggestions for
revision, which are presented as briefly as seemed possible, together
with an excessive quantity of supporting background detail, at

http​://ppewww.ph.gla.ac.uk/~flavell/www/perlcgifaq.html

As I already remarked, I'm not trying to force my particular style on
anyone - these are only suggestions, but I _would_ like the facts to
be straightened out, one way or another. The suggestions were
favourably received by several of the respected regulars on c.l.p.m,
but don't actually seem to have been taken up anywhere yet.

I've now been advised by two of those regulars to make a submission
myself as a perlbug, and this is it.

Any advice on whether I should raise the other couple of points
(about relative paths and about newline representations) as
separate documentation bugs, please?

best regards

@p5pRT
Copy link
Author

p5pRT commented Nov 29, 2000

From [Unknown Contact. See original ticket]

I've poured over the HTTP RFC and can't find anything about a URI​: header.
Location​: is all over it as the preferred method.

Inline Patch
--- perlfaq9.podo       Tue Nov 14 10:57:27 2000
+++ perlfaq9.pod        Tue Nov 14 11:03:53 2000
@@ -224,13 +224,11 @@
 
 =head2 How do I redirect to another page?
 
-Instead of sending back a C<Content-Type> as the headers of your
-reply, send back a C<Location:> header.  Officially this should be a
-C<URI:> header, so the CGI.pm module (available from CPAN) sends back
-both:
+According to RFC 2616, "Hypertext Transfer Protocol -- HTTP/1.1", the
+preferred method is to send a C<Location:> header instead of a
+C<Content-Type:> header:
 
     Location: http://www.domain.com/newpage
-    URI: http://www.domain.com/newpage
 
 Note that relative URLs in these headers can cause strange effects
 because of "optimizations" that servers do.

@p5pRT
Copy link
Author

p5pRT commented Nov 29, 2000

From @jhi

On Fri, Nov 17, 2000 at 08​:55​:45AM -0500, Stephen P. Potter wrote​:

I've poured over the HTTP RFC and can't find anything about a URI​: header.
Location​: is all over it as the preferred method.

--- perlfaq9.podo Tue Nov 14 10​:57​:27 2000
+++ perlfaq9.pod Tue Nov 14 11​:03​:53 2000
@​@​ -224,13 +224,11 @​@​

Thanks, applied.

@p5pRT
Copy link
Author

p5pRT commented Nov 29, 2000

From [Unknown Contact. See original ticket]

On 17 Nov 2000, at 8​:55, Stephen P. Potter wrote​:

I've poured over the HTTP RFC and can't find anything about a URI​: header.
Location​: is all over it as the preferred method.

Shouldn't this patch include a patch for CGI.pm, as well? After all, the
old text says​:

-reply, send back a C<Location​:> header. Officially this should be a
-C<URI​:> header, so the CGI.pm module (available from CPAN) sends back
-both​:

Cheers,
Philip

@p5pRT
Copy link
Author

p5pRT commented Nov 29, 2000

From [Unknown Contact. See original ticket]

Lightning flashed, thunder crashed and "Philip Newton" <pnewton@​gmx.de> whisper
ed​:
| > I've poured over the HTTP RFC and can't find anything about a URI​: header.
| > Location​: is all over it as the preferred method.
|
| Shouldn't this patch include a patch for CGI.pm, as well? After all, the
| old text says​:

I don't believe a patch is necessary. I don't see that CGI.pm sends a URI​:
header anyway. It may have in an older version, and the FAQ just wasn't up
to date on that either.

-spp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant