diff options
| author | Sascha Schumann <sas@php.net> | 2003-06-04 05:13:59 +0000 |
|---|---|---|
| committer | Sascha Schumann <sas@php.net> | 2003-06-04 05:13:59 +0000 |
| commit | 4247f4b90e2eac99e000dd49899e3b66deb693f6 (patch) | |
| tree | d08ce909b17190ad76a429800ddd3aada93de349 | |
| parent | 73f3b49d9a3614085e4d3a1178f0f46739284716 (diff) | |
| download | php-git-4247f4b90e2eac99e000dd49899e3b66deb693f6.tar.gz | |
Don't return CRLF from broken clients
| -rw-r--r-- | sapi/thttpd/thttpd.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sapi/thttpd/thttpd.c b/sapi/thttpd/thttpd.c index 48054c4394..a37737f027 100644 --- a/sapi/thttpd/thttpd.c +++ b/sapi/thttpd/thttpd.c @@ -44,6 +44,7 @@ typedef struct { httpd_conn *hc; void (*on_close)(int); + size_t unconsumed_length; smart_str sbuf; int seen_cl; int seen_cn; @@ -227,14 +228,12 @@ static int sapi_thttpd_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) static int sapi_thttpd_read_post(char *buffer, uint count_bytes TSRMLS_DC) { size_t read_bytes = 0; - int c; - c = SIZEOF_UNCONSUMED_BYTES(); - if (c > 0) { - read_bytes = MIN(c, count_bytes); + if (TG(unconsumed_length) > 0) { + read_bytes = MIN(TG(unconsumed_length), count_bytes); memcpy(buffer, TG(hc)->read_buf + TG(hc)->checked_idx, read_bytes); + TG(unconsumed_length) -= read_bytes; CONSUME_BYTES(read_bytes); - count_bytes -= read_bytes; } return read_bytes; @@ -436,6 +435,8 @@ static void thttpd_request_ctor(TSRMLS_D) SG(request_info).content_type = strdup(TG(hc)->contenttype); SG(request_info).content_length = TG(hc)->contentlength == -1 ? 0 : TG(hc)->contentlength; + + TG(unconsumed_length) = SG(request_info).content_length; php_handle_auth_data(TG(hc)->authorization TSRMLS_CC); } |
