]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Ignore leading whitespace when looking for requests and server replies,
authorwessels <>
Tue, 28 Apr 1998 01:54:01 +0000 (01:54 +0000)
committerwessels <>
Tue, 28 Apr 1998 01:54:01 +0000 (01:54 +0000)
to make HTTP a bit more robust. Don't bail out if we receive a empty
line where a request-line is expected (a SHOULD in rfc2068).

src/client_side.cc
src/http.cc

index 4bbf00a4eb9a29696214a1c466b9e8f1e1a0de95..5f55fa94c40f7747c0ccf1159fa9f04e5e9c8f47 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.293 1998/04/24 23:47:38 wessels Exp $
+ * $Id: client_side.cc,v 1.294 1998/04/27 19:55:10 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -1938,6 +1938,11 @@ clientReadRequest(int fd, void *data)
        size = 0;
     }
     conn->in.offset += size;
+    /* Skip leading (and trailing) whitespace */
+    while (conn->in.offset > 0 && isspace(conn->in.buf[0])) {
+       xmemmove(conn->in.buf, conn->in.buf + 1, conn->in.offset - 1);
+       conn->in.offset--;
+    }
     conn->in.buf[conn->in.offset] = '\0';      /* Terminate the string */
     while (conn->in.offset > 0) {
        int nrequests;
index 7366c5b1280154aa65dde7ac138a5a3379c96901..4f2abee76ef203c48f6aec0f514179ddf4652274 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.266 1998/04/27 19:52:48 wessels Exp $
+ * $Id: http.cc,v 1.267 1998/04/27 19:54:01 wessels Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -458,6 +458,16 @@ httpReadReply(int fd, void *data)
            clen >>= 1;
        IOStats.Http.read_hist[bin]++;
     }
+    if (!httpState->reply_hdr && len > 0) {
+       /* Skip whitespace */
+       while (len > 0 && isspace(*buf))
+           xmemmove(buf, buf + 1, len--);
+       if (len == 0) {
+           /* Continue to read... */
+           commSetSelect(fd, COMM_SELECT_READ, httpReadReply, httpState, 0);
+           return;
+       }
+    }
     if (len < 0) {
        debug(50, 2) ("httpReadReply: FD %d: read failure: %s.\n",
            fd, xstrerror());