php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8008 HTTP/1.1 307 Temporary Redirect ignored
Submitted: 2000-11-28 05:38 UTC Modified: 2000-11-28 20:25 UTC
From: leen at wirehub dot nl Assigned:
Status: Closed Package: HTTP related
PHP Version: 4.0.3pl1 OS: Linux 2.2
Private report: No CVE-ID: None
 [2000-11-28 05:38 UTC] leen at wirehub dot nl
in main/SAPI.c:
line    code
   441                                  SG(sapi_headers).send_default_content_type = 0;
   442                          } else if (!STRCASECMP(header_line, "Location")) {
   443                                  SG(sapi_headers).http_response_code = 302; /* redirect */
   444                          } else if (!STRCASECMP(header_line, "WWW-Authenticate")) { /* HTTP Authentication */
   445                                  SG(sapi_headers).http_response_code = 401; /* authentication-required */
   446                          }
   447                          *colon_offset = ':';
   448                  }

My knowledge of C is not so great but I can see that this is being ignored somewhere allong those lines of code (this is part of my script):

header ("HTTP/1.1 307 Temporary Redirect");
header (""Location: "http://<redirlocation>");

Please do something about it, this is very anoying, because this is what I get:
HTTP/1.1 302 Found
Date: Tue, 28 Nov 2000 12:50:46 GMT
Server: Apache/1.3.9 (Unix) Debian/GNU PHP/4.0.3pl1
X-Powered-By: PHP/4.0.3pl1
Location: http://<redirlocation>
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html

(ofcourse http://<redirlocation> is then ofcourse a real location)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-28 18:20 UTC] jason@php.net
Reclassified and Verified on 4.0.3pl1 and CVS. Works fine in CGI mode does not work as apache module.

-Jason


 [2000-11-28 19:22 UTC] jason@php.net
Relassified back, CGI of course would work becuase it doesn't prune the HTTP header line as done by most other webservers. 

SAPI.c does reset response_code when it encounters Location
headers

A work around is to list the HTTP/1.1 xxx code header after the location header.

header ("Location: http://<redirlocation>");
header ("HTTP/1.1 307 Temporary Redirect");

I will be thinking about a possible better way to implement this

-Jason

 [2000-11-28 20:25 UTC] jason@php.net
Fixed in CVS
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 17:01:28 2024 UTC