Index: squid/src/forward.c diff -c squid/src/forward.c:1.82.2.2 squid/src/forward.c:1.82.2.3 *** squid/src/forward.c:1.82.2.2 Wed Feb 5 17:06:00 2003 --- squid/src/forward.c Mon Mar 17 11:34:19 2003 *************** *** 145,150 **** --- 145,177 ---- return 1; } + static int + fwdCheckRetriable(FwdState * fwdState) + { + /* If there is a request body then Squid can only try once + * even if the method is indempotent + */ + if (fwdState->request->body_connection) + return 0; + + /* RFC2616 9.1 Safe and Idempotent Methods */ + switch (fwdState->request->method) { + /* 9.1.1 Safe Methods */ + case METHOD_GET: + case METHOD_HEAD: + /* 9.1.2 Indepontent Methods */ + case METHOD_PUT: + case METHOD_DELETE: + case METHOD_OPTIONS: + case METHOD_TRACE: + break; + default: + return 0; + } + + return 1; + } + static void fwdServerClosed(int fd, void *data) { *************** *** 329,335 **** { FwdState *fwdState = data; const char *url = storeUrl(fwdState->entry); ! int fd; ErrorState *err; FwdServer *fs = fwdState->servers; const char *host; --- 356,362 ---- { FwdState *fwdState = data; const char *url = storeUrl(fwdState->entry); ! int fd = -1; ErrorState *err; FwdServer *fs = fwdState->servers; const char *host; *************** *** 355,367 **** port = fwdState->request->port; ctimeout = Config.Timeout.connect; } ! if ((fd = pconnPop(host, port))>= 0) { ! debug(17, 3) ("fwdConnectStart: reusing pconn FD %d\n", fd); ! fwdState->server_fd = fd; ! fwdState->n_tries++; ! comm_add_close_handler(fd, fwdServerClosed, fwdState); ! fwdConnectDone(fd, COMM_OK, fwdState); ! return; } #if URL_CHECKSUM_DEBUG assert(fwdState->entry->mem_obj->chksum == url_checksum(url)); --- 382,396 ---- port = fwdState->request->port; ctimeout = Config.Timeout.connect; } ! if (fwdCheckRetriable(fwdState)) { ! if ((fd = pconnPop(host, port))>= 0) { ! debug(17, 3) ("fwdConnectStart: reusing pconn FD %d\n", fd); ! fwdState->server_fd = fd; ! fwdState->n_tries++; ! comm_add_close_handler(fd, fwdServerClosed, fwdState); ! fwdConnectDone(fd, COMM_OK, fwdState); ! return; ! } } #if URL_CHECKSUM_DEBUG assert(fwdState->entry->mem_obj->chksum == url_checksum(url));