]> git.pld-linux.org Git - packages/squid.git/blame - squid-3.0.PRE3-httpversion.patch
- fixes CAN-2005-0097
[packages/squid.git] / squid-3.0.PRE3-httpversion.patch
CommitLineData
36aa8c36
JR
1Index: squid3/src/HttpHeader.h
2diff -c squid3/src/HttpHeader.h:1.6 squid3/src/HttpHeader.h:1.7
3*** squid3/src/HttpHeader.h:1.6 Tue Jul 15 00:50:39 2003
4--- squid3/src/HttpHeader.h Sun Aug 31 21:49:37 2003
5***************
6*** 46,57 ****
7--- 46,60 ----
8 field_type type;
9 };
10
11+ class HttpVersion;
12+
13 extern int httpHeaderParseQuotedString (const char *start, String *val);
14 extern void httpHeaderPutSc(HttpHeader *hdr, const HttpHdrSc *sc);
15 extern HttpHdrSc *httpHeaderGetSc(const HttpHeader *hdr);
16 SQUIDCEXTERN void httpHeaderAddContRange(HttpHeader *, HttpHdrRangeSpec, ssize_t);
17 extern int httpHeaderHasListMember(const HttpHeader * hdr, http_hdr_type id, const char *member, const char separator);
18 SQUIDCEXTERN void httpHeaderUpdate(HttpHeader * old, const HttpHeader * fresh, const HttpHeaderMask * denied_mask);
19+ int httpMsgIsPersistent(HttpVersion const &http_ver, const HttpHeader * hdr);
20
21 class HttpHeader
22 {
23Index: squid3/src/HttpMsg.cc
24diff -c squid3/src/HttpMsg.cc:1.12 squid3/src/HttpMsg.cc:1.13
25*** squid3/src/HttpMsg.cc:1.12 Fri Feb 21 15:50:05 2003
26--- squid3/src/HttpMsg.cc Sun Aug 31 21:49:37 2003
27***************
28*** 34,40 ****
29 */
30
31 #include "squid.h"
32!
33
34 /* find end of headers */
35 int
36--- 34,40 ----
37 */
38
39 #include "squid.h"
40! #include "HttpVersion.h"
41
42 /* find end of headers */
43 int
44***************
45*** 99,105 ****
46 /* returns true if connection should be "persistent"
47 * after processing this message */
48 int
49! httpMsgIsPersistent(http_version_t http_ver, const HttpHeader * hdr)
50 {
51 if ((http_ver.major >= 1) && (http_ver.minor >= 1)) {
52 /*
53--- 99,105 ----
54 /* returns true if connection should be "persistent"
55 * after processing this message */
56 int
57! httpMsgIsPersistent(HttpVersion const &http_ver, const HttpHeader * hdr)
58 {
59 if ((http_ver.major >= 1) && (http_ver.minor >= 1)) {
60 /*
61Index: squid3/src/HttpReply.cc
62diff -c squid3/src/HttpReply.cc:1.62 squid3/src/HttpReply.cc:1.63
63*** squid3/src/HttpReply.cc:1.62 Tue Jul 15 00:50:39 2003
64--- squid3/src/HttpReply.cc Sun Aug 31 21:49:37 2003
65***************
66*** 207,213 ****
67 }
68
69 MemBuf
70! httpPackedReply(http_version_t ver, http_status status, const char *ctype,
71 int clen, time_t lmt, time_t expires)
72 {
73 HttpReply *rep = httpReplyCreate();
74--- 207,213 ----
75 }
76
77 MemBuf
78! httpPackedReply(HttpVersion ver, http_status status, const char *ctype,
79 int clen, time_t lmt, time_t expires)
80 {
81 HttpReply *rep = httpReplyCreate();
82***************
83*** 226,232 ****
84 HttpReply *rv;
85 int t;
86 HttpHeaderEntry *e;
87- http_version_t ver;
88 assert(rep);
89
90 rv = httpReplyCreate ();
91--- 226,231 ----
92***************
93*** 238,244 ****
94 /* rv->cache_control */
95 /* rv->content_range */
96 /* rv->keep_alive */
97! httpBuildVersion(&ver, 1, 0);
98 httpStatusLineSet(&rv->sline, ver,
99 HTTP_NOT_MODIFIED, "");
100
101--- 237,243 ----
102 /* rv->cache_control */
103 /* rv->content_range */
104 /* rv->keep_alive */
105! HttpVersion ver(1,0);
106 httpStatusLineSet(&rv->sline, ver,
107 HTTP_NOT_MODIFIED, "");
108
109***************
110*** 266,272 ****
111 }
112
113 void
114! httpReplySetHeaders(HttpReply * reply, http_version_t ver, http_status status, const char *reason,
115 const char *ctype, int clen, time_t lmt, time_t expires)
116 {
117 HttpHeader *hdr;
118--- 265,271 ----
119 }
120
121 void
122! httpReplySetHeaders(HttpReply * reply, HttpVersion ver, http_status status, const char *reason,
123 const char *ctype, int clen, time_t lmt, time_t expires)
124 {
125 HttpHeader *hdr;
126***************
127*** 305,313 ****
128 httpRedirectReply(HttpReply * reply, http_status status, const char *loc)
129 {
130 HttpHeader *hdr;
131- http_version_t ver;
132 assert(reply);
133! httpBuildVersion(&ver, 1, 0);
134 httpStatusLineSet(&reply->sline, ver, status, httpStatusString(status));
135 hdr = &reply->header;
136 httpHeaderPutStr(hdr, HDR_SERVER, full_appname_string);
137--- 304,311 ----
138 httpRedirectReply(HttpReply * reply, http_status status, const char *loc)
139 {
140 HttpHeader *hdr;
141 assert(reply);
142! HttpVersion ver(1,0);
143 httpStatusLineSet(&reply->sline, ver, status, httpStatusString(status));
144 hdr = &reply->header;
145 httpHeaderPutStr(hdr, HDR_SERVER, full_appname_string);
146Index: squid3/src/HttpReply.h
147diff -c squid3/src/HttpReply.h:1.5 squid3/src/HttpReply.h:1.6
148*** squid3/src/HttpReply.h:1.5 Tue Jul 15 00:50:39 2003
149--- squid3/src/HttpReply.h Sun Aug 31 21:49:37 2003
150***************
151*** 36,41 ****
152--- 36,42 ----
153
154 #include "typedefs.h"
155 #include "HttpHeader.h"
156+ #include "HttpStatusLine.h"
157
158 /* Http Reply */
159 extern void httpReplyInitModule(void);
160***************
161*** 56,65 ****
162 /* swap: create swap-based packer, pack, destroy packer */
163 extern void httpReplySwapOut(HttpReply * rep, StoreEntry * e);
164 /* set commonly used info with one call */
165! extern void httpReplySetHeaders(HttpReply * rep, http_version_t ver, http_status status,
166 const char *reason, const char *ctype, int clen, time_t lmt, time_t expires);
167 /* do everything in one call: init, set, pack, clean, return MemBuf */
168! extern MemBuf httpPackedReply(http_version_t ver, http_status status, const char *ctype,
169 int clen, time_t lmt, time_t expires);
170 /* construct 304 reply and pack it into MemBuf, return MemBuf */
171 extern MemBuf httpPacked304Reply(const HttpReply * rep);
172--- 57,66 ----
173 /* swap: create swap-based packer, pack, destroy packer */
174 extern void httpReplySwapOut(HttpReply * rep, StoreEntry * e);
175 /* set commonly used info with one call */
176! extern void httpReplySetHeaders(HttpReply * rep, HttpVersion ver, http_status status,
177 const char *reason, const char *ctype, int clen, time_t lmt, time_t expires);
178 /* do everything in one call: init, set, pack, clean, return MemBuf */
179! extern MemBuf httpPackedReply(HttpVersion ver, http_status status, const char *ctype,
180 int clen, time_t lmt, time_t expires);
181 /* construct 304 reply and pack it into MemBuf, return MemBuf */
182 extern MemBuf httpPacked304Reply(const HttpReply * rep);
183Index: squid3/src/HttpRequest.cc
184diff -c squid3/src/HttpRequest.cc:1.44 squid3/src/HttpRequest.cc:1.45
185*** squid3/src/HttpRequest.cc:1.44 Thu Aug 14 06:15:04 2003
186--- squid3/src/HttpRequest.cc Sun Aug 31 21:49:37 2003
187***************
188*** 76,82 ****
189 request_flags flags;
190 HttpHdrCc *cache_control;
191 HttpHdrRange *range;
192! http_version_t http_ver;
193 time_t ims;
194 int imslen;
195 int max_forwards;
196--- 76,82 ----
197 request_flags flags;
198 HttpHdrCc *cache_control;
199 HttpHdrRange *range;
200! HttpVersion http_ver;
201 time_t ims;
202 int imslen;
203 int max_forwards;
204Index: squid3/src/HttpRequest.h
205diff -c squid3/src/HttpRequest.h:1.7 squid3/src/HttpRequest.h:1.8
206*** squid3/src/HttpRequest.h:1.7 Sun Aug 10 05:00:40 2003
207--- squid3/src/HttpRequest.h Sun Aug 31 21:49:37 2003
208***************
209*** 37,42 ****
210--- 37,43 ----
211 #include "typedefs.h"
212 #include "HttpHeader.h"
213 #include "client_side.h"
214+ #include "HttpVersion.h"
215
216 /* Http Request */
217 extern HttpRequest *requestCreate(method_t, protocol_t, const char *urlpath);
218***************
219*** 75,81 ****
220 request_flags flags;
221 HttpHdrCc *cache_control;
222 HttpHdrRange *range;
223! http_version_t http_ver;
224 time_t ims;
225 int imslen;
226 int max_forwards;
227--- 76,82 ----
228 request_flags flags;
229 HttpHdrCc *cache_control;
230 HttpHdrRange *range;
231! HttpVersion http_ver;
232 time_t ims;
233 int imslen;
234 int max_forwards;
235Index: squid3/src/HttpStatusLine.cc
236diff -c squid3/src/HttpStatusLine.cc:1.27 squid3/src/HttpStatusLine.cc:1.28
237*** squid3/src/HttpStatusLine.cc:1.27 Fri Feb 21 15:50:05 2003
238--- squid3/src/HttpStatusLine.cc Sun Aug 31 21:49:37 2003
239***************
240*** 34,40 ****
241 */
242
243 #include "squid.h"
244!
245
246 /* local constants */
247 const char *HttpStatusLineFormat = "HTTP/%d.%d %3d %s\r\n";
248--- 34,40 ----
249 */
250
251 #include "squid.h"
252! #include "HttpStatusLine.h"
253
254 /* local constants */
255 const char *HttpStatusLineFormat = "HTTP/%d.%d %3d %s\r\n";
256***************
257*** 42,63 ****
258 void
259 httpStatusLineInit(HttpStatusLine * sline)
260 {
261! http_version_t version;
262! httpBuildVersion(&version, 0, 0);
263 httpStatusLineSet(sline, version, HTTP_STATUS_NONE, NULL);
264 }
265
266 void
267 httpStatusLineClean(HttpStatusLine * sline)
268 {
269! http_version_t version;
270! httpBuildVersion(&version, 0, 0);
271 httpStatusLineSet(sline, version, HTTP_INTERNAL_SERVER_ERROR, NULL);
272 }
273
274 /* set values */
275 void
276! httpStatusLineSet(HttpStatusLine * sline, http_version_t version, http_status status, const char *reason)
277 {
278 assert(sline);
279 sline->version = version;
280--- 42,61 ----
281 void
282 httpStatusLineInit(HttpStatusLine * sline)
283 {
284! HttpVersion version;
285 httpStatusLineSet(sline, version, HTTP_STATUS_NONE, NULL);
286 }
287
288 void
289 httpStatusLineClean(HttpStatusLine * sline)
290 {
291! HttpVersion version;
292 httpStatusLineSet(sline, version, HTTP_INTERNAL_SERVER_ERROR, NULL);
293 }
294
295 /* set values */
296 void
297! httpStatusLineSet(HttpStatusLine * sline, HttpVersion version, http_status status, const char *reason)
298 {
299 assert(sline);
300 sline->version = version;
301Index: squid3/src/access_log.cc
302diff -c squid3/src/access_log.cc:1.94 squid3/src/access_log.cc:1.95
303*** squid3/src/access_log.cc:1.94 Wed Aug 20 07:34:41 2003
304--- squid3/src/access_log.cc Sun Aug 31 21:49:37 2003
305***************
306*** 35,40 ****
307--- 35,41 ----
308
309
310 #include "squid.h"
311+ #include "AccessLogEntry.h"
312
313 // Store.h Required by configuration directives parsing/dumping only
314 #include "Store.h"
315Index: squid3/src/cache_cf.cc
316diff -c squid3/src/cache_cf.cc:1.449 squid3/src/cache_cf.cc:1.450
317*** squid3/src/cache_cf.cc:1.449 Sun Aug 31 15:20:08 2003
318--- squid3/src/cache_cf.cc Sun Aug 31 21:49:37 2003
319***************
320*** 2987,2992 ****
321--- 2987,2994 ----
322 }
323 }
324
325+ #include "AccessLogEntry.h"
326+ /* TODO: split out parsing somehow ...*/
327 static void
328 parse_logformat(logformat ** logformat_definitions)
329 {
330Index: squid3/src/Makefile.am
331diff -c squid3/src/Makefile.am:1.89 squid3/src/Makefile.am:1.90
332*** squid3/src/Makefile.am:1.89 Thu Aug 14 17:21:51 2003
333--- squid3/src/Makefile.am Sun Aug 31 21:49:37 2003
334***************
335*** 293,298 ****
336--- 293,299 ----
337
338 squid_SOURCES = \
339 access_log.cc \
340+ AccessLogEntry.h \
341 acl.cc \
342 ACL.h \
343 ACLChecklist.cc \
344***************
345*** 355,360 ****
346--- 356,362 ----
347 http.cc \
348 http.h \
349 HttpStatusLine.cc \
350+ HttpStatusLine.h \
351 HttpHdrCc.cc \
352 HttpHdrRange.cc \
353 HttpHdrSc.cc \
354***************
355*** 371,376 ****
356--- 373,379 ----
357 HttpReply.h \
358 HttpRequest.cc \
359 HttpRequest.h \
360+ HttpVersion.h \
361 icmp.cc \
362 ICP.h \
363 icp_v2.cc \
364Index: squid3/src/cache_manager.cc
365diff -c squid3/src/cache_manager.cc:1.30 squid3/src/cache_manager.cc:1.31
366*** squid3/src/cache_manager.cc:1.30 Sun Aug 10 05:00:42 2003
367--- squid3/src/cache_manager.cc Sun Aug 31 21:49:38 2003
368***************
369*** 316,324 ****
370 storeBuffer(entry);
371
372 {
373! http_version_t version;
374 HttpReply *rep = httpReplyCreate();
375- httpBuildVersion(&version, 1, 0);
376 httpReplySetHeaders(rep,
377 version,
378 HTTP_OK,
379--- 316,323 ----
380 storeBuffer(entry);
381
382 {
383! HttpVersion version(1,0);
384 HttpReply *rep = httpReplyCreate();
385 httpReplySetHeaders(rep,
386 version,
387 HTTP_OK,
388Index: squid3/src/client_side.cc
389diff -c squid3/src/client_side.cc:1.657 squid3/src/client_side.cc:1.658
390*** squid3/src/client_side.cc:1.657 Thu Aug 14 06:15:04 2003
391--- squid3/src/client_side.cc Sun Aug 31 21:49:38 2003
392***************
393*** 153,159 ****
394 #if UNUSED_CODE
395 static void trimTrailingSpaces(char *aString, size_t len);
396 #endif
397! static ClientSocketContext *parseURIandHTTPVersion(char **url_p, http_version_t * http_ver_p, ConnStateData::Pointer& conn, char *http_version_str);
398 static void setLogUri(clientHttpRequest * http, char const *uri);
399 static int connReadWasError(ConnStateData::Pointer& conn, comm_err_t, int size, int xerrno);
400 static int connFinishedWithConn(ConnStateData::Pointer& conn, int size);
401--- 153,159 ----
402 #if UNUSED_CODE
403 static void trimTrailingSpaces(char *aString, size_t len);
404 #endif
405! static ClientSocketContext *parseURIandHTTPVersion(char **url_p, HttpVersion * http_ver_p, ConnStateData::Pointer& conn, char *http_version_str);
406 static void setLogUri(clientHttpRequest * http, char const *uri);
407 static int connReadWasError(ConnStateData::Pointer& conn, comm_err_t, int size, int xerrno);
408 static int connFinishedWithConn(ConnStateData::Pointer& conn, int size);
409***************
410*** 640,647 ****
411 if (!Config.onoff.client_pconns)
412 request->flags.proxy_keepalive = 0;
413 else {
414! http_version_t http_ver;
415! httpBuildVersion(&http_ver, 1, 0);
416 /* we are HTTP/1.0, no matter what the client requests... */
417
418 if (httpMsgIsPersistent(http_ver, req_hdr))
419--- 640,646 ----
420 if (!Config.onoff.client_pconns)
421 request->flags.proxy_keepalive = 0;
422 else {
423! HttpVersion http_ver(1,0);
424 /* we are HTTP/1.0, no matter what the client requests... */
425
426 if (httpMsgIsPersistent(http_ver, req_hdr))
427***************
428*** 1601,1607 ****
429 #endif
430
431 static ClientSocketContext *
432! parseURIandHTTPVersion(char **url_p, http_version_t * http_ver_p,
433 ConnStateData::Pointer & conn, char *http_version_str)
434 {
435 char *url;
436--- 1600,1606 ----
437 #endif
438
439 static ClientSocketContext *
440! parseURIandHTTPVersion(char **url_p, HttpVersion * http_ver_p,
441 ConnStateData::Pointer & conn, char *http_version_str)
442 {
443 char *url;
444***************
445*** 1643,1649 ****
446 debug(33, 6) ("parseHttpRequest: Client HTTP version %d.%d.\n",
447 http_ver_p->major, http_ver_p->minor);
448 } else {
449! httpBuildVersion(http_ver_p, 0, 9); /* wild guess */
450 }
451
452 return NULL;
453--- 1642,1648 ----
454 debug(33, 6) ("parseHttpRequest: Client HTTP version %d.%d.\n",
455 http_ver_p->major, http_ver_p->minor);
456 } else {
457! *http_ver_p = HttpVersion(0,9); /* wild guess */
458 }
459
460 return NULL;
461***************
462*** 1652,1658 ****
463 /* Utility function to perform part of request parsing */
464 static ClientSocketContext *
465 clientParseHttpRequestLine(char *reqline, ConnStateData::Pointer &conn,
466! method_t * method_p, char **url_p, http_version_t * http_ver_p, char * http_version_str)
467 {
468 ClientSocketContext *result = NULL;
469 /* XXX: This sequence relies on strtok() */
470--- 1651,1657 ----
471 /* Utility function to perform part of request parsing */
472 static ClientSocketContext *
473 clientParseHttpRequestLine(char *reqline, ConnStateData::Pointer &conn,
474! method_t * method_p, char **url_p, HttpVersion * http_ver_p, char * http_version_str)
475 {
476 ClientSocketContext *result = NULL;
477 /* XXX: This sequence relies on strtok() */
478***************
479*** 1798,1804 ****
480 char *url = NULL;
481 char *req_hdr = NULL;
482 char *t;
483! http_version_t http_ver;
484 char *end;
485 size_t header_sz; /* size of headers, not including first line */
486 size_t prefix_sz; /* size of whole request (req-line + headers) */
487--- 1797,1803 ----
488 char *url = NULL;
489 char *req_hdr = NULL;
490 char *t;
491! HttpVersion http_ver;
492 char *end;
493 size_t header_sz; /* size of headers, not including first line */
494 size_t prefix_sz; /* size of whole request (req-line + headers) */
495Index: squid3/src/client_side_reply.cc
496diff -c squid3/src/client_side_reply.cc:1.66 squid3/src/client_side_reply.cc:1.67
497*** squid3/src/client_side_reply.cc:1.66 Tue Aug 19 16:30:36 2003
498--- squid3/src/client_side_reply.cc Sun Aug 31 21:49:38 2003
499***************
500*** 973,979 ****
501 }
502
503 HttpReply *r;
504- http_version_t version;
505
506 /* And for Vary, release the base URI if none of the headers was included in the request */
507
508--- 973,978 ----
509***************
510*** 1011,1017 ****
511
512 r = httpReplyCreate();
513
514! httpBuildVersion(&version, 1, 0);
515
516 httpReplySetHeaders(r, version, purgeStatus, NULL, NULL, 0, 0, -1);
517
518--- 1010,1016 ----
519
520 r = httpReplyCreate();
521
522! HttpVersion version(1,0);
523
524 httpReplySetHeaders(r, version, purgeStatus, NULL, NULL, 0, 0, -1);
525
526***************
527*** 1024,1030 ****
528 clientReplyContext::traceReply(clientStreamNode * node)
529 {
530 HttpReply *rep;
531- http_version_t version;
532 clientStreamNode *next = (clientStreamNode *)node->node.next->data;
533 StoreIOBuffer tempBuffer;
534 assert(http->request->max_forwards == 0);
535--- 1023,1028 ----
536***************
537*** 1037,1043 ****
538 storeReleaseRequest(http->storeEntry());
539 storeBuffer(http->storeEntry());
540 rep = httpReplyCreate();
541! httpBuildVersion(&version, 1, 0);
542 httpReplySetHeaders(rep, version, HTTP_OK, NULL, "text/plain",
543 httpRequestPrefixLen(http->request), 0, squid_curtime);
544 httpReplySwapOut(rep, http->storeEntry());
545--- 1035,1041 ----
546 storeReleaseRequest(http->storeEntry());
547 storeBuffer(http->storeEntry());
548 rep = httpReplyCreate();
549! HttpVersion version(1,0);
550 httpReplySetHeaders(rep, version, HTTP_OK, NULL, "text/plain",
551 httpRequestPrefixLen(http->request), 0, squid_curtime);
552 httpReplySwapOut(rep, http->storeEntry());
553***************
554*** 1457,1463 ****
555 }
556
557 /* enforce 1.0 reply version */
558! httpBuildVersion(&holdingReply->sline.version, 1, 0);
559
560 /* do header conversions */
561 buildReplyHeader();
562--- 1455,1461 ----
563 }
564
565 /* enforce 1.0 reply version */
566! holdingReply->sline.version = HttpVersion(1,0);
567
568 /* do header conversions */
569 buildReplyHeader();
570Index: squid3/src/client_side_request.cc
571diff -c squid3/src/client_side_request.cc:1.32 squid3/src/client_side_request.cc:1.33
572*** squid3/src/client_side_request.cc:1.32 Tue Aug 12 18:17:26 2003
573--- squid3/src/client_side_request.cc Sun Aug 31 21:49:38 2003
574***************
575*** 276,283 ****
576 char *tailbuf, size_t taillen)
577 {
578 size_t url_sz;
579! http_version_t http_ver =
580! {1, 0};
581 clientHttpRequest *http = new ClientHttpRequest;
582 HttpRequest *request;
583 StoreIOBuffer tempBuffer;
584--- 276,282 ----
585 char *tailbuf, size_t taillen)
586 {
587 size_t url_sz;
588! HttpVersion http_ver (1, 0);
589 clientHttpRequest *http = new ClientHttpRequest;
590 HttpRequest *request;
591 StoreIOBuffer tempBuffer;
592Index: squid3/src/client_side_request.h
593diff -c squid3/src/client_side_request.h:1.18 squid3/src/client_side_request.h:1.19
594*** squid3/src/client_side_request.h:1.18 Tue Aug 12 18:17:26 2003
595--- squid3/src/client_side_request.h Sun Aug 31 21:49:38 2003
596***************
597*** 37,42 ****
598--- 37,43 ----
599 #include "HttpHeader.h"
600 #include "clientStream.h"
601 #include "client_side.h"
602+ #include "AccessLogEntry.h"
603
604 /* client_side_request.c - client side request related routines (pure logic) */
605 extern int clientBeginRequest(method_t, char const *, CSCB *, CSD *, ClientStreamData, HttpHeader const *, char *, size_t);
606***************
607*** 95,101 ****
608 log_type logType;
609
610 struct timeval start;
611! http_version_t http_ver;
612 AccessLogEntry al;
613
614 struct
615--- 96,102 ----
616 log_type logType;
617
618 struct timeval start;
619! HttpVersion http_ver;
620 AccessLogEntry al;
621
622 struct
623Index: squid3/src/errorpage.cc
624diff -c squid3/src/errorpage.cc:1.190 squid3/src/errorpage.cc:1.191
625*** squid3/src/errorpage.cc:1.190 Sun Aug 10 05:00:42 2003
626--- squid3/src/errorpage.cc Sun Aug 31 21:49:38 2003
627***************
628*** 825,833 ****
629 {
630 HttpReply *rep = httpReplyCreate();
631 const char *name = errorPageName(err->page_id);
632- http_version_t version;
633 /* no LMT for error pages; error pages expire immediately */
634! httpBuildVersion(&version, 1, 0);
635
636 if (strchr(name, ':')) {
637 /* Redirection */
638--- 825,832 ----
639 {
640 HttpReply *rep = httpReplyCreate();
641 const char *name = errorPageName(err->page_id);
642 /* no LMT for error pages; error pages expire immediately */
643! HttpVersion version(1, 0);
644
645 if (strchr(name, ':')) {
646 /* Redirection */
647Index: squid3/src/ftp.cc
648diff -c squid3/src/ftp.cc:1.353 squid3/src/ftp.cc:1.354
649*** squid3/src/ftp.cc:1.353 Sun Aug 10 05:00:43 2003
650--- squid3/src/ftp.cc Sun Aug 31 21:49:38 2003
651***************
652*** 3048,3054 ****
653 const char *t = NULL;
654 StoreEntry *e = ftpState->entry;
655 HttpReply *reply = httpReplyCreate ();
656- http_version_t version;
657
658 if (ftpState->flags.http_header_sent)
659 return;
660--- 3048,3053 ----
661***************
662*** 3091,3103 ****
663 HttpHdrRangeSpec range_spec;
664 range_spec.offset = ftpState->restarted_offset;
665 range_spec.length = ftpState->size - ftpState->restarted_offset;
666! httpBuildVersion(&version, 1, 0);
667 httpReplySetHeaders(reply, version, HTTP_PARTIAL_CONTENT, "Gatewaying",
668 mime_type, ftpState->size - ftpState->restarted_offset, ftpState->mdtm, -2);
669 httpHeaderAddContRange(&reply->header, range_spec, ftpState->size);
670 } else {
671 /* Full reply */
672! httpBuildVersion(&version, 1, 0);
673 httpReplySetHeaders(reply, version, HTTP_OK, "Gatewaying",
674 mime_type, ftpState->size, ftpState->mdtm, -2);
675 }
676--- 3090,3102 ----
677 HttpHdrRangeSpec range_spec;
678 range_spec.offset = ftpState->restarted_offset;
679 range_spec.length = ftpState->size - ftpState->restarted_offset;
680! HttpVersion version(1, 0);
681 httpReplySetHeaders(reply, version, HTTP_PARTIAL_CONTENT, "Gatewaying",
682 mime_type, ftpState->size - ftpState->restarted_offset, ftpState->mdtm, -2);
683 httpHeaderAddContRange(&reply->header, range_spec, ftpState->size);
684 } else {
685 /* Full reply */
686! HttpVersion version(1, 0);
687 httpReplySetHeaders(reply, version, HTTP_OK, "Gatewaying",
688 mime_type, ftpState->size, ftpState->mdtm, -2);
689 }
690Index: squid3/src/http.cc
691diff -c squid3/src/http.cc:1.426 squid3/src/http.cc:1.427
692*** squid3/src/http.cc:1.426 Sun Aug 10 05:00:43 2003
693--- squid3/src/http.cc Sun Aug 31 21:49:38 2003
694***************
695*** 1492,1499 ****
696 http_state_flags flags)
697 {
698 const int offset = mb->size;
699! http_version_t httpver;
700! httpBuildVersion(&httpver, 1, 0);
701 memBufPrintf(mb, "%s %s HTTP/%d.%d\r\n",
702 RequestMethodStr[request->method],
703 request->urlpath.size() ? request->urlpath.buf() : "/",
704--- 1492,1498 ----
705 http_state_flags flags)
706 {
707 const int offset = mb->size;
708! HttpVersion httpver(1, 0);
709 memBufPrintf(mb, "%s %s HTTP/%d.%d\r\n",
710 RequestMethodStr[request->method],
711 request->urlpath.size() ? request->urlpath.buf() : "/",
712***************
713*** 1733,1739 ****
714 }
715
716 void
717! httpBuildVersion(http_version_t * version, unsigned int major, unsigned int minor)
718 {
719 version->major = major;
720 version->minor = minor;
721--- 1732,1738 ----
722 }
723
724 void
725! httpBuildVersion(HttpVersion * version, unsigned int major, unsigned int minor)
726 {
727 version->major = major;
728 version->minor = minor;
729Index: squid3/src/icp_v2.cc
730diff -c squid3/src/icp_v2.cc:1.82 squid3/src/icp_v2.cc:1.83
731*** squid3/src/icp_v2.cc:1.82 Sun Aug 10 05:00:43 2003
732--- squid3/src/icp_v2.cc Sun Aug 31 21:49:39 2003
733***************
734*** 40,45 ****
735--- 40,46 ----
736 #include "HttpRequest.h"
737 #include "ACLChecklist.h"
738 #include "ACL.h"
739+ #include "AccessLogEntry.h"
740
741 static void icpLogIcp(struct in_addr, log_type, int, const char *, int);
742
743***************
744*** 168,175 ****
745
746 if (!Config.onoff.log_udp)
747 return;
748-
749- memset(&al, '\0', sizeof(al));
750
751 al.icp.opcode = ICP_QUERY;
752
753--- 169,174 ----
754Index: squid3/src/internal.cc
755diff -c squid3/src/internal.cc:1.29 squid3/src/internal.cc:1.30
756*** squid3/src/internal.cc:1.29 Sun Aug 10 05:00:43 2003
757--- squid3/src/internal.cc Sun Aug 31 21:49:39 2003
758***************
759*** 47,53 ****
760 {
761 ErrorState *err;
762 const char *upath = request->urlpath.buf();
763- http_version_t version;
764 debug(76, 3) ("internalStart: %s requesting '%s'\n",
765 inet_ntoa(request->client_addr), upath);
766
767--- 47,52 ----
768***************
769*** 61,67 ****
770 const char *msgbuf = "This cache does not suport Cache Digests.\n";
771 #endif
772
773! httpBuildVersion(&version, 1, 0);
774 HttpReply *reply = httpReplyCreate ();
775 httpReplySetHeaders(reply,
776 version,
777--- 60,66 ----
778 const char *msgbuf = "This cache does not suport Cache Digests.\n";
779 #endif
780
781! HttpVersion version(1, 0);
782 HttpReply *reply = httpReplyCreate ();
783 httpReplySetHeaders(reply,
784 version,
785Index: squid3/src/main.cc
786diff -c squid3/src/main.cc:1.387 squid3/src/main.cc:1.388
787*** squid3/src/main.cc:1.387 Sat Aug 30 19:22:05 2003
788--- squid3/src/main.cc Sun Aug 31 21:49:39 2003
789***************
790*** 34,39 ****
791--- 34,40 ----
792 */
793
794 #include "squid.h"
795+ #include "AccessLogEntry.h"
796 #include "authenticate.h"
797 #include "Store.h"
798 #include "ICP.h"
799Index: squid3/src/mime.cc
800diff -c squid3/src/mime.cc:1.113 squid3/src/mime.cc:1.114
801*** squid3/src/mime.cc:1.113 Sun Aug 10 05:00:43 2003
802--- squid3/src/mime.cc Sun Aug 31 21:49:39 2003
803***************
804*** 570,578 ****
805
806 char *buf;
807
808- http_version_t version;
809-
810-
811 snprintf(path, MAXPATHLEN, "%s/%s", Config.icons.directory, icon);
812
813 fd = file_open(path, O_RDONLY | O_BINARY);
814--- 570,575 ----
815***************
816*** 606,612 ****
817
818 HttpReply *reply = httpReplyCreate();
819
820! httpBuildVersion(&version, 1, 0);
821
822 httpReplySetHeaders(reply, version, HTTP_OK, NULL,
823 mimeGetContentType(icon), (int) sb.st_size, sb.st_mtime, -1);
824--- 603,609 ----
825
826 HttpReply *reply = httpReplyCreate();
827
828! HttpVersion version(1, 0);
829
830 httpReplySetHeaders(reply, version, HTTP_OK, NULL,
831 mimeGetContentType(icon), (int) sb.st_size, sb.st_mtime, -1);
832Index: squid3/src/net_db.cc
833diff -c squid3/src/net_db.cc:1.172 squid3/src/net_db.cc:1.173
834*** squid3/src/net_db.cc:1.172 Sun Aug 10 05:00:44 2003
835--- squid3/src/net_db.cc Sun Aug 31 21:49:39 2003
836***************
837*** 1187,1193 ****
838 netdbBinaryExchange(StoreEntry * s)
839 {
840 HttpReply *reply = httpReplyCreate();
841- http_version_t version;
842 #if USE_ICMP
843
844 netdbEntry *n;
845--- 1187,1192 ----
846***************
847*** 1198,1204 ****
848
849 struct in_addr addr;
850 storeBuffer(s);
851! httpBuildVersion(&version, 1, 0);
852 httpReplySetHeaders(reply, version, HTTP_OK, "OK",
853 NULL, -1, squid_curtime, -2);
854 httpReplySwapOut(reply, s);
855--- 1197,1203 ----
856
857 struct in_addr addr;
858 storeBuffer(s);
859! HttpVersion version(1, 0);
860 httpReplySetHeaders(reply, version, HTTP_OK, "OK",
861 NULL, -1, squid_curtime, -2);
862 httpReplySwapOut(reply, s);
863***************
864*** 1258,1264 ****
865 memFree(buf, MEM_4K_BUF);
866 #else
867
868! httpBuildVersion(&version, 1, 0);
869 httpReplySetHeaders(reply, version, HTTP_BAD_REQUEST, "Bad Request",
870 NULL, -1, squid_curtime, -2);
871 httpReplySwapOut(reply, s);
872--- 1257,1263 ----
873 memFree(buf, MEM_4K_BUF);
874 #else
875
876! HttpVersion version(1,0);
877 httpReplySetHeaders(reply, version, HTTP_BAD_REQUEST, "Bad Request",
878 NULL, -1, squid_curtime, -2);
879 httpReplySwapOut(reply, s);
880***************
881*** 1295,1301 ****
882
883 requestLink(ex->r);
884 assert(NULL != ex->r);
885! httpBuildVersion(&ex->r->http_ver, 1, 0);
886 ex->connstate = STATE_HEADER;
887 ex->e = storeCreateEntry(uri, uri, request_flags(), METHOD_GET);
888 ex->buf_sz = NETDB_REQBUF_SZ;
889--- 1294,1300 ----
890
891 requestLink(ex->r);
892 assert(NULL != ex->r);
893! ex->r->http_ver = HttpVersion(1,0);
894 ex->connstate = STATE_HEADER;
895 ex->e = storeCreateEntry(uri, uri, request_flags(), METHOD_GET);
896 ex->buf_sz = NETDB_REQBUF_SZ;
897Index: squid3/src/protos.h
898diff -c squid3/src/protos.h:1.491 squid3/src/protos.h:1.492
899*** squid3/src/protos.h:1.491 Sun Aug 17 07:42:04 2003
900--- squid3/src/protos.h Sun Aug 31 21:49:39 2003
901***************
902*** 34,48 ****
903 #ifndef SQUID_PROTOS_H
904 #define SQUID_PROTOS_H
905
906- SQUIDCEXTERN void accessLogLog(AccessLogEntry *, ACLChecklist * checklist);
907- SQUIDCEXTERN void accessLogRotate(void);
908- SQUIDCEXTERN void accessLogClose(void);
909- SQUIDCEXTERN void accessLogInit(void);
910- SQUIDCEXTERN void accessLogFreeMemory(AccessLogEntry * aLogEntry);
911- SQUIDCEXTERN const char *accessLogTime(time_t);
912- SQUIDCEXTERN int accessLogParseLogFormat(logformat_token ** fmt, char *def);
913- SQUIDCEXTERN void accessLogDumpLogFormat(StoreEntry * entry, const char *name, logformat * definitions);
914- SQUIDCEXTERN void accessLogFreeLogFormat(logformat_token ** fmt);
915 SQUIDCEXTERN void hierarchyNote(HierarchyLogEntry *, hier_code, const char *);
916 #if FORW_VIA_DB
917 SQUIDCEXTERN void fvdbCountVia(const char *key);
918--- 34,39 ----
919***************
920*** 304,330 ****
921 SQUIDCEXTERN int httpAnonHdrAllowed(http_hdr_type hdr_id);
922 SQUIDCEXTERN int httpAnonHdrDenied(http_hdr_type hdr_id);
923 SQUIDCEXTERN void httpBuildRequestHeader(HttpRequest *, HttpRequest *, StoreEntry *, HttpHeader *, http_state_flags);
924- SQUIDCEXTERN void httpBuildVersion(http_version_t * version, unsigned int major, unsigned int minor);
925 SQUIDCEXTERN const char *httpMakeVaryMark(HttpRequest * request, HttpReply const * reply);
926
927 /* ETag */
928 SQUIDCEXTERN int etagParseInit(ETag * etag, const char *str);
929 SQUIDCEXTERN int etagIsEqual(const ETag * tag1, const ETag * tag2);
930
931- /* Http Status Line */
932- /* init/clean */
933- SQUIDCEXTERN void httpStatusLineInit(HttpStatusLine * sline);
934- SQUIDCEXTERN void httpStatusLineClean(HttpStatusLine * sline);
935- /* set/get values */
936- SQUIDCEXTERN void httpStatusLineSet(HttpStatusLine * sline, http_version_t version,
937- http_status status, const char *reason);
938- SQUIDCEXTERN const char *httpStatusLineReason(const HttpStatusLine * sline);
939- /* parse/pack */
940- /* parse a 0-terminating buffer and fill internal structires; returns true on success */
941- SQUIDCEXTERN int httpStatusLineParse(HttpStatusLine * sline, const char *start,
942- const char *end);
943- /* pack fields using Packer */
944- SQUIDCEXTERN void httpStatusLinePackInto(const HttpStatusLine * sline, Packer * p);
945 SQUIDCEXTERN const char *httpStatusString(http_status status);
946
947 /* Http Body */
948--- 295,306 ----
949***************
950*** 459,465 ****
951 SQUIDCEXTERN void httpHdrMangleList(HttpHeader *, HttpRequest *);
952
953 /* Http Msg (currently in HttpReply.c @?@ ) */
954- SQUIDCEXTERN int httpMsgIsPersistent(http_version_t http_ver, const HttpHeader * hdr);
955 SQUIDCEXTERN int httpMsgIsolateHeaders(const char **parse_start, const char **blk_start, const char **blk_end);
956
957 SQUIDCEXTERN void icmpOpen(void);
958--- 435,440 ----
959Index: squid3/src/store.cc
960diff -c squid3/src/store.cc:1.573 squid3/src/store.cc:1.574
961*** squid3/src/store.cc:1.573 Sun Aug 10 05:00:44 2003
962--- squid3/src/store.cc Sun Aug 31 21:49:39 2003
963***************
964*** 649,658 ****
965
966 if (mem->vary_headers && !storeGetPublic(mem->url, mem->method)) {
967 /* Create "vary" base object */
968- http_version_t version;
969 String vary;
970 pe = storeCreateEntry(mem->url, mem->log_url, request->flags, request->method);
971! httpBuildVersion(&version, 1, 0);
972 /* We are allowed to do this typecast */
973 httpReplySetHeaders((HttpReply *)pe->getReply(), version, HTTP_OK, "Internal marker object", "x-squid-internal/vary", -1, -1, squid_curtime + 100000);
974 vary = httpHeaderGetList(&mem->getReply()->header, HDR_VARY);
975--- 649,657 ----
976
977 if (mem->vary_headers && !storeGetPublic(mem->url, mem->method)) {
978 /* Create "vary" base object */
979 String vary;
980 pe = storeCreateEntry(mem->url, mem->log_url, request->flags, request->method);
981! HttpVersion version(1, 0);
982 /* We are allowed to do this typecast */
983 httpReplySetHeaders((HttpReply *)pe->getReply(), version, HTTP_OK, "Internal marker object", "x-squid-internal/vary", -1, -1, squid_curtime + 100000);
984 vary = httpHeaderGetList(&mem->getReply()->header, HDR_VARY);
985Index: squid3/src/store_digest.cc
986diff -c squid3/src/store_digest.cc:1.56 squid3/src/store_digest.cc:1.57
987*** squid3/src/store_digest.cc:1.56 Fri Feb 21 15:50:12 2003
988--- squid3/src/store_digest.cc Sun Aug 31 21:49:40 2003
989***************
990*** 420,426 ****
991 storeDigestRewriteResume(void)
992 {
993 StoreEntry *e;
994- http_version_t version;
995
996 assert(sd_state.rewrite_lock);
997 assert(!sd_state.rebuild_lock);
998--- 420,425 ----
999***************
1000*** 431,437 ****
1001 storeSetPublicKey(e);
1002 /* fake reply */
1003 HttpReply *rep = httpReplyCreate ();
1004! httpBuildVersion(&version, 1, 0);
1005 httpReplySetHeaders(rep, version, HTTP_OK, "Cache Digest OK",
1006 "application/cache-digest", store_digest->mask_size + sizeof(sd_state.cblock),
1007 squid_curtime, squid_curtime + Config.digest.rewrite_period);
1008--- 430,436 ----
1009 storeSetPublicKey(e);
1010 /* fake reply */
1011 HttpReply *rep = httpReplyCreate ();
1012! HttpVersion version(1, 0);
1013 httpReplySetHeaders(rep, version, HTTP_OK, "Cache Digest OK",
1014 "application/cache-digest", store_digest->mask_size + sizeof(sd_state.cblock),
1015 squid_curtime, squid_curtime + Config.digest.rewrite_period);
1016Index: squid3/src/structs.h
1017diff -c squid3/src/structs.h:1.480 squid3/src/structs.h:1.481
1018*** squid3/src/structs.h:1.480 Mon Aug 18 06:24:45 2003
1019--- squid3/src/structs.h Sun Aug 31 21:49:40 2003
1020***************
1021*** 90,100 ****
1022 size_t maxsize;
1023 };
1024
1025- struct _http_version_t
1026- {
1027- unsigned int major;
1028- unsigned int minor;
1029- };
1030
1031 #if SQUID_SNMP
1032
1033--- 90,95 ----
1034***************
1035*** 832,846 ****
1036 void *real_handler; /* first parameter to real append and vprintf */
1037 };
1038
1039- /* http status line */
1040-
1041- struct _HttpStatusLine
1042- {
1043- /* public, read only */
1044- http_version_t version;
1045- const char *reason; /* points to a _constant_ string (default or supplied), never free()d */
1046- http_status status;
1047- };
1048
1049 /*
1050 * Note: HttpBody is used only for messages with a small content that is
1051--- 827,832 ----
1052***************
1053*** 994,1061 ****
1054 struct timeval store_complete_stop;
1055 };
1056
1057- struct _AccessLogEntry
1058- {
1059- /* NB: memset is used on AccessLogEntries as at 20030715 RBC */
1060- const char *url;
1061-
1062- struct
1063- {
1064- method_t method;
1065- int code;
1066- const char *content_type;
1067- http_version_t version;
1068- }
1069-
1070- http;
1071-
1072- struct
1073- {
1074- icp_opcode opcode;
1075- }
1076-
1077- icp;
1078-
1079- struct
1080- {
1081-
1082- struct in_addr caddr;
1083- size_t size;
1084- off_t highOffset;
1085- size_t objectSize;
1086- log_type code;
1087- int msec;
1088- const char *rfc931;
1089- const char *authuser;
1090- #if USE_SSL
1091-
1092- const char *ssluser;
1093- #endif
1094-
1095- const char *extuser;
1096-
1097- }
1098-
1099- cache;
1100-
1101- struct
1102- {
1103- char *request;
1104- char *reply;
1105- }
1106-
1107- headers;
1108-
1109- struct
1110- {
1111- const char *method_str;
1112- }
1113-
1114- _private;
1115- HierarchyLogEntry hier;
1116- HttpReply *reply;
1117- HttpRequest *request;
1118- };
1119
1120 struct _ipcache_addrs
1121 {
1122--- 980,985 ----
1123Index: squid3/src/typedefs.h
1124diff -c squid3/src/typedefs.h:1.169 squid3/src/typedefs.h:1.170
1125*** squid3/src/typedefs.h:1.169 Sun Aug 10 03:53:49 2003
1126--- squid3/src/typedefs.h Sun Aug 31 21:49:40 2003
1127***************
1128*** 113,120 ****
1129
1130 typedef struct _fileMap fileMap;
1131
1132- typedef struct _HttpStatusLine HttpStatusLine;
1133-
1134 typedef struct _HttpHeaderFieldAttrs HttpHeaderFieldAttrs;
1135
1136 class HttpHeaderFieldInfo;
1137--- 113,118 ----
1138***************
1139*** 201,208 ****
1140
1141 class HttpRequest;
1142
1143- typedef struct _AccessLogEntry AccessLogEntry;
1144-
1145 typedef struct _cachemgr_passwd cachemgr_passwd;
1146
1147 typedef struct _refresh_t refresh_t;
1148--- 199,204 ----
1149***************
1150*** 272,279 ****
1151 typedef struct _RemovalPolicyNode RemovalPolicyNode;
1152
1153 typedef struct _RemovalPolicySettings RemovalPolicySettings;
1154-
1155- typedef struct _http_version_t http_version_t;
1156
1157 #if SQUID_SNMP
1158 typedef variable_list *(oid_ParseFn) (variable_list *, snint *);
1159--- 268,273 ----
1160Index: squid3/src/urn.cc
1161diff -c squid3/src/urn.cc:1.85 squid3/src/urn.cc:1.86
1162*** squid3/src/urn.cc:1.85 Sun Aug 10 05:00:45 2003
1163--- squid3/src/urn.cc Sun Aug 31 21:49:40 2003
1164***************
1165*** 315,326 ****
1166 ErrorState *err;
1167 int i;
1168 int urlcnt = 0;
1169- http_version_t version;
1170 char *buf = urnState->reqbuf;
1171 StoreIOBuffer tempBuffer;
1172
1173 debug(52, 3) ("urnHandleReply: Called with size=%u.\n", (unsigned int)result.length);
1174
1175 if (EBIT_TEST(urlres_e->flags, ENTRY_ABORTED)) {
1176 goto error;
1177 }
1178--- 315,328 ----
1179 ErrorState *err;
1180 int i;
1181 int urlcnt = 0;
1182 char *buf = urnState->reqbuf;
1183 StoreIOBuffer tempBuffer;
1184
1185 debug(52, 3) ("urnHandleReply: Called with size=%u.\n", (unsigned int)result.length);
1186
1187+ /* Can't be lower because of the goto's */
1188+ HttpVersion version(1, 0);
1189+
1190 if (EBIT_TEST(urlres_e->flags, ENTRY_ABORTED)) {
1191 goto error;
1192 }
1193***************
1194*** 433,439 ****
1195 "</ADDRESS>\n",
1196 full_appname_string, getMyHostname());
1197 rep = httpReplyCreate();
1198- httpBuildVersion(&version, 1, 0);
1199 httpReplySetHeaders(rep, version, HTTP_MOVED_TEMPORARILY, NULL,
1200 "text/html", mb.size, 0, squid_curtime);
1201
1202--- 435,440 ----
1203Index: squid3/src/whois.cc
1204diff -c squid3/src/whois.cc:1.27 squid3/src/whois.cc:1.28
1205*** squid3/src/whois.cc:1.27 Sun Aug 10 05:00:45 2003
1206--- squid3/src/whois.cc Sun Aug 31 21:49:40 2003
1207***************
1208*** 113,120 ****
1209 WhoisState::setReplyToOK(StoreEntry *entry)
1210 {
1211 HttpReply *reply = httpReplyCreate();
1212! http_version_t version;
1213! httpBuildVersion(&version, 1, 0);
1214 httpReplySetHeaders(reply, version, HTTP_OK, NULL, NULL, 0, 0, -1);
1215 storeEntryReplaceObject (entry, reply);
1216 }
1217--- 113,119 ----
1218 WhoisState::setReplyToOK(StoreEntry *entry)
1219 {
1220 HttpReply *reply = httpReplyCreate();
1221! HttpVersion version(1, 0);
1222 httpReplySetHeaders(reply, version, HTTP_OK, NULL, NULL, 0, 0, -1);
1223 storeEntryReplaceObject (entry, reply);
1224 }
This page took 0.222515 seconds and 4 git commands to generate.