From 639c491da4798b89174bd6bcfb9300c86f0053b7 Mon Sep 17 00:00:00 2001 From: Sascha Schumann Date: Fri, 3 Dec 1999 12:21:57 +0000 Subject: [PATCH] Add X-Powered-By header in all configurations to ease PHP usage metering --- main/main.c | 4 ++++ sapi/isapi/php4isapi.c | 7 ------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/main/main.c b/main/main.c index 4ea14444c5..8c6a06d3b4 100644 --- a/main/main.c +++ b/main/main.c @@ -743,6 +743,10 @@ int php_request_startup(CLS_D ELS_DC PLS_DC SLS_DC) sapi_activate(SLS_C); php_set_timeout(PG(max_execution_time)); + + if (PG(expose_php)) { + sapi_add_header(estrdup(SAPI_PHP_VERSION_HEADER), sizeof(SAPI_PHP_VERSION_HEADER) - 1); + } if (PG(output_buffering)) { php_start_ob_buffering(); diff --git a/sapi/isapi/php4isapi.c b/sapi/isapi/php4isapi.c index a72eacdcf0..affe58b7a2 100644 --- a/sapi/isapi/php4isapi.c +++ b/sapi/isapi/php4isapi.c @@ -174,16 +174,12 @@ static int sapi_isapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC) HSE_SEND_HEADER_EX_INFO header_info; char status_buf[MAX_STATUS_LENGTH]; sapi_header_struct default_content_type = { SAPI_DEFAULT_CONTENT_TYPE, sizeof(SAPI_DEFAULT_CONTENT_TYPE)-1 }; - sapi_header_struct php_version_header = { SAPI_PHP_VERSION_HEADER, sizeof(SAPI_PHP_VERSION_HEADER)-1 }; PLS_FETCH(); /* Obtain headers length */ if (SG(sapi_headers).send_default_content_type) { accumulate_header_length(&default_content_type, (void *) &total_length); } - if (PG(expose_php)) { - accumulate_header_length(&php_version_header, (void *) &total_length); - } zend_llist_apply_with_argument(&SG(sapi_headers).headers, (void (*)(void *, void *)) accumulate_header_length, (void *) &total_length); /* Generate headers */ @@ -192,9 +188,6 @@ static int sapi_isapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC) if (SG(sapi_headers).send_default_content_type) { concat_header(&default_content_type, (void *) &combined_headers_ptr); } - if (PG(expose_php)) { - concat_header(&php_version_header, (void *) &combined_headers_ptr); - } zend_llist_apply_with_argument(&SG(sapi_headers).headers, (void (*)(void *, void *)) concat_header, (void *) &combined_headers_ptr); *combined_headers_ptr++ = '\r'; *combined_headers_ptr++ = '\n'; -- 2.40.0