@@ -37,21 +37,19 @@ static sapi_post_entry php_post_entries[] = {
37
37
*/
38
38
SAPI_API SAPI_POST_READER_FUNC (php_default_post_reader )
39
39
{
40
- char * data = NULL ;
41
- int length = 0 ;
40
+ char * data ;
41
+ int length ;
42
42
43
43
/* $HTTP_RAW_POST_DATA registration */
44
- if (!strcmp (SG (request_info ).request_method , "POST" )) {
45
- if (NULL == SG (request_info ).post_entry && SG ( request_info ). post_data ) {
44
+ if (!strcmp (SG (request_info ).request_method , "POST" )) {
45
+ if (NULL == SG (request_info ).post_entry ) {
46
46
/* no post handler registered, so we just swallow the data */
47
47
sapi_read_standard_form_data (TSRMLS_C );
48
+ }
49
+
50
+ if (PG (always_populate_raw_post_data ) && SG (request_info ).post_data ) {
48
51
length = SG (request_info ).post_data_length ;
49
52
data = estrndup (SG (request_info ).post_data , length );
50
- } else if (PG (always_populate_raw_post_data ) && SG (request_info ).post_data ) {
51
- length = SG (request_info ).post_data_length ;
52
- data = estrndup (SG (request_info ).post_data , length );
53
- }
54
- if (data ) {
55
53
SET_VAR_STRINGL ("HTTP_RAW_POST_DATA" , data , length );
56
54
}
57
55
}
@@ -62,11 +60,10 @@ SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader)
62
60
in the long run post handlers should be changed to not touch
63
61
request_info.post_data for memory preservation reasons
64
62
*/
65
- if (SG (request_info ).post_data ) {
63
+ if (SG (request_info ).post_data ) {
66
64
SG (request_info ).raw_post_data = estrndup (SG (request_info ).post_data , SG (request_info ).post_data_length );
67
65
SG (request_info ).raw_post_data_length = SG (request_info ).post_data_length ;
68
66
}
69
-
70
67
}
71
68
/* }}} */
72
69
0 commit comments