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