static void sapi_update_response_code(int ncode TSRMLS_DC)
{
+ /* if the status code did not change, we do not want
+ to change the status line, and no need to change the code */
+ if (SG(sapi_headers).http_response_code == ncode) {
+ return;
+ }
+
if (SG(sapi_headers).http_status_line) {
efree(SG(sapi_headers).http_status_line);
SG(sapi_headers).http_status_line = NULL;
; use when sending HTTP response code. If it's set 0 PHP sends Status: header that
; is supported by Apache. When this option is set to 1 PHP will send
; RFC2616 compliant header.
-; Set to 1 if running under IIS. Default is zero.
+; Default is zero.
;cgi.rfc2616_headers = 0
; use when sending HTTP response code. If it's set 0 PHP sends Status: header that
; is supported by Apache. When this option is set to 1 PHP will send
; RFC2616 compliant header.
-; Set to 1 if running under IIS. Default is zero.
+; Default is zero.
;cgi.rfc2616_headers = 0
if (SG(sapi_headers).http_response_code != 200) {
int len;
- if (rfc2616_headers) {
+ if (rfc2616_headers && SG(sapi_headers).http_status_line) {
len = snprintf(buf, SAPI_CGI_MAX_HEADER_LENGTH,
"%s\r\n", SG(sapi_headers).http_status_line);