On Sun, 10 Nov 2002, Rasmus Lerdorf wrote: > Hrm.. Ok, actually Hartmut changed this recently. See: > > >http://cvs.php.net/diff.php/php4/main/php_content_types.c?login=2&r1=1.21&r2=1.22&ty=u > > It works when you turn on always_populate_raw_post_data, right?
kind of. it doesn't quite follow the doc blurb - even if always_populate is turned on, if the content type IS recognized, and it's not the default - which right now means only multipart/form-data far as i can tell - then HTTP_RAW_POST_DATA is not set. something should be changed to take that into account, either making it work with multipart/form-data or changing the documentation. also, there was a small change i had to make in php_content_types.c to make it pick up XML data without getting an error about the string not being null-terminated. i'm attaching a diff file.
Index: php_content_types.c =================================================================== RCS file: /repository/php4/main/php_content_types.c,v retrieving revision 1.23 diff -u -r1.23 php_content_types.c --- php_content_types.c 8 Nov 2002 08:41:52 -0000 1.23 +++ php_content_types.c 10 Nov 2002 17:16:04 -0000 @@ -38,6 +38,7 @@ SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader) { char *data = NULL; + int data_length = 0; if(PG(always_populate_raw_post_data)) { if(NULL == SG(request_info).post_data) { /* no data yet */ @@ -45,16 +46,18 @@ /* no post handler registered, so we just swallow the data */ sapi_read_standard_form_data(TSRMLS_C); data = SG(request_info).post_data; + data_length = SG(request_info).post_data_length; SG(request_info).post_data = NULL; SG(request_info).post_data_length = 0; } } else { /* copy existing post data */ - data = estrndup(SG(request_info).post_data, SG(request_info).post_data_length); + data_length = SG(request_info).post_data_length; + data = estrndup(SG(request_info).post_data, data_length); } if(data) { - SET_VAR_STRINGL("HTTP_RAW_POST_DATA", data, SG(request_info).post_data_length); + SET_VAR_STRINGL("HTTP_RAW_POST_DATA", data, data_length); } } }
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php