diff options
author | Hartmut Holzgraefe <hholzgra@php.net> | 2002-11-12 18:29:11 +0000 |
---|---|---|
committer | Hartmut Holzgraefe <hholzgra@php.net> | 2002-11-12 18:29:11 +0000 |
commit | be5e379ec6c5836e26713683731e747d8ec84f02 (patch) | |
tree | 7344fbf3be248f746267238e1d6f1d5e11ce5c72 /ext/standard/php_fopen_wrapper.c | |
parent | ef7bd02688c2aa66d51376e045640e08f5785629 (diff) | |
download | php-git-be5e379ec6c5836e26713683731e747d8ec84f02.tar.gz |
HTTP_RAW_POST_DATA BC fixes
# hopefully all done, commiting anyway to continue work on my home box
php://input stream fixes (POST data handerl mangles data, CLI crashbug)
Diffstat (limited to 'ext/standard/php_fopen_wrapper.c')
-rw-r--r-- | ext/standard/php_fopen_wrapper.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c index 50d5e50035..5d40a5a9aa 100644 --- a/ext/standard/php_fopen_wrapper.c +++ b/ext/standard/php_fopen_wrapper.c @@ -75,22 +75,24 @@ static size_t php_stream_input_read(php_stream *stream, char *buf, size_t count { size_t read_bytes = 0; if(!stream->eof) { - if(SG(request_info).post_data) { /* data has already been read by a post handler */ - read_bytes = SG(request_info).post_data_length - stream->position; + if(SG(request_info).raw_post_data) { /* data has already been read by a post handler */ + read_bytes = SG(request_info).raw_post_data_length - stream->position; if(read_bytes <= count) { stream->eof = 1; } else { read_bytes = count; } if(read_bytes) { - memcpy(buf, SG(request_info).post_data + stream->position, read_bytes); + memcpy(buf, SG(request_info).raw_post_data + stream->position, read_bytes); } - } else { + } else if(sapi_module.read_post) { read_bytes = sapi_module.read_post(buf, count TSRMLS_CC); if(read_bytes <= 0){ stream->eof = 1; read_bytes = 0; } + } else { + stream->eof = 1; } } @@ -133,7 +135,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, char *path, ch if (!strcasecmp(path, "input")) { return php_stream_alloc(&php_stream_input_ops, NULL, 0, "rb"); - } + } if (!strcasecmp(path, "stdin")) { fp = fdopen(dup(STDIN_FILENO), mode); |