1- /*
1+ /*
22 +----------------------------------------------------------------------+
33 | PHP Version 5 |
44 +----------------------------------------------------------------------+
@@ -132,7 +132,7 @@ PHP_FUNCTION(header_register_callback)
132132 if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "z" , & callback_func ) == FAILURE ) {
133133 return ;
134134 }
135-
135+
136136 if (!zend_is_callable (callback_func , 0 , & callback_name TSRMLS_CC )) {
137137 efree (callback_name );
138138 RETURN_FALSE ;
@@ -160,10 +160,10 @@ static void sapi_run_header_callback(TSRMLS_D)
160160 char * callback_name = NULL ;
161161 char * callback_error = NULL ;
162162 zval * retval_ptr = NULL ;
163-
163+
164164 if (zend_fcall_info_init (SG (callback_func ), 0 , & fci , & SG (fci_cache ), & callback_name , & callback_error TSRMLS_CC ) == SUCCESS ) {
165165 fci .retval_ptr_ptr = & retval_ptr ;
166-
166+
167167 error = zend_call_function (& fci , & SG (fci_cache ) TSRMLS_CC );
168168 if (error == FAILURE ) {
169169 goto callback_failed ;
@@ -174,13 +174,13 @@ static void sapi_run_header_callback(TSRMLS_D)
174174callback_failed :
175175 php_error_docref (NULL TSRMLS_CC , E_WARNING , "Could not call the sapi_header_callback" );
176176 }
177-
177+
178178 if (callback_name ) {
179179 efree (callback_name );
180180 }
181181 if (callback_error ) {
182182 efree (callback_error );
183- }
183+ }
184184}
185185
186186SAPI_API void sapi_handle_post (void * arg TSRMLS_DC )
@@ -386,11 +386,11 @@ SAPI_API void sapi_activate_headers_only(TSRMLS_D)
386386 if (SG (request_info ).headers_read == 1 )
387387 return ;
388388 SG (request_info ).headers_read = 1 ;
389- zend_llist_init (& SG (sapi_headers ).headers , sizeof (sapi_header_struct ),
389+ zend_llist_init (& SG (sapi_headers ).headers , sizeof (sapi_header_struct ),
390390 (void (* )(void * )) sapi_free_header , 0 );
391391 SG (sapi_headers ).send_default_content_type = 1 ;
392392
393- /* SG(sapi_headers).http_response_code = 200; */
393+ /* SG(sapi_headers).http_response_code = 200; */
394394 SG (sapi_headers ).http_status_line = NULL ;
395395 SG (sapi_headers ).mimetype = NULL ;
396396 SG (read_post_bytes ) = 0 ;
@@ -403,7 +403,7 @@ SAPI_API void sapi_activate_headers_only(TSRMLS_D)
403403 SG (global_request_time ) = 0 ;
404404
405405 /*
406- * It's possible to override this general case in the activate() callback,
406+ * It's possible to override this general case in the activate() callback,
407407 * if necessary.
408408 */
409409 if (SG (request_info ).request_method && !strcmp (SG (request_info ).request_method , "HEAD" )) {
@@ -465,8 +465,8 @@ SAPI_API void sapi_activate(TSRMLS_D)
465465 * depending on given content type */
466466 sapi_read_post_data (TSRMLS_C );
467467 } else {
468- /* Any other method with content payload will fill $HTTP_RAW_POST_DATA
469- * if it is enabled by always_populate_raw_post_data.
468+ /* Any other method with content payload will fill $HTTP_RAW_POST_DATA
469+ * if it is enabled by always_populate_raw_post_data.
470470 * It's up to the webserver to decide whether to allow a method or not. */
471471 SG (request_info ).content_type_dup = NULL ;
472472 if (sapi_module .default_post_reader ) {
@@ -497,14 +497,14 @@ static void sapi_send_headers_free(TSRMLS_D)
497497 SG (sapi_headers ).http_status_line = NULL ;
498498 }
499499}
500-
500+
501501SAPI_API void sapi_deactivate (TSRMLS_D )
502502{
503503 zend_llist_destroy (& SG (sapi_headers ).headers );
504504 if (SG (request_info ).post_data ) {
505505 efree (SG (request_info ).post_data );
506506 } else if (SG (server_context )) {
507- if (sapi_module .read_post ) {
507+ if (sapi_module .read_post ) {
508508 /* make sure we've consumed all request input data */
509509 char dummy [SAPI_POST_BLOCK_SIZE ];
510510 int read_bytes ;
@@ -516,7 +516,7 @@ SAPI_API void sapi_deactivate(TSRMLS_D)
516516 }
517517 if (SG (request_info ).raw_post_data ) {
518518 efree (SG (request_info ).raw_post_data );
519- }
519+ }
520520 if (SG (request_info ).auth_user ) {
521521 efree (SG (request_info ).auth_user );
522522 }
@@ -574,7 +574,7 @@ static int sapi_extract_response_code(const char *header_line)
574574 break ;
575575 }
576576 }
577-
577+
578578 return code ;
579579}
580580
@@ -594,7 +594,7 @@ static void sapi_update_response_code(int ncode TSRMLS_DC)
594594 SG (sapi_headers ).http_response_code = ncode ;
595595}
596596
597- /*
597+ /*
598598 * since zend_llist_del_element only remove one matched item once,
599599 * we should remove them by ourself
600600 */
@@ -630,7 +630,7 @@ SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bo
630630{
631631 sapi_header_line ctr = {0 };
632632 int r ;
633-
633+
634634 ctr .line = header_line ;
635635 ctr .line_len = header_line_len ;
636636
@@ -724,7 +724,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
724724 } while (header_line_len && isspace (header_line [header_line_len - 1 ]));
725725 header_line [header_line_len ]= '\0' ;
726726 }
727-
727+
728728 if (op == SAPI_HEADER_DELETE ) {
729729 if (strchr (header_line , ':' )) {
730730 efree (header_line );
@@ -762,7 +762,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
762762 sapi_header .header_len = header_line_len ;
763763
764764 /* Check the header for a few cases that we have special support for in SAPI */
765- if (header_line_len >=5
765+ if (header_line_len >=5
766766 && !strncasecmp (header_line , "HTTP/" , 5 )) {
767767 /* filter out the response code */
768768 sapi_update_response_code (sapi_extract_response_code (header_line ) TSRMLS_CC );
@@ -821,8 +821,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
821821 /* Return a Found Redirect if one is not already specified */
822822 if (http_response_code ) { /* user specified redirect code */
823823 sapi_update_response_code (http_response_code TSRMLS_CC );
824- } else if (SG (request_info ).proto_num > 1000 &&
825- SG (request_info ).request_method &&
824+ } else if (SG (request_info ).proto_num > 1000 &&
825+ SG (request_info ).request_method &&
826826 strcmp (SG (request_info ).request_method , "HEAD" ) &&
827827 strcmp (SG (request_info ).request_method , "GET" )) {
828828 sapi_update_response_code (303 TSRMLS_CC );
@@ -1011,7 +1011,11 @@ SAPI_API struct stat *sapi_get_stat(TSRMLS_D)
10111011
10121012SAPI_API char * sapi_getenv (char * name , size_t name_len TSRMLS_DC )
10131013{
1014- if (sapi_module .getenv ) {
1014+ if (!strncasecmp (name , "HTTP_PROXY" , name_len )) {
1015+ /* Ugly fix for HTTP_PROXY issue */
1016+ return NULL ;
1017+ }
1018+ if (sapi_module .getenv ) {
10151019 char * value , * tmp = sapi_module .getenv (name , name_len TSRMLS_CC );
10161020 if (tmp ) {
10171021 value = estrdup (tmp );
0 commit comments