equal
deleted
inserted
replaced
95 headers = args.pop('headers', {}) |
95 headers = args.pop('headers', {}) |
96 |
96 |
97 self.ui.debug("sending %s command\n" % cmd) |
97 self.ui.debug("sending %s command\n" % cmd) |
98 q = [('cmd', cmd)] |
98 q = [('cmd', cmd)] |
99 headersize = 0 |
99 headersize = 0 |
100 if True: |
100 # Important: don't use self.capable() here or else you end up |
|
101 # with infinite recursion when trying to look up capabilities |
|
102 # for the first time. |
|
103 postargsok = self.caps is not None and 'httppostargs' in self.caps |
|
104 # TODO: support for httppostargs when data is a file-like |
|
105 # object rather than a basestring |
|
106 canmungedata = not data or isinstance(data, basestring) |
|
107 if postargsok and canmungedata: |
|
108 strargs = urllib.urlencode(sorted(args.items())) |
|
109 if strargs: |
|
110 if not data: |
|
111 data = strargs |
|
112 elif isinstance(data, basestring): |
|
113 data = strargs + data |
|
114 headers['X-HgArgs-Post'] = len(strargs) |
|
115 else: |
101 if len(args) > 0: |
116 if len(args) > 0: |
102 httpheader = self.capable('httpheader') |
117 httpheader = self.capable('httpheader') |
103 if httpheader: |
118 if httpheader: |
104 headersize = int(httpheader.split(',', 1)[0]) |
119 headersize = int(httpheader.split(',', 1)[0]) |
105 if headersize > 0: |
120 if headersize > 0: |