RE: [PHP] Redircetion and Browser-Type
| From: | Jesper Juhl | Date: | Fri, 28 Jul 2000 16:01:41 +0000 |
| Subject: | RE: [PHP] Redircetion and Browser-Type | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-8802@lists.php.net to get a copy of this message | ||
> The first one will because it redirects before anything is even sent to
the
> browser so it's browser non-dependant. The second might be browser
specific
> I don't know.
> Jason
That's how it's supposed to be, but reality is a bit different.
If I place the following script on my Apache 1.3.12 server running
PHP4.0.0 and then get it via http/1.1 then I get both the location header
/and/ the document body.
<?php
header('Location: http://www.php.net/');
echo 'You should not see this as you have been redirected';
?>
Here's a dump of my telnet session :
$ telnet jesper.staff.groundcontrol.dk 80
Trying 213.237.12.238...
Connected to www.groundcontrol.dk.
Escape character is '^]'.
GET /locationTest.php HTTP/1.1
Host: jesper.staff.groundcontrol.dk
HTTP/1.1 302 Found
Date: Sat, 29 Jul 2000 03:42:27 GMT
Server: Apache/1.3.12 (Unix) PHP/4.0.0 mod_ssl/2.6.4 OpenSSL/0.9.5a
X-Powered-By: PHP/4.0.0
Location: http://www.php.net/
Transfer-Encoding: chunked
Content-Type: text/html
33
You should not see this as you have been redirected
0
Connection closed by foreign host.
So as you see, you depend upon the fact that the browser honors the
Location header (and any compliant browser should), but in fact it is
possible to ignore it.
Jesper Juhl
juhl@eisenstein.dk