sas Wed Jun 4 01:31:28 2003 EDT
Modified files: (Branch: PHP_4)
/php4/sapi/thttpd thttpd.c
Log:
Don't return CRLF from broken clients
Index: php4/sapi/thttpd/thttpd.c
diff -u php4/sapi/thttpd/thttpd.c:1.77.2.2.2.8 php4/sapi/thttpd/thttpd.c:1.77.2.2.2.9
--- php4/sapi/thttpd/thttpd.c:1.77.2.2.2.8 Fri May 16 18:33:01 2003
+++ php4/sapi/thttpd/thttpd.c Wed Jun 4 01:31:28 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: thttpd.c,v 1.77.2.2.2.8 2003/05/16 22:33:01 sas Exp $ */
+/* $Id: thttpd.c,v 1.77.2.2.2.9 2003/06/04 05:31:28 sas Exp $ */
#include "php.h"
#include "SAPI.h"
@@ -44,6 +44,7 @@
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_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;
@@ -388,7 +387,7 @@
static void thttpd_module_main(int show_source TSRMLS_DC)
{
- zend_file_handle file_handle;
+ zend_file_handle file_handle = {0};
if (php_request_startup(TSRMLS_C) == FAILURE) {
return;
@@ -436,6 +435,8 @@
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);
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php