1
0
mirror of https://github.com/php/php-src.git synced 2026-04-28 18:53:33 +02:00

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

This commit is contained in:
Jérôme Loyet
2011-07-04 21:29:32 +00:00
parent 4eb7fc8aa6
commit 8237737bd9
2 changed files with 12 additions and 0 deletions
+2
View File
@@ -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
View File
@@ -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 */