]> git.ipfire.org Git - people/ummeegge/ipfire-2.x.git/blob - src/patches/squid/squid-3.5-14167.patch
39c9fd51e2a5eb76a784f5b5870df0eae73d438d
[people/ummeegge/ipfire-2.x.git] / src / patches / squid / squid-3.5-14167.patch
1 ------------------------------------------------------------
2 revno: 14167
3 revision-id: squid3@treenet.co.nz-20170529131555-kut221f3geb3aczf
4 parent: squid3@treenet.co.nz-20170529125748-qt7yhdloygl4xosg
5 fixes bug: http://bugs.squid-cache.org/show_bug.cgi?id=4653
6 author: Christos Tsantilas <chtsanti@users.sourceforge.net>
7 committer: Amos Jeffries <squid3@treenet.co.nz>
8 branch nick: 3.5
9 timestamp: Tue 2017-05-30 01:15:55 +1200
10 message:
11 Bug 4653: %st lies about tunneled traffic volumes
12
13 Squid-3.5 counts only the "CONNECT ..." header size for %>st and does not
14 count the "HTTP/1.1 200" response header for the %<st.
15
16 This is a Measurement Factory project
17 ------------------------------------------------------------
18 # Bazaar merge directive format 2 (Bazaar 0.90)
19 # revision_id: squid3@treenet.co.nz-20170529131555-kut221f3geb3aczf
20 # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.5
21 # testament_sha1: dd5783b425c7c7125303a1bd1a5685bc28011754
22 # timestamp: 2017-05-29 13:51:09 +0000
23 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.5
24 # base_revision_id: squid3@treenet.co.nz-20170529125748-\
25 # qt7yhdloygl4xosg
26 #
27 # Begin patch
28 === modified file 'src/client_side.cc'
29 --- src/client_side.cc 2017-03-31 00:51:52 +0000
30 +++ src/client_side.cc 2017-05-29 13:15:55 +0000
31 @@ -4391,7 +4391,7 @@
32 // in.buf still has the "CONNECT ..." request data, reset it to SSL hello message
33 connState->in.buf.append(rbuf.content(), rbuf.contentSize());
34 ClientHttpRequest *http = context->http;
35 - tunnelStart(http, &http->out.size, &http->al->http.code, http->al);
36 + tunnelStart(http);
37 }
38 }
39 }
40
41 === modified file 'src/client_side_reply.cc'
42 --- src/client_side_reply.cc 2017-01-01 00:16:45 +0000
43 +++ src/client_side_reply.cc 2017-05-29 13:15:55 +0000
44 @@ -1179,7 +1179,7 @@
45 if (curReply->content_length < 0)
46 return 0;
47
48 - int64_t expectedLength = curReply->content_length + http->out.headers_sz;
49 + uint64_t expectedLength = curReply->content_length + http->out.headers_sz;
50
51 if (http->out.size < expectedLength)
52 return 0;
53
54 === modified file 'src/client_side_request.cc'
55 --- src/client_side_request.cc 2017-05-29 07:10:37 +0000
56 +++ src/client_side_request.cc 2017-05-29 13:15:55 +0000
57 @@ -1522,7 +1522,7 @@
58 }
59 #endif
60 getConn()->stopReading(); // tunnels read for themselves
61 - tunnelStart(this, &out.size, &al->http.code, al);
62 + tunnelStart(this);
63 return;
64 }
65
66
67 === modified file 'src/client_side_request.h'
68 --- src/client_side_request.h 2017-01-23 02:05:46 +0000
69 +++ src/client_side_request.h 2017-05-29 13:15:55 +0000
70 @@ -73,7 +73,7 @@
71
72 struct {
73 int64_t offset;
74 - int64_t size;
75 + uint64_t size;
76 size_t headers_sz;
77 } out;
78
79 @@ -182,7 +182,7 @@
80 void clientAccessCheck(ClientHttpRequest *);
81
82 /* ones that should be elsewhere */
83 -void tunnelStart(ClientHttpRequest *, int64_t *, int *, const AccessLogEntry::Pointer &al);
84 +void tunnelStart(ClientHttpRequest *);
85
86 #if _USE_INLINE_
87 #include "client_side_request.cci"
88
89 === modified file 'src/tests/stub_tunnel.cc'
90 --- src/tests/stub_tunnel.cc 2017-01-01 00:16:45 +0000
91 +++ src/tests/stub_tunnel.cc 2017-05-29 13:15:55 +0000
92 @@ -14,7 +14,7 @@
93 #include "FwdState.h"
94 class ClientHttpRequest;
95
96 -void tunnelStart(ClientHttpRequest *, int64_t *, int *, const AccessLogEntryPointer &al) STUB
97 +void tunnelStart(ClientHttpRequest *) STUB
98
99 void switchToTunnel(HttpRequest *request, Comm::ConnectionPointer &clientConn, Comm::ConnectionPointer &srvConn) STUB
100
101
102 === modified file 'src/tunnel.cc'
103 --- src/tunnel.cc 2017-05-29 12:57:48 +0000
104 +++ src/tunnel.cc 2017-05-29 13:15:55 +0000
105 @@ -139,7 +139,7 @@
106 int len;
107 char *buf;
108 AsyncCall::Pointer writer; ///< pending Comm::Write callback
109 - int64_t *size_ptr; /* pointer to size in an ConnStateData for logging */
110 + uint64_t *size_ptr; /* pointer to size in an ConnStateData for logging */
111
112 Comm::ConnectionPointer conn; ///< The currently connected connection.
113 uint8_t delayedLoops; ///< how many times a read on this connection has been postponed.
114 @@ -848,6 +848,11 @@
115 return;
116 }
117
118 + if (ClientHttpRequest *http = tunnelState->http.get()) {
119 + http->out.headers_sz += size;
120 + http->out.size += size;
121 + }
122 +
123 tunnelStartShoveling(tunnelState);
124 }
125
126 @@ -995,7 +1000,7 @@
127 }
128
129 void
130 -tunnelStart(ClientHttpRequest * http, int64_t * size_ptr, int *status_ptr, const AccessLogEntryPointer &al)
131 +tunnelStart(ClientHttpRequest * http)
132 {
133 debugs(26, 3, HERE);
134 /* Create state structure. */
135 @@ -1021,7 +1026,7 @@
136 if (ch.fastCheck() == ACCESS_DENIED) {
137 debugs(26, 4, HERE << "MISS access forbidden.");
138 err = new ErrorState(ERR_FORWARDING_DENIED, Http::scForbidden, request);
139 - *status_ptr = Http::scForbidden;
140 + http->al->http.code = Http::scForbidden;
141 errorSend(http->getConn()->clientConnection, err);
142 return;
143 }
144 @@ -1037,12 +1042,13 @@
145 #endif
146 tunnelState->url = xstrdup(url);
147 tunnelState->request = request;
148 - tunnelState->server.size_ptr = size_ptr;
149 - tunnelState->status_ptr = status_ptr;
150 + tunnelState->server.size_ptr = &http->out.size;
151 + tunnelState->client.size_ptr = &http->al->http.clientRequestSz.payloadData;
152 + tunnelState->status_ptr = &http->al->http.code;
153 tunnelState->logTag_ptr = &http->logType;
154 tunnelState->client.conn = http->getConn()->clientConnection;
155 tunnelState->http = http;
156 - tunnelState->al = al;
157 + tunnelState->al = http->al ;
158 tunnelState->started = squid_curtime;
159
160 comm_add_close_handler(tunnelState->client.conn->fd,
161 @@ -1053,7 +1059,7 @@
162 CommTimeoutCbPtrFun(tunnelTimeout, tunnelState));
163 commSetConnTimeout(tunnelState->client.conn, Config.Timeout.lifetime, timeoutCall);
164
165 - peerSelect(&(tunnelState->serverDestinations), request, al,
166 + peerSelect(&(tunnelState->serverDestinations), request, tunnelState->al,
167 NULL,
168 tunnelPeerSelectComplete,
169 tunnelState);
170 @@ -1226,6 +1232,10 @@
171 if (context != NULL && context->http != NULL) {
172 tunnelState->logTag_ptr = &context->http->logType;
173 tunnelState->server.size_ptr = &context->http->out.size;
174 + if (context->http->al != NULL) {
175 + tunnelState->al = context->http->al;
176 + tunnelState->client.size_ptr = &context->http->al->http.clientRequestSz.payloadData;
177 + }
178
179 #if USE_DELAY_POOLS
180 /* no point using the delayIsNoDelay stuff since tunnel is nice and simple */
181