Mercurial > public > mercurial-scm > hg
comparison mercurial/httprepo.py @ 13555:970150ddaaf8
httprepo: order URL query string fields for readability
- cmd is always first, since the other fields are arguments to that command.
- The other fields are in alphabetical order, rather than random order.
example "hg serve" output
BEFORE
127.0.0.1 - - [26/Feb/2011 14:20:07] "GET /?bases=fa5962be1d87fe9a57244a14033550e192e57521+1a38f137b190482eaf0986594cd6e6b486c76fec&cmd=changegroupsubset&heads=1a38f137b190482eaf0986594cd6e6b486c76fec+fa5962be1d87fe9a57244a14033550e192e57521 HTTP/1.1" 200 -
127.0.0.1 - - [26/Feb/2011 14:00:50] "GET /?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between HTTP/1.1" 200 -
127.0.0.1 - - [26/Feb/2011 14:17:28] "GET /?nodes=1a38f137b190482eaf0986594cd6e6b486c76fec+fa5962be1d87fe9a57244a14033550e192e57521&cmd=branches HTTP/1.1" 200 -
AFTER
127.0.0.1 - - [26/Feb/2011 14:21:28] "GET /?cmd=changegroupsubset&bases=fa5962be1d87fe9a57244a14033550e192e57521+1a38f137b190482eaf0986594cd6e6b486c76fec&heads=1a38f137b190482eaf0986594cd6e6b486c76fec+fa5962be1d87fe9a57244a14033550e192e57521 HTTP/1.1" 200 -
127.0.0.1 - - [26/Feb/2011 13:48:13] "GET /?cmd=between&pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 HTTP/1.1" 200 -
127.0.0.1 - - [26/Feb/2011 14:19:17] "GET /?cmd=branches&nodes=1a38f137b190482eaf0986594cd6e6b486c76fec+fa5962be1d87fe9a57244a14033550e192e57521 HTTP/1.1" 200 -
author | Steven Brown <StevenGBrown@gmail.com> |
---|---|
date | Mon, 07 Mar 2011 15:37:11 +0800 |
parents | bda5f35fbf67 |
children | 395a84f78736 |
comparison
equal
deleted
inserted
replaced
13554:22565ddb28e7 | 13555:970150ddaaf8 |
---|---|
71 if cmd == 'pushkey': | 71 if cmd == 'pushkey': |
72 args['data'] = '' | 72 args['data'] = '' |
73 data = args.pop('data', None) | 73 data = args.pop('data', None) |
74 headers = args.pop('headers', {}) | 74 headers = args.pop('headers', {}) |
75 self.ui.debug("sending %s command\n" % cmd) | 75 self.ui.debug("sending %s command\n" % cmd) |
76 q = {"cmd": cmd} | 76 q = [('cmd', cmd)] + sorted(args.items()) |
77 q.update(args) | |
78 qs = '?%s' % urllib.urlencode(q) | 77 qs = '?%s' % urllib.urlencode(q) |
79 cu = "%s%s" % (self._url, qs) | 78 cu = "%s%s" % (self._url, qs) |
80 req = urllib2.Request(cu, data, headers) | 79 req = urllib2.Request(cu, data, headers) |
81 if data is not None: | 80 if data is not None: |
82 # len(data) is broken if data doesn't fit into Py_ssize_t | 81 # len(data) is broken if data doesn't fit into Py_ssize_t |