From: wessels <> Date: Sat, 14 Dec 1996 05:10:30 +0000 (+0000) Subject: - Fixed httpBuildRequestHeader() content length bug which breaks for X-Git-Tag: SQUID_3_0_PRE1~5300 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66f7337b1066aced4977551f23b686e32e1419fa;p=thirdparty%2Fsquid.git - Fixed httpBuildRequestHeader() content length bug which breaks for really large POST requests (Takahiro Yugawa). --- diff --git a/src/http.cc b/src/http.cc index 571feff186..7711cc8587 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,5 +1,5 @@ /* - * $Id: http.cc,v 1.135 1996/12/13 20:33:41 wessels Exp $ + * $Id: http.cc,v 1.136 1996/12/13 22:10:30 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -658,7 +658,6 @@ httpBuildRequestHeader(request_t * request, size_t len = 0; size_t hdr_len = 0; size_t in_sz; - size_t content_length = 0; size_t l; int hdr_flags = 0; const char *url = NULL; @@ -680,8 +679,6 @@ httpBuildRequestHeader(request_t * request, in_sz = strlen(hdr_in); for (t = hdr_in; t < end; t += strcspn(t, crlf), t += strspn(t, crlf)) { hdr_len = t - hdr_in; - if (in_sz - hdr_len <= content_length) - break; l = strcspn(t, crlf) + 1; if (l > 4096) l = 4096; @@ -691,34 +688,28 @@ httpBuildRequestHeader(request_t * request, continue; if (strncasecmp(xbuf, "Connection:", 11) == 0) continue; - if (strncasecmp(xbuf, "Host:", 5) == 0) + if (strncasecmp(xbuf, "Host:", 5) == 0) { EBIT_SET(hdr_flags, HDR_HOST); - if (strncasecmp(xbuf, "Content-length:", 15) == 0) { - for (s = xbuf + 15; *s && isspace(*s); s++); - content_length = (size_t) atoi(s); - } - if (strncasecmp(xbuf, "Cache-Control:", 14) == 0) { + } else if (strncasecmp(xbuf, "Cache-Control:", 14) == 0) { for (s = xbuf + 14; *s && isspace(*s); s++); if (strncasecmp(s, "Max-age=", 8) == 0) EBIT_SET(hdr_flags, HDR_MAXAGE); - } - if (strncasecmp(xbuf, "Via:", 4) == 0) { + } else if (strncasecmp(xbuf, "Via:", 4) == 0) { for (s = xbuf + 4; *s && isspace(*s); s++); if (strlen(viabuf) + strlen(s) < 4000) strcat(viabuf, s); strcat(viabuf, ", "); continue; - } - if (strncasecmp(xbuf, "X-Forwarded-For:", 16) == 0) { + } else if (strncasecmp(xbuf, "X-Forwarded-For:", 16) == 0) { for (s = xbuf + 16; *s && isspace(*s); s++); if (strlen(fwdbuf) + strlen(s) < 4000) strcat(fwdbuf, s); strcat(fwdbuf, ", "); continue; - } - if (strncasecmp(xbuf, "If-Modified-Since:", 18) == 0) + } else if (strncasecmp(xbuf, "If-Modified-Since:", 18) == 0) { if (EBIT_TEST(hdr_flags, HDR_IMS)) continue; + } httpAppendRequestHeader(hdr_out, xbuf, &len, out_sz - 512); } hdr_len = t - hdr_in;