httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@covalent.net
Subject Re: cvs commit: apache-2.0/src/main http_core.c
Date Tue, 10 Oct 2000 05:20:16 GMT

Rather than continue to argue over the correctness of the patch, I will
point out that as the code stands right now, the server does not work from
BeOS or if the request comes from Win 95/98 telnet.  The code that was
removed was not perfect, but it was much better than things stand now,
because it worked.

The following patch has not been tested at all, but it makes sense
logically.  Basically, instead of just checking for LF, we also make sure
that we haven't overrun the buffer, and that the socket hasn't been
closed.

If nobody objects, I'll commit first thing tomorrow.  Right now, I'm going
to bed.

Index: main/http_core.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/main/http_core.c,v
retrieving revision 1.160
diff -u -d -b -w -u -r1.160 http_core.c
--- main/http_core.c	2000/10/10 03:35:11	1.160
+++ main/http_core.c	2000/10/10 05:16:55
@@ -3305,8 +3305,9 @@
 
 static int core_input_filter(ap_filter_t *f, ap_bucket_brigade *b)
 {
+#define ASCII_LF '\012'
     char *buff;
-    apr_ssize_t length = HUGE_STRING_LEN;
+    apr_ssize_t length = HUGE_STRING_LEN, templen = 0;
     apr_socket_t *csock = NULL;
     apr_status_t rv;
     ap_bucket *e;
@@ -3318,11 +3319,21 @@
     rv = apr_recv(csock, buff, &length);
     if (rv == APR_SUCCESS) {
         if (length > 0) {
+            templen = length - 1;
+            while (buff[templen] != ASCII_LF && templen < HUGE_STRING_LEN) {
+                length = HUGE_STRING_LEN - templen;
+                rv = apr_recv(csock, buff + templen + 1, &length);
+                templen += length;
+                if (APR_STATUS_IS_EOF(rv)) {
+                    break;
+                }
+            }
+
             /* This should probably be a pool bucket, but using a transient is 
-             * actually okay here too.  We know the pool we are using will always 
-             * be available as long as the connection is open.
+             * actually okay here too.  We know the pool we are using will 
+             * always be available as long as the connection is open.
              */
-            e = ap_bucket_create_transient(buff, length);
+            e = ap_bucket_create_transient(buff, templen + 1);
             AP_BRIGADE_INSERT_TAIL(b, e);
         }
         else {


Ryan


_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Mime
View raw message