63
63
#define PHP_SOURCE_MAGIC_TYPE "application/x-httpd-php-source"
64
64
#define PHP_SCRIPT "php7-script"
65
65
66
- /* if apache's version is newer than 2.2.31 or 2.4.16 */
67
- #if MODULE_MAGIC_COOKIE == 0x41503232UL && AP_MODULE_MAGIC_AT_LEAST (20051115 ,40 ) || \
68
- MODULE_MAGIC_COOKIE == 0x41503234UL && AP_MODULE_MAGIC_AT_LEAST (20120211 ,47 )
69
- #define php_ap_map_http_request_error ap_map_http_request_error
70
- #else
71
- static int php_ap_map_http_request_error (apr_status_t rv , int status )
72
- {
73
- switch (rv ) {
74
- case AP_FILTER_ERROR : {
75
- return AP_FILTER_ERROR ;
76
- }
77
- case APR_ENOSPC : {
78
- return HTTP_REQUEST_ENTITY_TOO_LARGE ;
79
- }
80
- case APR_ENOTIMPL : {
81
- return HTTP_NOT_IMPLEMENTED ;
82
- }
83
- case APR_ETIMEDOUT : {
84
- return HTTP_REQUEST_TIME_OUT ;
85
- }
86
- default : {
87
- return status ;
88
- }
89
- }
90
- }
91
- #endif
92
-
93
66
/* A way to specify the location of the php.ini dir in an apache directive */
94
67
char * apache2_php_ini_path_override = NULL ;
95
68
#if defined(PHP_WIN32 ) && defined(ZTS )
@@ -211,7 +184,6 @@ php_apache_sapi_read_post(char *buf, size_t count_bytes)
211
184
php_struct * ctx = SG (server_context );
212
185
request_rec * r ;
213
186
apr_bucket_brigade * brigade ;
214
- apr_status_t ret ;
215
187
216
188
r = ctx -> r ;
217
189
brigade = ctx -> brigade ;
@@ -223,7 +195,7 @@ php_apache_sapi_read_post(char *buf, size_t count_bytes)
223
195
* need to make sure that if data is available we fill the buffer completely.
224
196
*/
225
197
226
- while (( ret = ap_get_brigade (r -> input_filters , brigade , AP_MODE_READBYTES , APR_BLOCK_READ , len ) ) == APR_SUCCESS ) {
198
+ while (ap_get_brigade (r -> input_filters , brigade , AP_MODE_READBYTES , APR_BLOCK_READ , len ) == APR_SUCCESS ) {
227
199
apr_brigade_flatten (brigade , buf , & len );
228
200
apr_brigade_cleanup (brigade );
229
201
tlen += len ;
@@ -234,15 +206,6 @@ php_apache_sapi_read_post(char *buf, size_t count_bytes)
234
206
len = count_bytes - tlen ;
235
207
}
236
208
237
- if (ret != APR_SUCCESS ) {
238
- AP2 (post_read_error ) = 1 ;
239
- if (APR_STATUS_IS_TIMEUP (ret )) {
240
- SG (sapi_headers ).http_response_code = php_ap_map_http_request_error (ret , HTTP_REQUEST_TIME_OUT );
241
- } else {
242
- SG (sapi_headers ).http_response_code = php_ap_map_http_request_error (ret , HTTP_BAD_REQUEST );
243
- }
244
- }
245
-
246
209
return tlen ;
247
210
}
248
211
@@ -524,7 +487,6 @@ static int php_apache_request_ctor(request_rec *r, php_struct *ctx)
524
487
SG (request_info ).proto_num = r -> proto_num ;
525
488
SG (request_info ).request_uri = apr_pstrdup (r -> pool , r -> uri );
526
489
SG (request_info ).path_translated = apr_pstrdup (r -> pool , r -> filename );
527
- AP2 (post_read_error ) = 0 ;
528
490
r -> no_local_copy = 1 ;
529
491
530
492
content_length = (char * ) apr_table_get (r -> headers_in , "Content-Length" );
@@ -694,13 +656,6 @@ zend_first_try {
694
656
brigade = ctx -> brigade ;
695
657
}
696
658
697
- if (AP2 (post_read_error )) {
698
- ap_log_rerror (APLOG_MARK , APLOG_ERR , 0 , r , "Error while attempting to read POST data: %d" , SG (sapi_headers ).http_response_code );
699
- apr_brigade_cleanup (brigade );
700
- PHPAP_INI_OFF ;
701
- return SG (sapi_headers ).http_response_code ;
702
- }
703
-
704
659
if (AP2 (last_modified )) {
705
660
ap_update_mtime (r , r -> finfo .mtime );
706
661
ap_set_last_modified (r );
0 commit comments