Browse Source

- Fixed missing Expires and Cache-Control headers for ping and status pages

pull/12/head
Jérôme Loyet 15 years ago
parent
commit
8237737bd9
  1. 2
      NEWS
  2. 10
      sapi/fpm/fpm/fpm_status.c

2
NEWS

@ -28,6 +28,8 @@ PHP NEWS
- PHP-FPM SAPI:
. Implemented FR #54499 (FPM ping and status_path should handle HEAD request). (fat)
. Implemented FR #54172 (Overriding the pid file location of php-fpm). (fat)
. Fixed missing Expires and Cache-Control headers for ping and status pages.
(fat)
- SPL extension:
. Fixed bug #54971 (Wrong result when using iterator_to_array with use_keys

10
sapi/fpm/fpm/fpm_status.c

@ -57,6 +57,8 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
/* PING */
if (fpm_status_ping_uri && fpm_status_ping_response && !strcmp(fpm_status_ping_uri, SG(request_info).request_uri)) {
sapi_add_header_ex(ZEND_STRL("Content-Type: text/plain"), 1, 1 TSRMLS_CC);
sapi_add_header_ex(ZEND_STRL("Expires: Thu, 01 Jan 1970 00:00:00 GMT"), 1, 1 TSRMLS_CC);
sapi_add_header_ex(ZEND_STRL("Cache-Control: no-cache, no-store, must-revalidate, max-age=0"), 1, 1 TSRMLS_CC);
SG(sapi_headers).http_response_code = 200;
/* handle HEAD */
@ -76,6 +78,8 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
zlog(ZLOG_ERROR, "status: unable to find or access status shared memory");
SG(sapi_headers).http_response_code = 500;
sapi_add_header_ex(ZEND_STRL("Content-Type: text/plain"), 1, 1 TSRMLS_CC);
sapi_add_header_ex(ZEND_STRL("Expires: Thu, 01 Jan 1970 00:00:00 GMT"), 1, 1 TSRMLS_CC);
sapi_add_header_ex(ZEND_STRL("Cache-Control: no-cache, no-store, must-revalidate, max-age=0"), 1, 1 TSRMLS_CC);
PUTS("Internal error. Please review log file for errors.");
return 1;
}
@ -84,6 +88,8 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
zlog(ZLOG_NOTICE, "[pool %s] status: scoreboard already in used.", scoreboard_p->pool);
SG(sapi_headers).http_response_code = 503;
sapi_add_header_ex(ZEND_STRL("Content-Type: text/plain"), 1, 1 TSRMLS_CC);
sapi_add_header_ex(ZEND_STRL("Expires: Thu, 01 Jan 1970 00:00:00 GMT"), 1, 1 TSRMLS_CC);
sapi_add_header_ex(ZEND_STRL("Cache-Control: no-cache, no-store, must-revalidate, max-age=0"), 1, 1 TSRMLS_CC);
PUTS("Server busy. Please try again later.");
return 1;
}
@ -95,11 +101,15 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
zlog(ZLOG_ERROR, "[pool %s] invalid status values", scoreboard.pool);
SG(sapi_headers).http_response_code = 500;
sapi_add_header_ex(ZEND_STRL("Content-Type: text/plain"), 1, 1 TSRMLS_CC);
sapi_add_header_ex(ZEND_STRL("Expires: Thu, 01 Jan 1970 00:00:00 GMT"), 1, 1 TSRMLS_CC);
sapi_add_header_ex(ZEND_STRL("Cache-Control: no-cache, no-store, must-revalidate, max-age=0"), 1, 1 TSRMLS_CC);
PUTS("Internal error. Please review log file for errors.");
return 1;
}
/* send common headers */
sapi_add_header_ex(ZEND_STRL("Expires: Thu, 01 Jan 1970 00:00:00 GMT"), 1, 1 TSRMLS_CC);
sapi_add_header_ex(ZEND_STRL("Cache-Control: no-cache, no-store, must-revalidate, max-age=0"), 1, 1 TSRMLS_CC);
SG(sapi_headers).http_response_code = 200;
/* handle HEAD */

Loading…
Cancel
Save