From: Sascha Schumann Date: Wed, 4 Jun 2003 05:13:41 +0000 (+0000) Subject: Don't return CRLF from broken clients X-Git-Tag: php-4.3.3RC1~103 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=39f801b957b72e9494f0af9333ec9d08812aadf4;p=php Don't return CRLF from broken clients --- diff --git a/sapi/thttpd/thttpd.c b/sapi/thttpd/thttpd.c index 344962921a..37ed02d89b 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); }