Show More
@@ -91,7 +91,12 b' class hgweb(object):' | |||||
91 | if cmd and cmd in protocol.__all__: |
|
91 | if cmd and cmd in protocol.__all__: | |
92 | try: |
|
92 | try: | |
93 | if cmd in perms: |
|
93 | if cmd in perms: | |
|
94 | try: | |||
94 | self.check_perm(req, perms[cmd]) |
|
95 | self.check_perm(req, perms[cmd]) | |
|
96 | except ErrorResponse, inst: | |||
|
97 | if cmd == 'unbundle': | |||
|
98 | req.drain() | |||
|
99 | raise | |||
95 | method = getattr(protocol, cmd) |
|
100 | method = getattr(protocol, cmd) | |
96 | return method(self.repo, req) |
|
101 | return method(self.repo, req) | |
97 | except ErrorResponse, inst: |
|
102 | except ErrorResponse, inst: |
@@ -117,11 +117,7 b' def unbundle(repo, req):' | |||||
117 |
|
117 | |||
118 | # fail early if possible |
|
118 | # fail early if possible | |
119 | if not check_heads(): |
|
119 | if not check_heads(): | |
120 | length = int(req.env.get('CONTENT_LENGTH', 0)) |
|
120 | req.drain() | |
121 | for s in util.filechunkiter(req, limit=length): |
|
|||
122 | # drain incoming bundle, else client will not see |
|
|||
123 | # response when run outside cgi script |
|
|||
124 | pass |
|
|||
125 | raise ErrorResponse(HTTP_OK, 'unsynced changes') |
|
121 | raise ErrorResponse(HTTP_OK, 'unsynced changes') | |
126 |
|
122 | |||
127 | # do not lock repo until all changegroup data is |
|
123 | # do not lock repo until all changegroup data is |
@@ -7,6 +7,7 b'' | |||||
7 | # of the GNU General Public License, incorporated herein by reference. |
|
7 | # of the GNU General Public License, incorporated herein by reference. | |
8 |
|
8 | |||
9 | import socket, cgi, errno |
|
9 | import socket, cgi, errno | |
|
10 | from mercurial import util | |||
10 | from common import ErrorResponse, statusmessage |
|
11 | from common import ErrorResponse, statusmessage | |
11 |
|
12 | |||
12 | shortcuts = { |
|
13 | shortcuts = { | |
@@ -57,6 +58,12 b' class wsgirequest(object):' | |||||
57 | def read(self, count=-1): |
|
58 | def read(self, count=-1): | |
58 | return self.inp.read(count) |
|
59 | return self.inp.read(count) | |
59 |
|
60 | |||
|
61 | def drain(self): | |||
|
62 | '''need to read all data from request, httplib is half-duplex''' | |||
|
63 | length = int(self.env.get('CONTENT_LENGTH', 0)) | |||
|
64 | for s in util.filechunkiter(self.inp, limit=length): | |||
|
65 | pass | |||
|
66 | ||||
60 | def respond(self, status, type=None, filename=None, length=0): |
|
67 | def respond(self, status, type=None, filename=None, length=0): | |
61 | if self._start_response is not None: |
|
68 | if self._start_response is not None: | |
62 |
|
69 |
General Comments 0
You need to be logged in to leave comments.
Login now