From: Ilia Alshanetsky Date: Tue, 10 Feb 2004 00:03:44 +0000 (+0000) Subject: MFH: Fixed bug #27026 (Added cgi.nph that allows forcing of the Status: 200 X-Git-Tag: php-4.3.5RC3~36 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=86337bac189e0a4b868afe8f24a5a3959ebdfdcd;p=php MFH: Fixed bug #27026 (Added cgi.nph that allows forcing of the Status: 200 header that is not normally needed). --- diff --git a/NEWS b/NEWS index b22fb40e52..d2775055a0 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,8 @@ PHP 4 NEWS - Fixed bug #27171 (crash inside gmp_hamdist()). (Jani) - Fixed bug #27149 (broken CLOB support in oci8 extension). (Antony) - Fixed bug #27135 (Possible crash inside mb_strlen()). (Moriyoshi) +- Fixed bug #27026 (Added cgi.nph that allows forcing of the Status: 200 + header that is not normally needed). (Ilia) - Fixed bug #24773 (unseting of strings as arrays causes a crash). (Sara) 03 Feb 2004, Version 4.3.5RC2 diff --git a/php.ini-dist b/php.ini-dist index d746bcb75f..132b7920ec 100644 --- a/php.ini-dist +++ b/php.ini-dist @@ -438,6 +438,10 @@ enable_dl = On ; **You CAN safely turn this off for IIS, in fact, you MUST.** ; cgi.force_redirect = 1 +; if cgi.nph is enabled it will force cgi to always sent Status: 200 with +; every request. +; cgi.nph = 1 + ; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape ; (iPlanet) web servers, you MAY need to set an environment variable name that PHP ; will look for to know it is OK to continue execution. Setting this variable MAY diff --git a/php.ini-recommended b/php.ini-recommended index 7e1d90c1da..8d2345b1f0 100644 --- a/php.ini-recommended +++ b/php.ini-recommended @@ -453,6 +453,10 @@ enable_dl = On ; **You CAN safely turn this off for IIS, in fact, you MUST.** ; cgi.force_redirect = 1 +; if cgi.nph is enabled it will force cgi to always sent Status: 200 with +; every request. +; cgi.nph = 1 + ; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape ; (iPlanet) web servers, you MAY need to set an environment variable name that PHP ; will look for to know it is OK to continue execution. Setting this variable MAY diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 2c8946cae2..292ccfdf6d 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -293,7 +293,7 @@ static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) char buf[SAPI_CGI_MAX_HEADER_LENGTH]; sapi_header_struct *h; zend_llist_position pos; - long rfc2616_headers = 0; + long rfc2616_headers = 0, nph = 0; if(SG(request_info).no_headers == 1) { return SAPI_HEADER_SENT_SUCCESSFULLY; @@ -307,7 +307,11 @@ static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) rfc2616_headers = 0; } - if (SG(sapi_headers).http_response_code != 200) { + if (cfg_get_long("cgi.nph", &nph) == FAILURE) { + nph = 0; + } + + if (nph || SG(sapi_headers).http_response_code != 200) { int len; if (rfc2616_headers && SG(sapi_headers).http_status_line) {