Index: squid/src/client_side.c diff -u squid/src/client_side.c:1.1.1.40.2.4 squid/src/client_side.c:1.1.1.40.2.6 --- squid/src/client_side.c:1.1.1.40.2.4 Fri Jun 4 01:06:00 1999 +++ squid/src/client_side.c Sun Jun 20 16:22:07 1999 @@ -839,12 +839,21 @@ static int clientCheckContentLength(request_t * r) { - /* We only require a content-length for "upload" methods */ - if (!pumpMethod(r->method)) + int has_cont_len = (httpHeaderGetInt(&r->header, HDR_CONTENT_LENGTH) >= 0); + switch (r->method) { + case METHOD_PUT: + case METHOD_POST: + /* PUT/POST requires a request entity */ + return has_cont_len; + case METHOD_GET: + case METHOD_HEAD: + /* We do not want to see a request entity on GET/HEAD requests */ + return !has_cont_len; + default: + /* For other types of requests we don't care */ return 1; - if (httpHeaderGetInt(&r->header, HDR_CONTENT_LENGTH) < 0) - return 0; - return 1; + } + /* NOT REACHED */ } static int @@ -1790,7 +1799,7 @@ } /* yes, continue */ http->log_type = LOG_TCP_MISS; - } else if (pumpMethod(r->method)) { + } else if (r->body) { http->log_type = LOG_TCP_MISS; /* XXX oof, POST can be cached! */ pumpInit(fd, r, http->uri); @@ -2136,6 +2145,7 @@ int k; request_t *request = NULL; int size; + int cont_len; method_t method; clientHttpRequest *http = NULL; clientHttpRequest **H = NULL; @@ -2305,22 +2315,18 @@ */ clientSetKeepaliveFlag(http); /* - * break here for NON-GET because most likely there is a - * reqeust body following and we don't want to parse it - * as though it was new request + * break here if the request has a content-length. */ - if (request->method != METHOD_GET) { - int cont_len = httpHeaderGetInt(&request->header, HDR_CONTENT_LENGTH); + cont_len = httpHeaderGetInt(&request->header, HDR_CONTENT_LENGTH); + if (cont_len >= 0) { int copy_len = XMIN(conn->in.offset, cont_len); - if (copy_len > 0) { - assert(conn->in.offset >= copy_len); - request->body_sz = copy_len; - request->body = xmalloc(request->body_sz); - xmemcpy(request->body, conn->in.buf, request->body_sz); - conn->in.offset -= copy_len; - if (conn->in.offset) - xmemmove(conn->in.buf, conn->in.buf + copy_len, conn->in.offset); - } + assert(conn->in.offset >= copy_len); + request->body_sz = copy_len; + request->body = xmalloc(request->body_sz); + xmemcpy(request->body, conn->in.buf, request->body_sz); + conn->in.offset -= copy_len; + if (conn->in.offset) + xmemmove(conn->in.buf, conn->in.buf + copy_len, conn->in.offset); /* * if we didn't get the full body now, then more will * be arriving on the client socket. Lets cancel Index: squid/src/forward.c diff -u squid/src/forward.c:1.1.1.12.2.5 squid/src/forward.c:1.1.1.12.2.6 --- squid/src/forward.c:1.1.1.12.2.5 Sun Jun 6 02:27:54 1999 +++ squid/src/forward.c Sun Jun 20 16:20:58 1999 @@ -101,7 +101,7 @@ return 0; if (fwdState->flags.dont_retry) return 0; - if (pumpMethod(fwdState->request->method)) + if (fwdState->request->body) if (0 == pumpRestart(fwdState->request)) return 0; return 1; @@ -364,7 +364,7 @@ } if (fwdState->n_tries > 9) return 0; - if (pumpMethod(fwdState->request->method)) + if (fwdState->request->body) if (0 == pumpRestart(fwdState->request)) return 0; assert(fs); Index: squid/src/http.c diff -u squid/src/http.c:1.1.1.33.2.2 squid/src/http.c:1.1.1.33.2.3 --- squid/src/http.c:1.1.1.33.2.2 Thu May 20 01:06:22 1999 +++ squid/src/http.c Sun Jun 20 16:20:58 1999 @@ -833,7 +833,7 @@ debug(11, 5) ("httpSendRequest: FD %d: httpState %p.\n", httpState->fd, httpState); - if (pumpMethod(req->method)) + if (req->body) sendHeaderDone = httpSendRequestEntry; else sendHeaderDone = httpSendComplete; Index: squid/src/pump.c diff -u squid/src/pump.c:1.1.1.14 squid/src/pump.c:1.1.1.14.10.1 --- squid/src/pump.c:1.1.1.14 Mon Apr 12 23:11:08 1999 +++ squid/src/pump.c Sun Jun 20 16:20:58 1999 @@ -408,25 +408,6 @@ } /* - * This function returns true for the request methods handled - * by this module - */ -int -pumpMethod(method_t method) -{ - switch (method) { - case METHOD_POST: - case METHOD_PUT: - return 1; - break; - default: - return 0; - break; - } - /* NOTREACHED */ -} - -/* * This function returns True if we can submit this request again. * The request may have been pipelined, but the connection got * closed before we got a reply. If we still have the whole