1 Index: squid/src/HttpHeader.c
2 diff -c squid/src/HttpHeader.c:1.74.2.4 squid/src/HttpHeader.c:1.74.2.5
3 *** squid/src/HttpHeader.c:1.74.2.4 Mon Jun 24 00:09:59 2002
4 --- squid/src/HttpHeader.c Sun May 11 11:30:12 2003
10 ! #define assert_eid(id) assert((id) >= 0 && (id) < HDR_ENUM_END)
12 static HttpHeaderEntry *httpHeaderEntryCreate(http_hdr_type id, const char *name, const char *value);
13 static void httpHeaderEntryDestroy(HttpHeaderEntry * e);
18 ! #define assert_eid(id) assert((id) < HDR_ENUM_END)
20 static HttpHeaderEntry *httpHeaderEntryCreate(http_hdr_type id, const char *name, const char *value);
21 static void httpHeaderEntryDestroy(HttpHeaderEntry * e);
24 HttpHeaderStats[hdr->owner].busyDestroyedCount += hdr->entries.count > 0;
25 while ((e = httpHeaderGetEntry(hdr, &pos))) {
26 /* tmp hack to try to avoid coredumps */
27 ! if (e->id < 0 || e->id >= HDR_ENUM_END) {
28 debug(55, 0) ("httpHeaderClean BUG: entry[%d] is invalid (%d). Ignored.\n",
32 HttpHeaderStats[hdr->owner].busyDestroyedCount += hdr->entries.count > 0;
33 while ((e = httpHeaderGetEntry(hdr, &pos))) {
34 /* tmp hack to try to avoid coredumps */
35 ! if (e->id >= HDR_ENUM_END) {
36 debug(55, 0) ("httpHeaderClean BUG: entry[%d] is invalid (%d). Ignored.\n",
41 int mlen = strlen(member);
46 header = httpHeaderGetStrOrList(hdr, id);
49 int mlen = strlen(member);
54 header = httpHeaderGetStrOrList(hdr, id);
56 Index: squid/src/client_side.c
57 diff -c squid/src/client_side.c:1.561.2.34 squid/src/client_side.c:1.561.2.35
58 *** squid/src/client_side.c:1.561.2.34 Tue May 6 14:13:02 2003
59 --- squid/src/client_side.c Sun May 11 11:30:12 2003
63 debug(33, 2) ("clientReadBody: start fd=%d body_size=%lu in.offset=%ld cb=%p req=%p\n", conn->fd, (unsigned long int) conn->body.size_left, (long int) conn->in.offset, callback, request);
64 conn->body.callback = callback;
65 conn->body.cbdata = cbdata;
66 + cbdataLock(conn->body.cbdata);
68 conn->body.bufsize = size;
69 conn->body.request = requestLink(request);
73 void *cbdata = conn->body.cbdata;
74 CBCB *callback = conn->body.callback;
75 request_t *request = conn->body.request;
77 /* Note: request is null while eating "aborted" transfers */
78 debug(33, 2) ("clientProcessBody: start fd=%d body_size=%lu in.offset=%ld cb=%p req=%p\n", conn->fd, (unsigned long int) conn->body.size_left, (long int) conn->in.offset, callback, request);
79 if (conn->in.offset) {
82 if (conn->body.size_left <= 0 && request != NULL)
83 request->body_connection = NULL;
84 /* Remove clientReadBody arguments (the call is completed) */
85 conn->body.request = NULL;
86 conn->body.callback = NULL;
87 conn->body.buf = NULL;
88 conn->body.bufsize = 0;
89 /* Remember that we have touched the body, not restartable */
91 request->flags.body_sent = 1;
92 /* Invoke callback function */
93 ! callback(buf, size, cbdata);
95 requestUnlink(request); /* Linked in clientReadBody */
96 debug(33, 2) ("clientProcessBody: end fd=%d size=%d body_size=%lu in.offset=%ld cb=%p req=%p\n", conn->fd, size, (unsigned long int) conn->body.size_left, (long int) conn->in.offset, callback, request);
98 if (conn->body.size_left <= 0 && request != NULL)
99 request->body_connection = NULL;
100 /* Remove clientReadBody arguments (the call is completed) */
101 + valid = cbdataValid(conn->body.cbdata);
102 conn->body.request = NULL;
103 conn->body.callback = NULL;
104 + cbdataUnlock(conn->body.cbdata);
105 + conn->body.cbdata = NULL;
106 conn->body.buf = NULL;
107 conn->body.bufsize = 0;
108 /* Remember that we have touched the body, not restartable */
110 request->flags.body_sent = 1;
111 /* Invoke callback function */
113 ! callback(buf, size, cbdata);
115 requestUnlink(request); /* Linked in clientReadBody */
116 debug(33, 2) ("clientProcessBody: end fd=%d size=%d body_size=%lu in.offset=%ld cb=%p req=%p\n", conn->fd, size, (unsigned long int) conn->body.size_left, (long int) conn->in.offset, callback, request);
119 /* A dummy handler that throws away a request-body */
120 static char bodyAbortBuf[SQUID_TCP_SO_RCVBUF];
122 ! clientReadBodyAbortHandler(char *buf, size_t size, void *data)
124 ConnStateData *conn = (ConnStateData *) data;
125 debug(33, 2) ("clientReadBodyAbortHandler: fd=%d body_size=%lu in.offset=%ld\n", conn->fd, (unsigned long int) conn->body.size_left, (long int) conn->in.offset);
127 /* A dummy handler that throws away a request-body */
128 static char bodyAbortBuf[SQUID_TCP_SO_RCVBUF];
130 ! clientReadBodyAbortHandler(char *buf, ssize_t size, void *data)
132 ConnStateData *conn = (ConnStateData *) data;
133 debug(33, 2) ("clientReadBodyAbortHandler: fd=%d body_size=%lu in.offset=%ld\n", conn->fd, (unsigned long int) conn->body.size_left, (long int) conn->in.offset);
137 conn->body.buf = bodyAbortBuf;
138 conn->body.bufsize = sizeof(bodyAbortBuf);
139 conn->body.cbdata = data;
140 + cbdataLock(conn->body.cbdata);
151 request->body_connection = NULL;
152 if (!conn || conn->body.size_left <= 0)
153 return 0; /* No body to abort */
156 buf = conn->body.buf;
157 callback = conn->body.callback;
158 cbdata = conn->body.cbdata;
159 assert(request == conn->body.request);
160 conn->body.buf = NULL;
161 conn->body.callback = NULL;
162 conn->body.cbdata = NULL;
163 conn->body.request = NULL;
164 ! callback(buf, -1, cbdata); /* Signal abort to clientReadBody caller */
165 requestUnlink(request);
167 clientReadBodyAbortHandler(NULL, -1, conn); /* Install abort handler */
169 buf = conn->body.buf;
170 callback = conn->body.callback;
171 cbdata = conn->body.cbdata;
172 + valid = cbdataValid(cbdata);
173 assert(request == conn->body.request);
174 conn->body.buf = NULL;
175 conn->body.callback = NULL;
176 + cbdataUnlock(conn->body.cbdata);
177 conn->body.cbdata = NULL;
178 conn->body.request = NULL;
180 ! callback(buf, -1, cbdata); /* Signal abort to clientReadBody caller */
181 requestUnlink(request);
183 clientReadBodyAbortHandler(NULL, -1, conn); /* Install abort handler */
184 Index: squid/src/comm_select.c
185 diff -c squid/src/comm_select.c:1.53.2.6 squid/src/comm_select.c:1.53.2.7
186 *** squid/src/comm_select.c:1.53.2.6 Sun May 11 07:42:22 2003
187 --- squid/src/comm_select.c Sun May 11 11:30:13 2003
195 ! unsigned long nfds;
196 ! unsigned long npending;
198 int callicp = 0, callhttp = 0;
205 ! unsigned int maxfd;
207 ! unsigned int npending;
209 int callicp = 0, callhttp = 0;
216 ! debug(5, num ? 5 : 8) ("comm_poll: %d+%ld FDs ready\n", num, npending);
217 statHistCount(&statCounter.select_fds_hist, num);
218 /* Check timeout handlers ONCE each second. */
219 if (squid_curtime > last_timeout) {
220 last_timeout = squid_curtime;
223 ! if (num == 0 && npending == 0)
225 /* scan each socket but the accept socket. Poll this
226 * more frequently to minimize losses due to the 5 connect
231 ! debug(5, num ? 5 : 8) ("comm_poll: %d+%u FDs ready\n", num, npending);
232 statHistCount(&statCounter.select_fds_hist, num);
233 /* Check timeout handlers ONCE each second. */
234 if (squid_curtime > last_timeout) {
235 last_timeout = squid_curtime;
238 ! if (num <= 0 && npending == 0)
240 /* scan each socket but the accept socket. Poll this
241 * more frequently to minimize losses due to the 5 connect
242 Index: squid/src/ftp.c
243 diff -c squid/src/ftp.c:1.316.2.8 squid/src/ftp.c:1.316.2.9
244 *** squid/src/ftp.c:1.316.2.8 Sat Feb 1 06:30:04 2003
245 --- squid/src/ftp.c Sun May 11 11:30:13 2003
249 /* This will be called when there is data available to put */
251 ! ftpRequestBody(char *buf, size_t size, void *data)
253 FtpStateData *ftpState = (FtpStateData *) data;
254 debug(9, 3) ("ftpRequestBody: buf=%p size=%d ftpState=%p\n", buf, (int) size, data);
257 /* This will be called when there is data available to put */
259 ! ftpRequestBody(char *buf, ssize_t size, void *data)
261 FtpStateData *ftpState = (FtpStateData *) data;
262 debug(9, 3) ("ftpRequestBody: buf=%p size=%d ftpState=%p\n", buf, (int) size, data);
265 comm_write(ftpState->data.fd, buf, size, ftpDataWriteCallback, data, NULL);
266 } else if (size < 0) {
268 ! debug(9, 1) ("ftpRequestBody: request aborted");
269 ftpFailed(ftpState, ERR_READ_ERROR);
270 } else if (size == 0) {
271 /* End of transfer */
273 comm_write(ftpState->data.fd, buf, size, ftpDataWriteCallback, data, NULL);
274 } else if (size < 0) {
276 ! debug(9, 1) ("ftpRequestBody: request aborted\n");
277 ftpFailed(ftpState, ERR_READ_ERROR);
278 } else if (size == 0) {
279 /* End of transfer */
280 Index: squid/src/htcp.c
281 diff -c squid/src/htcp.c:1.38.2.2 squid/src/htcp.c:1.38.2.3
282 *** squid/src/htcp.c:1.38.2.2 Thu Jan 2 16:24:58 2003
283 --- squid/src/htcp.c Sun May 11 11:30:13 2003
286 htcpBuildPacket(htcpStuff * stuff, ssize_t * len)
288 size_t buflen = 8192;
291 size_t hdr_sz = sizeof(htcpHeader);
294 htcpBuildPacket(htcpStuff * stuff, ssize_t * len)
296 size_t buflen = 8192;
299 size_t hdr_sz = sizeof(htcpHeader);
301 Index: squid/src/http.c
302 diff -c squid/src/http.c:1.384.2.3 squid/src/http.c:1.384.2.4
303 *** squid/src/http.c:1.384.2.3 Sat Sep 7 16:52:10 2002
304 --- squid/src/http.c Sun May 11 11:30:13 2003
310 ! httpRequestBodyHandler(char *buf, size_t size, void *data)
312 HttpStateData *httpState = (HttpStateData *) data;
318 ! httpRequestBodyHandler(char *buf, ssize_t size, void *data)
320 HttpStateData *httpState = (HttpStateData *) data;
322 Index: squid/src/typedefs.h
323 diff -c squid/src/typedefs.h:1.132.2.1 squid/src/typedefs.h:1.132.2.2
324 *** squid/src/typedefs.h:1.132.2.1 Sun Jun 23 07:53:46 2002
325 --- squid/src/typedefs.h Sun May 11 11:30:13 2003
328 typedef int DEFER(int fd, void *data);
329 typedef int READ_HANDLER(int, char *, int);
330 typedef int WRITE_HANDLER(int, const char *, int);
331 ! typedef void CBCB(char *buf, size_t size, void *data);
333 typedef void STIOCB(void *their_data, int errflag, storeIOState *);
334 typedef void STFNCB(void *their_data, int errflag, storeIOState *);
336 typedef int DEFER(int fd, void *data);
337 typedef int READ_HANDLER(int, char *, int);
338 typedef int WRITE_HANDLER(int, const char *, int);
339 ! typedef void CBCB(char *buf, ssize_t size, void *data);
341 typedef void STIOCB(void *their_data, int errflag, storeIOState *);
342 typedef void STFNCB(void *their_data, int errflag, storeIOState *);