##// END OF EJS Templates
httppeer: don't send empty Vary request header...
Gregory Szorc -
r32022:e5d7f99a default
parent child Browse files
Show More
@@ -218,7 +218,9 b' class httppeer(wireproto.wirepeer):'
218 headers[header] = value
218 headers[header] = value
219 varyheaders.append(header)
219 varyheaders.append(header)
220
220
221 headers['Vary'] = ','.join(varyheaders)
221 if varyheaders:
222 headers['Vary'] = ','.join(varyheaders)
223
222 req = self.requestbuilder(cu, data, headers)
224 req = self.requestbuilder(cu, data, headers)
223
225
224 if data is not None:
226 if data is not None:
@@ -104,11 +104,10 b' Failure on subsequent HTTP request on th'
104 $ cat error.log
104 $ cat error.log
105 readline(210 from 65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
105 readline(210 from 65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
106 readline(177 from -1) -> (27) Accept-Encoding: identity\r\n
106 readline(177 from -1) -> (27) Accept-Encoding: identity\r\n
107 readline(150 from -1) -> (8) vary: \r\n
107 readline(150 from -1) -> (35) accept: application/mercurial-0.1\r\n
108 readline(142 from -1) -> (35) accept: application/mercurial-0.1\r\n
108 readline(115 from -1) -> (23) host: localhost:$HGPORT\r\n
109 readline(107 from -1) -> (23) host: localhost:$HGPORT\r\n
109 readline(92 from -1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
110 readline(84 from -1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
110 readline(43 from -1) -> (2) \r\n
111 readline(35 from -1) -> (2) \r\n
112 write(36) -> HTTP/1.1 200 Script output follows\r\n
111 write(36) -> HTTP/1.1 200 Script output follows\r\n
113 write(23) -> Server: badhttpserver\r\n
112 write(23) -> Server: badhttpserver\r\n
114 write(37) -> Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
113 write(37) -> Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
@@ -116,8 +115,8 b' Failure on subsequent HTTP request on th'
116 write(21) -> Content-Length: 405\r\n
115 write(21) -> Content-Length: 405\r\n
117 write(2) -> \r\n
116 write(2) -> \r\n
118 write(405) -> lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
117 write(405) -> lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
119 readline(33 from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
118 readline(41 from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
120 readline(7 from -1) -> (7) Accept-
119 readline(15 from -1) -> (15) Accept-Encoding
121 read limit reached; closing socket
120 read limit reached; closing socket
122 readline(210 from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
121 readline(210 from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
123 readline(184 from -1) -> (27) Accept-Encoding: identity\r\n
122 readline(184 from -1) -> (27) Accept-Encoding: identity\r\n
@@ -132,7 +131,7 b' Failure on subsequent HTTP request on th'
132
131
133 Failure to read getbundle HTTP request
132 Failure to read getbundle HTTP request
134
133
135 $ hg --config badserver.closeafterrecvbytes=300 serve -p $HGPORT -d --pid-file=hg.pid -E error.log
134 $ hg --config badserver.closeafterrecvbytes=292 serve -p $HGPORT -d --pid-file=hg.pid -E error.log
136 $ cat hg.pid > $DAEMON_PIDS
135 $ cat hg.pid > $DAEMON_PIDS
137 $ hg clone http://localhost:$HGPORT/ clone
136 $ hg clone http://localhost:$HGPORT/ clone
138 requesting all changes
137 requesting all changes
@@ -142,9 +141,8 b' Failure to read getbundle HTTP request'
142 $ killdaemons.py $DAEMON_PIDS
141 $ killdaemons.py $DAEMON_PIDS
143
142
144 $ cat error.log
143 $ cat error.log
145 readline(300 from 65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
144 readline(292 from 65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
146 readline(267 from -1) -> (27) Accept-Encoding: identity\r\n
145 readline(259 from -1) -> (27) Accept-Encoding: identity\r\n
147 readline(240 from -1) -> (8) vary: \r\n
148 readline(232 from -1) -> (35) accept: application/mercurial-0.1\r\n
146 readline(232 from -1) -> (35) accept: application/mercurial-0.1\r\n
149 readline(197 from -1) -> (23) host: localhost:$HGPORT\r\n
147 readline(197 from -1) -> (23) host: localhost:$HGPORT\r\n
150 readline(174 from -1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
148 readline(174 from -1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
@@ -161,15 +159,15 b' Failure to read getbundle HTTP request'
161 readline(70 from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
159 readline(70 from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
162 readline(41 from -1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n
160 readline(41 from -1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n
163 read limit reached; closing socket
161 read limit reached; closing socket
164 readline(300 from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
162 readline(292 from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
165 readline(274 from -1) -> (27) Accept-Encoding: identity\r\n
163 readline(266 from -1) -> (27) Accept-Encoding: identity\r\n
166 readline(247 from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
164 readline(239 from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
167 readline(218 from -1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n
165 readline(210 from -1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n
168 readline(177 from -1) -> (48) x-hgproto-1: 0.1 0.2 comp=zstd,zlib,none,bzip2\r\n
166 readline(169 from -1) -> (48) x-hgproto-1: 0.1 0.2 comp=zstd,zlib,none,bzip2\r\n
169 readline(129 from -1) -> (35) accept: application/mercurial-0.1\r\n
167 readline(121 from -1) -> (35) accept: application/mercurial-0.1\r\n
170 readline(94 from -1) -> (23) host: localhost:$HGPORT\r\n
168 readline(86 from -1) -> (23) host: localhost:$HGPORT\r\n
171 readline(71 from -1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
169 readline(63 from -1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
172 readline(22 from -1) -> (2) \r\n
170 readline(14 from -1) -> (2) \r\n
173 write(36) -> HTTP/1.1 200 Script output follows\r\n
171 write(36) -> HTTP/1.1 200 Script output follows\r\n
174 write(23) -> Server: badhttpserver\r\n
172 write(23) -> Server: badhttpserver\r\n
175 write(37) -> Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
173 write(37) -> Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
@@ -177,12 +175,12 b' Failure to read getbundle HTTP request'
177 write(20) -> Content-Length: 42\r\n
175 write(20) -> Content-Length: 42\r\n
178 write(2) -> \r\n
176 write(2) -> \r\n
179 write(42) -> 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n;
177 write(42) -> 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n;
180 readline(20 from 65537) -> (20) GET /?cmd=getbundle
178 readline(12 from 65537) -> (12) GET /?cmd=ge
181 read limit reached; closing socket
179 read limit reached; closing socket
182 readline(300 from 65537) -> (30) GET /?cmd=getbundle HTTP/1.1\r\n
180 readline(292 from 65537) -> (30) GET /?cmd=getbundle HTTP/1.1\r\n
183 readline(270 from -1) -> (27) Accept-Encoding: identity\r\n
181 readline(262 from -1) -> (27) Accept-Encoding: identity\r\n
184 readline(243 from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
182 readline(235 from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
185 readline(214 from -1) -> (214) x-hgarg-1: bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%2
183 readline(206 from -1) -> (206) x-hgarg-1: bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Ali
186 read limit reached; closing socket
184 read limit reached; closing socket
187
185
188 $ rm -f error.log
186 $ rm -f error.log
@@ -201,11 +199,10 b' Now do a variation using POST to send ar'
201 $ cat error.log
199 $ cat error.log
202 readline(315 from 65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
200 readline(315 from 65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
203 readline(282 from -1) -> (27) Accept-Encoding: identity\r\n
201 readline(282 from -1) -> (27) Accept-Encoding: identity\r\n
204 readline(255 from -1) -> (8) vary: \r\n
202 readline(255 from -1) -> (35) accept: application/mercurial-0.1\r\n
205 readline(247 from -1) -> (35) accept: application/mercurial-0.1\r\n
203 readline(220 from -1) -> (23) host: localhost:$HGPORT\r\n
206 readline(212 from -1) -> (23) host: localhost:$HGPORT\r\n
204 readline(197 from -1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
207 readline(189 from -1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
205 readline(148 from -1) -> (2) \r\n
208 readline(140 from -1) -> (2) \r\n
209 write(36) -> HTTP/1.1 200 Script output follows\r\n
206 write(36) -> HTTP/1.1 200 Script output follows\r\n
210 write(23) -> Server: badhttpserver\r\n
207 write(23) -> Server: badhttpserver\r\n
211 write(37) -> Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
208 write(37) -> Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
@@ -213,12 +210,12 b' Now do a variation using POST to send ar'
213 write(21) -> Content-Length: 418\r\n
210 write(21) -> Content-Length: 418\r\n
214 write(2) -> \r\n
211 write(2) -> \r\n
215 write(418) -> lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httppostargs httpmediatype=0.1rx,0.1tx,0.2tx compression=none
212 write(418) -> lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httppostargs httpmediatype=0.1rx,0.1tx,0.2tx compression=none
216 readline(138 from 65537) -> (27) POST /?cmd=batch HTTP/1.1\r\n
213 readline(146 from 65537) -> (27) POST /?cmd=batch HTTP/1.1\r\n
217 readline(111 from -1) -> (27) Accept-Encoding: identity\r\n
214 readline(119 from -1) -> (27) Accept-Encoding: identity\r\n
218 readline(84 from -1) -> (41) content-type: application/mercurial-0.1\r\n
215 readline(92 from -1) -> (41) content-type: application/mercurial-0.1\r\n
219 readline(43 from -1) -> (19) vary: X-HgProto-1\r\n
216 readline(51 from -1) -> (19) vary: X-HgProto-1\r\n
220 readline(24 from -1) -> (19) x-hgargs-post: 28\r\n
217 readline(32 from -1) -> (19) x-hgargs-post: 28\r\n
221 readline(5 from -1) -> (5) x-hgp
218 readline(13 from -1) -> (13) x-hgproto-1:
222 read limit reached; closing socket
219 read limit reached; closing socket
223 readline(315 from 65537) -> (27) POST /?cmd=batch HTTP/1.1\r\n
220 readline(315 from 65537) -> (27) POST /?cmd=batch HTTP/1.1\r\n
224 readline(288 from -1) -> (27) Accept-Encoding: identity\r\n
221 readline(288 from -1) -> (27) Accept-Encoding: identity\r\n
@@ -253,7 +250,6 b' Server sends a single character from the'
253 $ cat error.log
250 $ cat error.log
254 readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
251 readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
255 readline(-1) -> (27) Accept-Encoding: identity\r\n
252 readline(-1) -> (27) Accept-Encoding: identity\r\n
256 readline(-1) -> (8) vary: \r\n
257 readline(-1) -> (35) accept: application/mercurial-0.1\r\n
253 readline(-1) -> (35) accept: application/mercurial-0.1\r\n
258 readline(-1) -> (23) host: localhost:$HGPORT\r\n
254 readline(-1) -> (23) host: localhost:$HGPORT\r\n
259 readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
255 readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
@@ -279,7 +275,6 b' Server sends an incomplete capabilities '
279 $ cat error.log
275 $ cat error.log
280 readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
276 readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
281 readline(-1) -> (27) Accept-Encoding: identity\r\n
277 readline(-1) -> (27) Accept-Encoding: identity\r\n
282 readline(-1) -> (8) vary: \r\n
283 readline(-1) -> (35) accept: application/mercurial-0.1\r\n
278 readline(-1) -> (35) accept: application/mercurial-0.1\r\n
284 readline(-1) -> (23) host: localhost:$HGPORT\r\n
279 readline(-1) -> (23) host: localhost:$HGPORT\r\n
285 readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
280 readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
@@ -315,7 +310,6 b' TODO this output is horrible'
315 $ cat error.log
310 $ cat error.log
316 readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
311 readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
317 readline(-1) -> (27) Accept-Encoding: identity\r\n
312 readline(-1) -> (27) Accept-Encoding: identity\r\n
318 readline(-1) -> (8) vary: \r\n
319 readline(-1) -> (35) accept: application/mercurial-0.1\r\n
313 readline(-1) -> (35) accept: application/mercurial-0.1\r\n
320 readline(-1) -> (23) host: localhost:$HGPORT\r\n
314 readline(-1) -> (23) host: localhost:$HGPORT\r\n
321 readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
315 readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
@@ -359,7 +353,6 b' TODO client spews a stack due to uncaugh'
359 $ cat error.log
353 $ cat error.log
360 readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
354 readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
361 readline(-1) -> (27) Accept-Encoding: identity\r\n
355 readline(-1) -> (27) Accept-Encoding: identity\r\n
362 readline(-1) -> (8) vary: \r\n
363 readline(-1) -> (35) accept: application/mercurial-0.1\r\n
356 readline(-1) -> (35) accept: application/mercurial-0.1\r\n
364 readline(-1) -> (23) host: localhost:$HGPORT\r\n
357 readline(-1) -> (23) host: localhost:$HGPORT\r\n
365 readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
358 readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
@@ -412,7 +405,6 b' TODO this output is terrible'
412 $ cat error.log
405 $ cat error.log
413 readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
406 readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
414 readline(-1) -> (27) Accept-Encoding: identity\r\n
407 readline(-1) -> (27) Accept-Encoding: identity\r\n
415 readline(-1) -> (8) vary: \r\n
416 readline(-1) -> (35) accept: application/mercurial-0.1\r\n
408 readline(-1) -> (35) accept: application/mercurial-0.1\r\n
417 readline(-1) -> (23) host: localhost:$HGPORT\r\n
409 readline(-1) -> (23) host: localhost:$HGPORT\r\n
418 readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
410 readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
@@ -474,7 +466,6 b' Server sends empty HTTP body for getbund'
474 $ cat error.log
466 $ cat error.log
475 readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
467 readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
476 readline(-1) -> (27) Accept-Encoding: identity\r\n
468 readline(-1) -> (27) Accept-Encoding: identity\r\n
477 readline(-1) -> (8) vary: \r\n
478 readline(-1) -> (35) accept: application/mercurial-0.1\r\n
469 readline(-1) -> (35) accept: application/mercurial-0.1\r\n
479 readline(-1) -> (23) host: localhost:$HGPORT\r\n
470 readline(-1) -> (23) host: localhost:$HGPORT\r\n
480 readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
471 readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
@@ -538,7 +529,6 b' Server sends partial compression string'
538 $ cat error.log
529 $ cat error.log
539 readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
530 readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
540 readline(-1) -> (27) Accept-Encoding: identity\r\n
531 readline(-1) -> (27) Accept-Encoding: identity\r\n
541 readline(-1) -> (8) vary: \r\n
542 readline(-1) -> (35) accept: application/mercurial-0.1\r\n
532 readline(-1) -> (35) accept: application/mercurial-0.1\r\n
543 readline(-1) -> (23) host: localhost:$HGPORT\r\n
533 readline(-1) -> (23) host: localhost:$HGPORT\r\n
544 readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
534 readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
General Comments 0
You need to be logged in to leave comments. Login now