]>
Commit | Line | Data |
---|---|---|
f05a5b68 MW |
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 | |
5 | *************** | |
6 | *** 229,235 **** | |
7 | * local routines | |
8 | */ | |
9 | ||
10 | ! #define assert_eid(id) assert((id) >= 0 && (id) < HDR_ENUM_END) | |
11 | ||
12 | static HttpHeaderEntry *httpHeaderEntryCreate(http_hdr_type id, const char *name, const char *value); | |
13 | static void httpHeaderEntryDestroy(HttpHeaderEntry * e); | |
14 | --- 229,235 ---- | |
15 | * local routines | |
16 | */ | |
17 | ||
18 | ! #define assert_eid(id) assert((id) < HDR_ENUM_END) | |
19 | ||
20 | static HttpHeaderEntry *httpHeaderEntryCreate(http_hdr_type id, const char *name, const char *value); | |
21 | static void httpHeaderEntryDestroy(HttpHeaderEntry * e); | |
22 | *************** | |
23 | *** 330,336 **** | |
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", | |
29 | (int) pos, e->id); | |
30 | } else { | |
31 | --- 330,336 ---- | |
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", | |
37 | (int) pos, e->id); | |
38 | } else { | |
39 | *************** | |
40 | *** 705,711 **** | |
41 | int mlen = strlen(member); | |
42 | ||
43 | assert(hdr); | |
44 | ! assert(id >= 0); | |
45 | ||
46 | header = httpHeaderGetStrOrList(hdr, id); | |
47 | ||
48 | --- 705,711 ---- | |
49 | int mlen = strlen(member); | |
50 | ||
51 | assert(hdr); | |
52 | ! assert_eid(id); | |
53 | ||
54 | header = httpHeaderGetStrOrList(hdr, id); | |
55 | ||
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 | |
60 | *************** | |
61 | *** 3126,3131 **** | |
62 | --- 3126,3132 ---- | |
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); | |
67 | conn->body.buf = buf; | |
68 | conn->body.bufsize = size; | |
69 | conn->body.request = requestLink(request); | |
70 | *************** | |
71 | *** 3141,3146 **** | |
72 | --- 3142,3148 ---- | |
73 | void *cbdata = conn->body.cbdata; | |
74 | CBCB *callback = conn->body.callback; | |
75 | request_t *request = conn->body.request; | |
76 | + int valid; | |
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) { | |
80 | *************** | |
81 | *** 3166,3180 **** | |
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 */ | |
90 | if (request != NULL) | |
91 | request->flags.body_sent = 1; | |
92 | /* Invoke callback function */ | |
93 | ! callback(buf, size, cbdata); | |
94 | if (request != NULL) | |
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); | |
97 | --- 3168,3186 ---- | |
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 */ | |
109 | if (request != NULL) | |
110 | request->flags.body_sent = 1; | |
111 | /* Invoke callback function */ | |
112 | ! if (valid) | |
113 | ! callback(buf, size, cbdata); | |
114 | if (request != NULL) | |
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); | |
117 | *************** | |
118 | *** 3184,3190 **** | |
119 | /* A dummy handler that throws away a request-body */ | |
120 | static char bodyAbortBuf[SQUID_TCP_SO_RCVBUF]; | |
121 | static void | |
122 | ! clientReadBodyAbortHandler(char *buf, size_t size, void *data) | |
123 | { | |
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); | |
126 | --- 3190,3196 ---- | |
127 | /* A dummy handler that throws away a request-body */ | |
128 | static char bodyAbortBuf[SQUID_TCP_SO_RCVBUF]; | |
129 | static void | |
130 | ! clientReadBodyAbortHandler(char *buf, ssize_t size, void *data) | |
131 | { | |
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); | |
134 | *************** | |
135 | *** 3194,3199 **** | |
136 | --- 3200,3206 ---- | |
137 | conn->body.buf = bodyAbortBuf; | |
138 | conn->body.bufsize = sizeof(bodyAbortBuf); | |
139 | conn->body.cbdata = data; | |
140 | + cbdataLock(conn->body.cbdata); | |
141 | } | |
142 | } | |
143 | ||
144 | *************** | |
145 | *** 3205,3210 **** | |
146 | --- 3212,3218 ---- | |
147 | char *buf; | |
148 | CBCB *callback; | |
149 | void *cbdata; | |
150 | + int valid; | |
151 | request->body_connection = NULL; | |
152 | if (!conn || conn->body.size_left <= 0) | |
153 | return 0; /* No body to abort */ | |
154 | *************** | |
155 | *** 3212,3223 **** | |
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); | |
166 | } | |
167 | clientReadBodyAbortHandler(NULL, -1, conn); /* Install abort handler */ | |
168 | --- 3220,3234 ---- | |
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; | |
179 | ! if (valid) | |
180 | ! callback(buf, -1, cbdata); /* Signal abort to clientReadBody caller */ | |
181 | requestUnlink(request); | |
182 | } | |
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 | |
188 | *************** | |
189 | *** 314,323 **** | |
190 | #endif | |
191 | PF *hdl = NULL; | |
192 | int fd; | |
193 | ! int i; | |
194 | ! int maxfd; | |
195 | ! unsigned long nfds; | |
196 | ! unsigned long npending; | |
197 | int num; | |
198 | int callicp = 0, callhttp = 0; | |
199 | int calldns = 0; | |
200 | --- 314,323 ---- | |
201 | #endif | |
202 | PF *hdl = NULL; | |
203 | int fd; | |
204 | ! unsigned int i; | |
205 | ! unsigned int maxfd; | |
206 | ! unsigned int nfds; | |
207 | ! unsigned int npending; | |
208 | int num; | |
209 | int callicp = 0, callhttp = 0; | |
210 | int calldns = 0; | |
211 | *************** | |
212 | *** 397,410 **** | |
213 | return COMM_ERROR; | |
214 | /* NOTREACHED */ | |
215 | } | |
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; | |
221 | checkTimeouts(); | |
222 | } | |
223 | ! if (num == 0 && npending == 0) | |
224 | continue; | |
225 | /* scan each socket but the accept socket. Poll this | |
226 | * more frequently to minimize losses due to the 5 connect | |
227 | --- 397,410 ---- | |
228 | return COMM_ERROR; | |
229 | /* NOTREACHED */ | |
230 | } | |
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; | |
236 | checkTimeouts(); | |
237 | } | |
238 | ! if (num <= 0 && npending == 0) | |
239 | continue; | |
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 | |
246 | *************** | |
247 | *** 2239,2245 **** | |
248 | ||
249 | /* This will be called when there is data available to put */ | |
250 | static void | |
251 | ! ftpRequestBody(char *buf, size_t size, void *data) | |
252 | { | |
253 | FtpStateData *ftpState = (FtpStateData *) data; | |
254 | debug(9, 3) ("ftpRequestBody: buf=%p size=%d ftpState=%p\n", buf, (int) size, data); | |
255 | --- 2239,2245 ---- | |
256 | ||
257 | /* This will be called when there is data available to put */ | |
258 | static void | |
259 | ! ftpRequestBody(char *buf, ssize_t size, void *data) | |
260 | { | |
261 | FtpStateData *ftpState = (FtpStateData *) data; | |
262 | debug(9, 3) ("ftpRequestBody: buf=%p size=%d ftpState=%p\n", buf, (int) size, data); | |
263 | *************** | |
264 | *** 2249,2255 **** | |
265 | comm_write(ftpState->data.fd, buf, size, ftpDataWriteCallback, data, NULL); | |
266 | } else if (size < 0) { | |
267 | /* Error */ | |
268 | ! debug(9, 1) ("ftpRequestBody: request aborted"); | |
269 | ftpFailed(ftpState, ERR_READ_ERROR); | |
270 | } else if (size == 0) { | |
271 | /* End of transfer */ | |
272 | --- 2249,2255 ---- | |
273 | comm_write(ftpState->data.fd, buf, size, ftpDataWriteCallback, data, NULL); | |
274 | } else if (size < 0) { | |
275 | /* Error */ | |
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 | |
284 | *************** | |
285 | *** 362,368 **** | |
286 | htcpBuildPacket(htcpStuff * stuff, ssize_t * len) | |
287 | { | |
288 | size_t buflen = 8192; | |
289 | ! size_t s; | |
290 | ssize_t off = 0; | |
291 | size_t hdr_sz = sizeof(htcpHeader); | |
292 | htcpHeader hdr; | |
293 | --- 362,368 ---- | |
294 | htcpBuildPacket(htcpStuff * stuff, ssize_t * len) | |
295 | { | |
296 | size_t buflen = 8192; | |
297 | ! ssize_t s; | |
298 | ssize_t off = 0; | |
299 | size_t hdr_sz = sizeof(htcpHeader); | |
300 | htcpHeader hdr; | |
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 | |
305 | *************** | |
306 | *** 1079,1085 **** | |
307 | } | |
308 | ||
309 | static void | |
310 | ! httpRequestBodyHandler(char *buf, size_t size, void *data) | |
311 | { | |
312 | HttpStateData *httpState = (HttpStateData *) data; | |
313 | if (size > 0) { | |
314 | --- 1079,1085 ---- | |
315 | } | |
316 | ||
317 | static void | |
318 | ! httpRequestBodyHandler(char *buf, ssize_t size, void *data) | |
319 | { | |
320 | HttpStateData *httpState = (HttpStateData *) data; | |
321 | if (size > 0) { | |
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 | |
326 | *************** | |
327 | *** 234,240 **** | |
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); | |
332 | ||
333 | typedef void STIOCB(void *their_data, int errflag, storeIOState *); | |
334 | typedef void STFNCB(void *their_data, int errflag, storeIOState *); | |
335 | --- 234,240 ---- | |
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); | |
340 | ||
341 | typedef void STIOCB(void *their_data, int errflag, storeIOState *); | |
342 | typedef void STFNCB(void *their_data, int errflag, storeIOState *); |