]> granicus.if.org Git - php/commitdiff
MFB: Fixed bug #39984 (redirect response code in header() could be ignored
authorIlia Alshanetsky <iliaa@php.net>
Sun, 31 Dec 2006 19:22:17 +0000 (19:22 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 31 Dec 2006 19:22:17 +0000 (19:22 +0000)
in CGI sapi).

main/SAPI.c

index 56488efdc9e9577624b7b7327d63b7647d5a73b4..8e1aa862fbe1f9bd47c5f544620907312e1bb6f2 100644 (file)
@@ -657,7 +657,9 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
                                        SG(sapi_headers).http_response_code > 307) &&
                                        SG(sapi_headers).http_response_code != 201) {
                                        /* Return a Found Redirect if one is not already specified */
-                                       if(SG(request_info).proto_num > 1000 && 
+                                       if (http_response_code) { /* user specified redirect code */
+                                               sapi_update_response_code(http_response_code TSRMLS_CC);
+                                       } else if (SG(request_info).proto_num > 1000 && 
                                           SG(request_info).request_method && 
                                           strcmp(SG(request_info).request_method, "HEAD") &&
                                           strcmp(SG(request_info).request_method, "GET")) {