fat                                      Sat, 02 Jul 2011 16:34:39 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=312813

Log:
- Implemented FR #54499 (FPM ping and status_path should handle HEAD request)

Bug: https://bugs.php.net/54499 (Assigned) FPM ping and status_path should 
handle HEAD request
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_status.c
    U   php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_status.c
    U   php/php-src/trunk/sapi/fpm/fpm/fpm_status.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2011-07-02 16:10:18 UTC (rev 312812)
+++ php/php-src/branches/PHP_5_3/NEWS   2011-07-02 16:34:39 UTC (rev 312813)
@@ -24,6 +24,7 @@
     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

Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_status.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_status.c      2011-07-02 
16:10:18 UTC (rev 312812)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_status.c      2011-07-02 
16:34:39 UTC (rev 312813)
@@ -65,6 +65,12 @@
                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 @@
                        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 @@
                                }
                }

-               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 @@
                                scoreboard.active_max,
                                scoreboard.max_children_reached);

-               SG(sapi_headers).http_response_code = 200;
                PUTS(buffer);
                efree(buffer);


Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_status.c
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_status.c      2011-07-02 
16:10:18 UTC (rev 312812)
+++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_status.c      2011-07-02 
16:34:39 UTC (rev 312813)
@@ -65,6 +65,12 @@
                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 @@
                        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 @@
                                }
                }

-               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 @@
                                scoreboard.active_max,
                                scoreboard.max_children_reached);

-               SG(sapi_headers).http_response_code = 200;
                PUTS(buffer);
                efree(buffer);


Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_status.c
===================================================================
--- php/php-src/trunk/sapi/fpm/fpm/fpm_status.c 2011-07-02 16:10:18 UTC (rev 
312812)
+++ php/php-src/trunk/sapi/fpm/fpm/fpm_status.c 2011-07-02 16:34:39 UTC (rev 
312813)
@@ -65,6 +65,12 @@
                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 @@
                        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 @@
                                }
                }

-               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 @@
                                scoreboard.active_max,
                                scoreboard.max_children_reached);

-               SG(sapi_headers).http_response_code = 200;
                PUTS(buffer);
                efree(buffer);


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to