1
- /*
1
+ /*
2
2
+----------------------------------------------------------------------+
3
3
| PHP Version 5 |
4
4
+----------------------------------------------------------------------+
@@ -132,7 +132,7 @@ PHP_FUNCTION(header_register_callback)
132
132
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "z" , & callback_func ) == FAILURE ) {
133
133
return ;
134
134
}
135
-
135
+
136
136
if (!zend_is_callable (callback_func , 0 , & callback_name TSRMLS_CC )) {
137
137
efree (callback_name );
138
138
RETURN_FALSE ;
@@ -160,10 +160,10 @@ static void sapi_run_header_callback(TSRMLS_D)
160
160
char * callback_name = NULL ;
161
161
char * callback_error = NULL ;
162
162
zval * retval_ptr = NULL ;
163
-
163
+
164
164
if (zend_fcall_info_init (SG (callback_func ), 0 , & fci , & SG (fci_cache ), & callback_name , & callback_error TSRMLS_CC ) == SUCCESS ) {
165
165
fci .retval_ptr_ptr = & retval_ptr ;
166
-
166
+
167
167
error = zend_call_function (& fci , & SG (fci_cache ) TSRMLS_CC );
168
168
if (error == FAILURE ) {
169
169
goto callback_failed ;
@@ -174,13 +174,13 @@ static void sapi_run_header_callback(TSRMLS_D)
174
174
callback_failed :
175
175
php_error_docref (NULL TSRMLS_CC , E_WARNING , "Could not call the sapi_header_callback" );
176
176
}
177
-
177
+
178
178
if (callback_name ) {
179
179
efree (callback_name );
180
180
}
181
181
if (callback_error ) {
182
182
efree (callback_error );
183
- }
183
+ }
184
184
}
185
185
186
186
SAPI_API void sapi_handle_post (void * arg TSRMLS_DC )
@@ -386,11 +386,11 @@ SAPI_API void sapi_activate_headers_only(TSRMLS_D)
386
386
if (SG (request_info ).headers_read == 1 )
387
387
return ;
388
388
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 ),
390
390
(void (* )(void * )) sapi_free_header , 0 );
391
391
SG (sapi_headers ).send_default_content_type = 1 ;
392
392
393
- /* SG(sapi_headers).http_response_code = 200; */
393
+ /* SG(sapi_headers).http_response_code = 200; */
394
394
SG (sapi_headers ).http_status_line = NULL ;
395
395
SG (sapi_headers ).mimetype = NULL ;
396
396
SG (read_post_bytes ) = 0 ;
@@ -403,7 +403,7 @@ SAPI_API void sapi_activate_headers_only(TSRMLS_D)
403
403
SG (global_request_time ) = 0 ;
404
404
405
405
/*
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,
407
407
* if necessary.
408
408
*/
409
409
if (SG (request_info ).request_method && !strcmp (SG (request_info ).request_method , "HEAD" )) {
@@ -465,8 +465,8 @@ SAPI_API void sapi_activate(TSRMLS_D)
465
465
* depending on given content type */
466
466
sapi_read_post_data (TSRMLS_C );
467
467
} 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.
470
470
* It's up to the webserver to decide whether to allow a method or not. */
471
471
SG (request_info ).content_type_dup = NULL ;
472
472
if (sapi_module .default_post_reader ) {
@@ -497,14 +497,14 @@ static void sapi_send_headers_free(TSRMLS_D)
497
497
SG (sapi_headers ).http_status_line = NULL ;
498
498
}
499
499
}
500
-
500
+
501
501
SAPI_API void sapi_deactivate (TSRMLS_D )
502
502
{
503
503
zend_llist_destroy (& SG (sapi_headers ).headers );
504
504
if (SG (request_info ).post_data ) {
505
505
efree (SG (request_info ).post_data );
506
506
} else if (SG (server_context )) {
507
- if (sapi_module .read_post ) {
507
+ if (sapi_module .read_post ) {
508
508
/* make sure we've consumed all request input data */
509
509
char dummy [SAPI_POST_BLOCK_SIZE ];
510
510
int read_bytes ;
@@ -516,7 +516,7 @@ SAPI_API void sapi_deactivate(TSRMLS_D)
516
516
}
517
517
if (SG (request_info ).raw_post_data ) {
518
518
efree (SG (request_info ).raw_post_data );
519
- }
519
+ }
520
520
if (SG (request_info ).auth_user ) {
521
521
efree (SG (request_info ).auth_user );
522
522
}
@@ -574,7 +574,7 @@ static int sapi_extract_response_code(const char *header_line)
574
574
break ;
575
575
}
576
576
}
577
-
577
+
578
578
return code ;
579
579
}
580
580
@@ -594,7 +594,7 @@ static void sapi_update_response_code(int ncode TSRMLS_DC)
594
594
SG (sapi_headers ).http_response_code = ncode ;
595
595
}
596
596
597
- /*
597
+ /*
598
598
* since zend_llist_del_element only remove one matched item once,
599
599
* we should remove them by ourself
600
600
*/
@@ -630,7 +630,7 @@ SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bo
630
630
{
631
631
sapi_header_line ctr = {0 };
632
632
int r ;
633
-
633
+
634
634
ctr .line = header_line ;
635
635
ctr .line_len = header_line_len ;
636
636
@@ -724,7 +724,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
724
724
} while (header_line_len && isspace (header_line [header_line_len - 1 ]));
725
725
header_line [header_line_len ]= '\0' ;
726
726
}
727
-
727
+
728
728
if (op == SAPI_HEADER_DELETE ) {
729
729
if (strchr (header_line , ':' )) {
730
730
efree (header_line );
@@ -762,7 +762,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
762
762
sapi_header .header_len = header_line_len ;
763
763
764
764
/* 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
766
766
&& !strncasecmp (header_line , "HTTP/" , 5 )) {
767
767
/* filter out the response code */
768
768
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)
821
821
/* Return a Found Redirect if one is not already specified */
822
822
if (http_response_code ) { /* user specified redirect code */
823
823
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 &&
826
826
strcmp (SG (request_info ).request_method , "HEAD" ) &&
827
827
strcmp (SG (request_info ).request_method , "GET" )) {
828
828
sapi_update_response_code (303 TSRMLS_CC );
@@ -1011,7 +1011,11 @@ SAPI_API struct stat *sapi_get_stat(TSRMLS_D)
1011
1011
1012
1012
SAPI_API char * sapi_getenv (char * name , size_t name_len TSRMLS_DC )
1013
1013
{
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 ) {
1015
1019
char * value , * tmp = sapi_module .getenv (name , name_len TSRMLS_CC );
1016
1020
if (tmp ) {
1017
1021
value = estrdup (tmp );
0 commit comments