##// END OF EJS Templates
httppeer: always add x-hg* headers to Vary header...
Gregory Szorc -
r37573:930c433e default
parent child Browse files
Show More
@@ -158,7 +158,6 b' def makev1commandrequest(ui, requestbuil'
158 ui.debug("sending %s command\n" % cmd)
158 ui.debug("sending %s command\n" % cmd)
159 q = [('cmd', cmd)]
159 q = [('cmd', cmd)]
160 headersize = 0
160 headersize = 0
161 varyheaders = []
162 # Important: don't use self.capable() here or else you end up
161 # Important: don't use self.capable() here or else you end up
163 # with infinite recursion when trying to look up capabilities
162 # with infinite recursion when trying to look up capabilities
164 # for the first time.
163 # for the first time.
@@ -194,7 +193,6 b' def makev1commandrequest(ui, requestbuil'
194 for header, value in encodevalueinheaders(encargs, 'X-HgArg',
193 for header, value in encodevalueinheaders(encargs, 'X-HgArg',
195 headersize):
194 headersize):
196 headers[header] = value
195 headers[header] = value
197 varyheaders.append(header)
198 # Send arguments via query string (Mercurial <1.9).
196 # Send arguments via query string (Mercurial <1.9).
199 else:
197 else:
200 q += sorted(args.items())
198 q += sorted(args.items())
@@ -238,10 +236,14 b' def makev1commandrequest(ui, requestbuil'
238 headersize or 1024)
236 headersize or 1024)
239 for header, value in protoheaders:
237 for header, value in protoheaders:
240 headers[header] = value
238 headers[header] = value
239
240 varyheaders = []
241 for header in headers:
242 if header.lower().startswith(r'x-hg'):
241 varyheaders.append(header)
243 varyheaders.append(header)
242
244
243 if varyheaders:
245 if varyheaders:
244 headers[r'Vary'] = r','.join(varyheaders)
246 headers[r'Vary'] = r','.join(sorted(varyheaders))
245
247
246 req = requestbuilder(pycompat.strurl(cu), data, headers)
248 req = requestbuilder(pycompat.strurl(cu), data, headers)
247
249
@@ -200,7 +200,7 b' Failure to read getbundle HTTP request'
200
200
201 Now do a variation using POST to send arguments
201 Now do a variation using POST to send arguments
202
202
203 $ hg serve --config experimental.httppostargs=true --config badserver.closeafterrecvbytes=361,330 -p $HGPORT -d --pid-file=hg.pid -E error.log
203 $ hg serve --config experimental.httppostargs=true --config badserver.closeafterrecvbytes=375,344 -p $HGPORT -d --pid-file=hg.pid -E error.log
204 $ cat hg.pid > $DAEMON_PIDS
204 $ cat hg.pid > $DAEMON_PIDS
205
205
206 $ hg clone http://localhost:$HGPORT/ clone
206 $ hg clone http://localhost:$HGPORT/ clone
@@ -210,12 +210,12 b' Now do a variation using POST to send ar'
210 $ killdaemons.py $DAEMON_PIDS
210 $ killdaemons.py $DAEMON_PIDS
211
211
212 $ cat error.log
212 $ cat error.log
213 readline(361 from 65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
213 readline(375 from 65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
214 readline(328 from -1) -> (27) Accept-Encoding: identity\r\n
214 readline(342 from -1) -> (27) Accept-Encoding: identity\r\n
215 readline(301 from -1) -> (19) vary: X-HgProto-1\r\n
215 readline(315 from -1) -> (19) vary: X-HgProto-1\r\n
216 readline(282 from -1) -> (27) x-hgproto-1: partial-pull\r\n
216 readline(296 from -1) -> (27) x-hgproto-1: partial-pull\r\n
217 readline(255 from -1) -> (35) accept: application/mercurial-0.1\r\n
217 readline(269 from -1) -> (35) accept: application/mercurial-0.1\r\n
218 readline(220 from -1) -> (2?) host: localhost:$HGPORT\r\n (glob)
218 readline(234 from -1) -> (2?) host: localhost:$HGPORT\r\n (glob)
219 readline(* from -1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob)
219 readline(* from -1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob)
220 readline(* from -1) -> (2) \r\n (glob)
220 readline(* from -1) -> (2) \r\n (glob)
221 write(36) -> HTTP/1.1 200 Script output follows\r\n
221 write(36) -> HTTP/1.1 200 Script output follows\r\n
@@ -225,17 +225,17 b' Now do a variation using POST to send ar'
225 write(21) -> Content-Length: 449\r\n
225 write(21) -> Content-Length: 449\r\n
226 write(2) -> \r\n
226 write(2) -> \r\n
227 write(449) -> batch branchmap bundle2=HG20%0Abookmarks%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps%0Arev-branch-cache changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx httppostargs known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
227 write(449) -> batch branchmap bundle2=HG20%0Abookmarks%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps%0Arev-branch-cache changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx httppostargs known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
228 readline\(14[67] from 65537\) -> \(2[67]\) POST /\?cmd=batch HTTP/1.1\\r\\n (re)
228 readline(1?? from 65537) -> (27) POST /?cmd=batch HTTP/1.1\r\n (glob)
229 readline\(1(19|20) from -1\) -> \(27\) Accept-Encoding: identity\\r\\n (re)
229 readline(1?? from -1) -> (27) Accept-Encoding: identity\r\n (glob)
230 readline(9? from -1) -> (41) content-type: application/mercurial-0.1\r\n (glob)
230 readline(1?? from -1) -> (41) content-type: application/mercurial-0.1\r\n (glob)
231 readline(5? from -1) -> (19) vary: X-HgProto-1\r\n (glob)
231 readline(6? from -1) -> (33) vary: X-HgArgs-Post,X-HgProto-1\r\n (glob)
232 readline(3? from -1) -> (19) x-hgargs-post: 28\r\n (glob)
232 readline(3? from -1) -> (19) x-hgargs-post: 28\r\n (glob)
233 readline(1? from -1) -> (1?) x-hgproto-1: * (glob)
233 readline(1? from -1) -> (1?) x-hgproto-1: * (glob)
234 read limit reached; closing socket
234 read limit reached; closing socket
235 readline(330 from 65537) -> (27) POST /?cmd=batch HTTP/1.1\r\n
235 readline(344 from 65537) -> (27) POST /?cmd=batch HTTP/1.1\r\n
236 readline(303 from -1) -> (27) Accept-Encoding: identity\r\n
236 readline(317 from -1) -> (27) Accept-Encoding: identity\r\n
237 readline(276 from -1) -> (41) content-type: application/mercurial-0.1\r\n
237 readline(290 from -1) -> (41) content-type: application/mercurial-0.1\r\n
238 readline(235 from -1) -> (19) vary: X-HgProto-1\r\n
238 readline(249 from -1) -> (33) vary: X-HgArgs-Post,X-HgProto-1\r\n
239 readline(216 from -1) -> (19) x-hgargs-post: 28\r\n
239 readline(216 from -1) -> (19) x-hgargs-post: 28\r\n
240 readline(197 from -1) -> (61) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n
240 readline(197 from -1) -> (61) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n
241 readline(136 from -1) -> (35) accept: application/mercurial-0.1\r\n
241 readline(136 from -1) -> (35) accept: application/mercurial-0.1\r\n
General Comments 0
You need to be logged in to leave comments. Login now