##// END OF EJS Templates
httprepo: long arguments support (issue2126)...
Steven Brown -
r14093:ce99d887 default
parent child Browse files
Show More
@@ -5,7 +5,7
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 import cStringIO, zlib, sys, urllib
8 import cgi, cStringIO, itertools, zlib, sys, urllib
9 from mercurial import util, wireproto
9 from mercurial import util, wireproto
10 from common import HTTP_OK
10 from common import HTTP_OK
11
11
@@ -16,18 +16,29 class webproto(object):
16 self.req = req
16 self.req = req
17 self.response = ''
17 self.response = ''
18 def getargs(self, args):
18 def getargs(self, args):
19 knownargs = self._args()
19 data = {}
20 data = {}
20 keys = args.split()
21 keys = args.split()
21 for k in keys:
22 for k in keys:
22 if k == '*':
23 if k == '*':
23 star = {}
24 star = {}
24 for key in self.req.form.keys():
25 for key in knownargs.keys():
25 if key != 'cmd' and key not in keys:
26 if key != 'cmd' and key not in keys:
26 star[key] = self.req.form[key][0]
27 star[key] = knownargs[key][0]
27 data['*'] = star
28 data['*'] = star
28 else:
29 else:
29 data[k] = self.req.form[k][0]
30 data[k] = knownargs[k][0]
30 return [data[k] for k in keys]
31 return [data[k] for k in keys]
32 def _args(self):
33 args = self.req.form.copy()
34 chunks = []
35 for i in itertools.count(1):
36 h = self.req.env.get('HTTP_X_ARG_' + str(i))
37 if h is None:
38 break
39 chunks += [h]
40 args.update(cgi.parse_qs(''.join(chunks), keep_blank_values=True))
41 return args
31 def getfile(self, fp):
42 def getfile(self, fp):
32 length = int(self.req.env['CONTENT_LENGTH'])
43 length = int(self.req.env['CONTENT_LENGTH'])
33 for s in util.filechunkiter(self.req, limit=length):
44 for s in util.filechunkiter(self.req, limit=length):
@@ -59,6 +59,12 class _httprequesthandler(BaseHTTPServer
59 def log_message(self, format, *args):
59 def log_message(self, format, *args):
60 self._log_any(self.server.accesslog, format, *args)
60 self._log_any(self.server.accesslog, format, *args)
61
61
62 def log_request(self, code='-', size='-'):
63 xheaders = [h for h in self.headers.items() if h[0].startswith('x-')]
64 self.log_message('"%s" %s %s%s',
65 self.requestline, str(code), str(size),
66 ''.join([' %s:%s' % h for h in sorted(xheaders)]))
67
62 def do_write(self):
68 def do_write(self):
63 try:
69 try:
64 self.do_hgweb()
70 self.do_hgweb()
@@ -76,7 +76,26 class httprepository(wireproto.wirerepos
76 data = args.pop('data', None)
76 data = args.pop('data', None)
77 headers = args.pop('headers', {})
77 headers = args.pop('headers', {})
78 self.ui.debug("sending %s command\n" % cmd)
78 self.ui.debug("sending %s command\n" % cmd)
79 q = [('cmd', cmd)] + sorted(args.items())
79 q = [('cmd', cmd)]
80 headersize = 0
81 if len(args) > 0:
82 httpheader = self.capable('httpheader')
83 if httpheader:
84 headersize = int(httpheader.split(',')[0])
85 if headersize > 0:
86 # The headers can typically carry more data than the URL.
87 encargs = urllib.urlencode(sorted(args.items()))
88 headerfmt = 'X-Arg-%s'
89 contentlen = headersize - len(headerfmt % '000' + ': \r\n')
90 headernum = 0
91 for i in xrange(0, len(encargs), contentlen):
92 headernum += 1
93 header = headerfmt % str(headernum)
94 headers[header] = encargs[i:i + contentlen]
95 varyheaders = [headerfmt % str(h) for h in range(1, headernum + 1)]
96 headers['Vary'] = ','.join(varyheaders)
97 else:
98 q += sorted(args.items())
80 qs = '?%s' % urllib.urlencode(q)
99 qs = '?%s' % urllib.urlencode(q)
81 cu = "%s%s" % (self._url, qs)
100 cu = "%s%s" % (self._url, qs)
82 req = urllib2.Request(cu, data, headers)
101 req = urllib2.Request(cu, data, headers)
@@ -233,6 +233,7 def capabilities(repo, proto):
233 else:
233 else:
234 caps.append('streamreqs=%s' % ','.join(requiredformats))
234 caps.append('streamreqs=%s' % ','.join(requiredformats))
235 caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
235 caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
236 caps.append('httpheader=1024')
236 return ' '.join(caps)
237 return ' '.join(caps)
237
238
238 def changegroup(repo, proto, roots):
239 def changegroup(repo, proto, roots):
@@ -247,7 +247,7 Verify we hit the HTTP server:
247 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
247 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
248 * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - (glob)
248 * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - (glob)
249 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
249 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
250 * - - [*] "GET /?cmd=getbundle&common=c1818a9f5977dd4139a48f93f5425c67d44a9368+ea919464b16e003894c48b6cb68df3cd9411b544&heads=6b57ee934bb2996050540f84cdfc8dcad1e7267d+2114148793524fd045998f71a45b0aaf139f752b HTTP/1.1" 200 - (glob)
250 * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - x-arg-1:common=c1818a9f5977dd4139a48f93f5425c67d44a9368+ea919464b16e003894c48b6cb68df3cd9411b544&heads=6b57ee934bb2996050540f84cdfc8dcad1e7267d+2114148793524fd045998f71a45b0aaf139f752b (glob)
251
251
252 $ cat error.log
252 $ cat error.log
253
253
@@ -952,7 +952,7 capabilities
952 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=capabilities'; echo
952 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=capabilities'; echo
953 200 Script output follows
953 200 Script output follows
954
954
955 lookup changegroupsubset branchmap pushkey known getbundle unbundlehash unbundle=HG10GZ,HG10BZ,HG10UN
955 lookup changegroupsubset branchmap pushkey known getbundle unbundlehash unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024
956
956
957 heads
957 heads
958
958
@@ -100,21 +100,21 do not use the proxy if it is in the no
100 $ cat proxy.log
100 $ cat proxy.log
101 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
101 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
102 * - - [*] "GET http://localhost:$HGPORT/?cmd=stream_out HTTP/1.1" - - (glob)
102 * - - [*] "GET http://localhost:$HGPORT/?cmd=stream_out HTTP/1.1" - - (glob)
103 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob)
103 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-arg-1:namespace=bookmarks (glob)
104 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
104 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
105 * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob)
105 * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob)
106 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 HTTP/1.1" - - (glob)
106 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-arg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
107 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob)
107 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-arg-1:namespace=bookmarks (glob)
108 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
108 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
109 * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob)
109 * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob)
110 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 HTTP/1.1" - - (glob)
110 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-arg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
111 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob)
111 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-arg-1:namespace=bookmarks (glob)
112 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
112 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
113 * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob)
113 * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob)
114 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 HTTP/1.1" - - (glob)
114 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-arg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
115 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob)
115 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-arg-1:namespace=bookmarks (glob)
116 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
116 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
117 * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob)
117 * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob)
118 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 HTTP/1.1" - - (glob)
118 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-arg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
119 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob)
119 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-arg-1:namespace=bookmarks (glob)
120
120
@@ -66,6 +66,23 expect success
66 repository tip rolled back to revision 0 (undo serve)
66 repository tip rolled back to revision 0 (undo serve)
67 working directory now based on revision 0
67 working directory now based on revision 0
68
68
69 expect success, server lacks the httpheader capability
70
71 $ CAP=httpheader
72 $ . "$TESTDIR/notcapable"
73 $ req
74 pushing to http://localhost:$HGPORT/
75 searching for changes
76 remote: adding changesets
77 remote: adding manifests
78 remote: adding file changes
79 remote: added 1 changesets with 1 changes to 1 files
80 remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http:*: (glob)
81 % serve errors
82 $ hg rollback
83 repository tip rolled back to revision 0 (undo serve)
84 working directory now based on revision 0
85
69 expect success, server lacks the unbundlehash capability
86 expect success, server lacks the unbundlehash capability
70
87
71 $ CAP=unbundlehash
88 $ CAP=unbundlehash
@@ -28,4 +28,4 Ensure hashed heads format is used.
28 The hash here is always the same since the remote repository only has the null head.
28 The hash here is always the same since the remote repository only has the null head.
29
29
30 $ cat access.log | grep unbundle
30 $ cat access.log | grep unbundle
31 * - - [*] "POST /?cmd=unbundle&heads=686173686564+6768033e216468247bd031a0a2d9876d79818f8f HTTP/1.1" 200 - (glob)
31 * - - [*] "POST /?cmd=unbundle HTTP/1.1" 200 - x-arg-1:heads=686173686564+6768033e216468247bd031a0a2d9876d79818f8f (glob)
@@ -23,14 +23,57 HTTP:
23
23
24 $ hg debugwireargs http://localhost:$HGPORT/ un deux trois quatre
24 $ hg debugwireargs http://localhost:$HGPORT/ un deux trois quatre
25 un deux trois quatre None
25 un deux trois quatre None
26 $ hg debugwireargs http://localhost:$HGPORT/ \ un deux trois\ qu\ \ atre
27 un deux trois qu atre None
26 $ hg debugwireargs http://localhost:$HGPORT/ eins zwei --four vier
28 $ hg debugwireargs http://localhost:$HGPORT/ eins zwei --four vier
27 eins zwei None vier None
29 eins zwei None vier None
28 $ hg debugwireargs http://localhost:$HGPORT/ eins zwei
30 $ hg debugwireargs http://localhost:$HGPORT/ eins zwei
29 eins zwei None None None
31 eins zwei None None None
30 $ hg debugwireargs http://localhost:$HGPORT/ eins zwei --five fuenf
32 $ hg debugwireargs http://localhost:$HGPORT/ eins zwei --five fuenf
31 eins zwei None None None
33 eins zwei None None None
34 $ hg debugwireargs http://localhost:$HGPORT/ un deux trois onethousandcharactersxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx None
36 $ cat error.log
32 $ cat access.log
37 $ cat access.log
33 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
38 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
39 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:four=quatre&one=un&three=trois&two=deux (glob)
40 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:four=quatre&one=un&three=trois&two=deux (glob)
41 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
42 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:four=qu++atre&one=+un&three=trois+&two=deux (glob)
43 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:four=qu++atre&one=+un&three=trois+&two=deux (glob)
44 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
45 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:four=vier&one=eins&two=zwei (glob)
46 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:four=vier&one=eins&two=zwei (glob)
47 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
48 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:one=eins&two=zwei (glob)
49 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:one=eins&two=zwei (glob)
50 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
51 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:one=eins&two=zwei (glob)
52 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:one=eins&two=zwei (glob)
53 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
54 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:four=onethousandcharactersxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&one=u x-arg-2:n&three=trois&two=deux (glob)
56
57 HTTP without the httpheader capability:
58
59 $ HGRCPATH="`pwd`/repo/.hgrc"
60 $ CAP=httpheader
61 $ . "$TESTDIR/notcapable"
62
63 $ hg serve -R repo -p $HGPORT2 -d --pid-file=hg2.pid -E error2.log -A access2.log
64 $ cat hg2.pid >> $DAEMON_PIDS
65
66 $ hg debugwireargs http://localhost:$HGPORT2/ un deux trois quatre
67 un deux trois quatre None
68 $ hg debugwireargs http://localhost:$HGPORT2/ eins zwei --four vier
69 eins zwei None vier None
70 $ hg debugwireargs http://localhost:$HGPORT2/ eins zwei
71 eins zwei None None None
72 $ hg debugwireargs http://localhost:$HGPORT2/ eins zwei --five fuenf
73 eins zwei None None None
74 $ cat error2.log
75 $ cat access2.log
76 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
34 * - - [*] "GET /?cmd=debugwireargs&four=quatre&one=un&three=trois&two=deux HTTP/1.1" 200 - (glob)
77 * - - [*] "GET /?cmd=debugwireargs&four=quatre&one=un&three=trois&two=deux HTTP/1.1" 200 - (glob)
35 * - - [*] "GET /?cmd=debugwireargs&four=quatre&one=un&three=trois&two=deux HTTP/1.1" 200 - (glob)
78 * - - [*] "GET /?cmd=debugwireargs&four=quatre&one=un&three=trois&two=deux HTTP/1.1" 200 - (glob)
36 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
79 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
@@ -30,6 +30,12 class ProxyHandler (BaseHTTPServer.BaseH
30 else:
30 else:
31 self.__base_handle()
31 self.__base_handle()
32
32
33 def log_request(self, code='-', size='-'):
34 xheaders = [h for h in self.headers.items() if h[0].startswith('x-')]
35 self.log_message('"%s" %s %s%s',
36 self.requestline, str(code), str(size),
37 ''.join([' %s:%s' % h for h in sorted(xheaders)]))
38
33 def _connect_to(self, netloc, soc):
39 def _connect_to(self, netloc, soc):
34 i = netloc.find(':')
40 i = netloc.find(':')
35 if i >= 0:
41 if i >= 0:
General Comments 0
You need to be logged in to leave comments. Login now