Wierd redirection problem with Location: 
Author Message
 Wierd redirection problem with Location:

Quote:

>print "Content-type: text/html\n";
>print "Location: http://www.*-*-*.com/ \n\n";

>All that it does is display a hyperlink on the screen to
> http://www.*-*-*.com/

>Any ideas why it is printing a link rather than loading the content of that
>page (which does have content)?  Thanks in advance.

>- Chris


This has absolutely nothing to do with perl.  But like computers in
general, it is simply doing what you are telling it to do, print html.
If you want to redirect, try removing the "Content-type:..." line.

David Efflandt/Elgin, IL USA



Sun, 27 Aug 2000 03:00:00 GMT  
 Wierd redirection problem with Location:

Quote:

> The combination

>              print "Content-type: text/html\n";
>              print "Location: /page1.htm\n\n";

> is successfully used to redirect to a page on your own server.  This is how
> you tell Perl to do it, and it works perfectly, as described in many Perl
> manuals

what manual are you using? it is wrong. and, with which user agents did
you test this?

<ANTHROPOMORPHIZE>
perl has no idea that you are printing an http header. it will not fix
your problems for you, and apparently your http server will not either.
</ANTHROPOMORPHIZE>

see this URI:

$u = "Location: http://www.cis.ohio-state.edu/htbin/rfc/rfc2068.html";
print "$u\n\n";

see section 14.30.

--

seek DATA,0,0;print($_=<DATA>),__END__
Just another Perl hacker,



Sun, 27 Aug 2000 03:00:00 GMT  
 Wierd redirection problem with Location:

On Wed, 11 Mar 1998 10:36:24 -0500, Dan Boorstein

Quote:

>$u = "Location: http://www.cis.ohio-state.edu/htbin/rfc/rfc2068.html";
>print "$u\n\n";

If you are using PWS or IIS, it is also REQUIRED that you return the
status code 301 too. took me a while to figure that one out on my own.

-Mike



Sun, 27 Aug 2000 03:00:00 GMT  
 Wierd redirection problem with Location:

Quote:

> I have a quirky problem...  The following works fine:

> print "Content-type: text/html\n";
> print "Location: /page1.htm\n\n";

Time for my stupid question:

 Why are you printing a Content-type at all if you are going to
redirect?

Bob Trieger



Wed, 30 Aug 2000 03:00:00 GMT  
 Wierd redirection problem with Location:


Quote:

>:             print "Content-type: text/html\n";
>:             print "Location: http://www.xyz.com/page1.htm\n\n";
>:
>:It merely puts a hyperlink on the screen.  It should do redirection to the
>:full URL.  Instead, it puts a hyperlink on the screen.  Is this a Perl issue?
>:Solaris?  Configuration of Solaris?  Thanks in avance.

>Use only: 'print "Location: http://www.xyz.com/page1.htm\n\n";'

>By using both, you're telling the web browsers with the first line that "print
>'Location: http://www.xyz.com/page1.htm\n\n";' should be interpreted as HTML
>rather than as a header.

thanks for trying, but you're wrong.

both of those lines are in the HTTP header which isn't terminated
until the first blank line.  if you read the HTTP specification [1], you
will discover that it suggests that redirections include a short
hypertext note in the HTTP message body.  this means that the
Content-type header is not only valid in this situation, but
recommended.

[1] see the CGI Meta FAQ

--

CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>



Wed, 06 Sep 2000 03:00:00 GMT  
 Wierd redirection problem with Location:


Quote:


> > If you are using PWS or IIS, it is also REQUIRED that you return the
> > status code 301 too. took me a while to figure that one out on my own.

> Aha. So that's why my transparent redirects don't do anything,

If you're using those servers, it might be.  Why don't you ask on the
appropriate CGI or servers group, describing your problem as far as
you've got? This clearly isn't a Perl language question.

Quote:
> though I'm using Apache.

Now he tells us.  Location: works fine on Apache without an explicit
status 30x, I assure you.

Quote:
> Is this just the return code from exit, that is, would the perl
> code be simply:

> exit 301;

Erm, what was your reaction to the CGI tutorial and spec at
http://hoohoo.ncsa.uiuc.edu?


Thu, 07 Sep 2000 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Wierd redirection problem with Location:

2. redirection Location help

3. Redirection using location

4. Location, Redirection

5. redirection using Location

6. redirection using Location: in Perl CGI script

7. Wierd: SUN problem or Perl problem ?

8. wierd problem with system()

9. Wierd Linux chat2.pl problem with sockname

10. Wierd mod_perl problem

11. Help! Wierd Perl string problem

12. Wierd suid problem

 

 
Powered by phpBB® Forum Software