httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Ames <grega...@raleigh.ibm.com>
Subject [PATCH] http_protocol.c getline() - some progress for netcat
Date Wed, 04 Oct 2000 23:07:49 GMT
OK, this is as far as I've gotten with the bug OtherBill reported that I see
when using netcat.  This at least returns a non-null request line.  The
problem is that the CR preceding the LF is optional.  But it's still broken
because the length ends up wrong for the next line (at least if it's empty)
and you get a 400 error.  Works OK with Netscape and IE5 though.

Greg

Index: main/http_protocol.c
===================================================================
RCS file: /cvs/apache/apache-2.0/src/main/http_protocol.c,v
retrieving revision 1.135
diff -u -d -b -w -r1.135 http_protocol.c
--- http_protocol.c     2000/10/03 22:08:38     1.135
+++ http_protocol.c     2000/10/04 22:42:01
@@ -940,12 +940,14 @@
             break;
         }

-        if ((toss = ap_strchr_c(temp, '\r')) != NULL) {
-            length = toss - temp + 2;
+        if ((toss = ap_strchr_c(temp, '\n')) != NULL) {
+            length = toss - temp + 1;
             e->split(e, length);
             apr_cpystrn(pos, temp, length);
+            if (pos[length - 2] == '\r') {
             pos[length - 2] = '\n';
             pos[--length] = '\0';
+            }
             AP_BUCKET_REMOVE(e);
             e->destroy(e);
         }


Mime
View raw message