Index: squid/src/http.c diff -c squid/src/http.c:1.384.2.13 squid/src/http.c:1.384.2.14 *** squid/src/http.c:1.384.2.13 Fri Mar 19 01:56:55 2004 --- squid/src/http.c Sun Apr 18 17:43:30 2004 *************** *** 715,724 **** if (errflag == COMM_ERR_CLOSING) return; if (errflag) { ! err = errorCon(ERR_WRITE_ERROR, HTTP_INTERNAL_SERVER_ERROR); ! err->xerrno = errno; ! err->request = requestLink(httpState->orig_request); ! errorAppendEntry(entry, err); comm_close(fd); return; } else { --- 715,726 ---- if (errflag == COMM_ERR_CLOSING) return; if (errflag) { ! if (entry->mem_obj->inmem_hi == 0) { ! err = errorCon(ERR_WRITE_ERROR, HTTP_INTERNAL_SERVER_ERROR); ! err->xerrno = errno; ! err->request = requestLink(httpState->orig_request); ! errorAppendEntry(entry, err); ! } comm_close(fd); return; } else { *************** *** 1110,1115 **** --- 1112,1126 ---- } static void + httpRequestBodyHandler2(void *data) + { + HttpStateData *httpState = (HttpStateData *) data; + char *buf = httpState->body_buf; + httpState->body_buf = NULL; + comm_write(httpState->fd, buf, httpState->body_buf_sz, httpSendRequestEntry, data, memFree8K); + } + + static void httpRequestBodyHandler(char *buf, ssize_t size, void *data) { HttpStateData *httpState = (HttpStateData *) data; *************** *** 1125,1130 **** --- 1136,1147 ---- comm_close(httpState->fd); return; } + httpState->body_buf = buf; + httpState->body_buf_sz = size; + /* Give response some time to propagate before sending rest + * of request in case of error */ + eventAdd("POST delay on response", httpRequestBodyHandler2, httpState, 2.0, 1); + return; } comm_write(httpState->fd, buf, size, httpSendRequestEntry, data, memFree8K); } else if (size == 0) { *************** *** 1154,1163 **** if (errflag == COMM_ERR_CLOSING) return; if (errflag) { ! err = errorCon(ERR_WRITE_ERROR, HTTP_INTERNAL_SERVER_ERROR); ! err->xerrno = errno; ! err->request = requestLink(httpState->orig_request); ! errorAppendEntry(entry, err); comm_close(fd); return; } --- 1171,1182 ---- if (errflag == COMM_ERR_CLOSING) return; if (errflag) { ! if (entry->mem_obj->inmem_hi == 0) { ! err = errorCon(ERR_WRITE_ERROR, HTTP_INTERNAL_SERVER_ERROR); ! err->xerrno = errno; ! err->request = requestLink(httpState->orig_request); ! errorAppendEntry(entry, err); ! } comm_close(fd); return; } Index: squid/src/structs.h diff -c squid/src/structs.h:1.408.2.23 squid/src/structs.h:1.408.2.24 *** squid/src/structs.h:1.408.2.23 Wed Feb 4 10:42:28 2004 --- squid/src/structs.h Sun Apr 18 17:43:30 2004 *************** *** 986,991 **** --- 986,992 ---- http_state_flags flags; FwdState *fwd; char *body_buf; + int body_buf_sz; }; struct _icpUdpData {