]> granicus.if.org Git - php/commitdiff
MFH - Fixed bug #31519: Set r->status_line to SAPI-provided status-line.
authorJoe Orton <jorton@php.net>
Mon, 17 Jan 2005 12:35:28 +0000 (12:35 +0000)
committerJoe Orton <jorton@php.net>
Mon, 17 Jan 2005 12:35:28 +0000 (12:35 +0000)
sapi/apache2handler/sapi_apache2.c

index fa91288f95289c839e30328e5829ce397ca9c0e7..c689c30735933dbfc2906193efa721fb3e4b0f95 100644 (file)
@@ -121,9 +121,17 @@ static int
 php_apache_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
 {
        php_struct *ctx = SG(server_context);
+       const char *sline = SG(sapi_headers).http_status_line;
 
        ctx->r->status = SG(sapi_headers).http_response_code;
 
+       /* httpd requires that r->status_line is set to the first digit of
+        * the status-code: */
+       if (sline && strlen(sline) > 12 && strncmp(sline, "HTTP/1.", 7) == 0 
+               && sline[8] == ' ') {
+               ctx->r->status_line = apr_pstrdup(ctx->r->pool, sline + 9);
+       }
+
        return SAPI_HEADER_SENT_SUCCESSFULLY;
 }