]> granicus.if.org Git - php/commitdiff
- Implemented FR #54499 (FPM ping and status_path should handle HEAD request)
authorJérôme Loyet <fat@php.net>
Sat, 2 Jul 2011 16:34:39 +0000 (16:34 +0000)
committerJérôme Loyet <fat@php.net>
Sat, 2 Jul 2011 16:34:39 +0000 (16:34 +0000)
NEWS
sapi/fpm/fpm/fpm_status.c

diff --git a/NEWS b/NEWS
index 79be61e8bda15c0f9e157fd9b5dd00869945414f..5fb0742d3a784074d539a819c31328bacdb77c26 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,7 @@ PHP                                                                        NEWS
     real-time FPM status. (fat)
   . Fixed missing Expires and Cache-Control headers for ping and status pages.
     (fat)
+  . Implemented FR #54499 (FPM ping and status_path should handle HEAD request). (fat)
 
 - SPL extension:
   . Fixed bug #54971 (Wrong result when using iterator_to_array with use_keys
index ac9365de8a0a3bcef8bcf695cf7abbe58ecc3f5b..cf912c06a98ec746210d31d1df2be79a71d95050 100644 (file)
@@ -65,6 +65,12 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
                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 */
+               if (SG(request_info).headers_only) {
+                       return 1;
+               }
+
                PUTS(fpm_status_ping_response);
                return 1;
        }
@@ -107,6 +113,16 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
                        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 */
+               if (SG(request_info).headers_only) {
+                       return 1;
+               }
+
                /* full status ? */
                full = SG(request_info).request_uri && strstr(SG(request_info).query_string, "full");
                short_syntax = short_post = NULL;
@@ -332,9 +348,6 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
                                }
                }
 
-               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);
-
                strftime(time_buffer, sizeof(time_buffer) - 1, time_format, localtime(&scoreboard.start_epoch));
                now_epoch = time(NULL);
                spprintf(&buffer, 0, short_syntax,
@@ -354,7 +367,6 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
                                scoreboard.active_max,
                                scoreboard.max_children_reached);
 
-               SG(sapi_headers).http_response_code = 200;
                PUTS(buffer);
                efree(buffer);