Show More
@@ -40,7 +40,7 b' def putlfile(repo, proto, sha):' | |||||
40 | tmpfp = util.atomictempfile(path, createmode=repo.store.createmode) |
|
40 | tmpfp = util.atomictempfile(path, createmode=repo.store.createmode) | |
41 |
|
41 | |||
42 | try: |
|
42 | try: | |
43 |
proto. |
|
43 | proto.forwardpayload(tmpfp) | |
44 | tmpfp._fp.seek(0) |
|
44 | tmpfp._fp.seek(0) | |
45 | if sha != lfutil.hexsha1(tmpfp._fp): |
|
45 | if sha != lfutil.hexsha1(tmpfp._fp): | |
46 | raise IOError(0, _('largefile contents do not match hash')) |
|
46 | raise IOError(0, _('largefile contents do not match hash')) |
@@ -1008,7 +1008,7 b' def unbundle(repo, proto, heads):' | |||||
1008 | fp = os.fdopen(fd, pycompat.sysstr('wb+')) |
|
1008 | fp = os.fdopen(fd, pycompat.sysstr('wb+')) | |
1009 | r = 0 |
|
1009 | r = 0 | |
1010 | try: |
|
1010 | try: | |
1011 |
proto. |
|
1011 | proto.forwardpayload(fp) | |
1012 | fp.seek(0) |
|
1012 | fp.seek(0) | |
1013 | gen = exchange.readbundle(repo.ui, fp, None) |
|
1013 | gen = exchange.readbundle(repo.ui, fp, None) | |
1014 | if (isinstance(gen, changegroupmod.cg1unpacker) |
|
1014 | if (isinstance(gen, changegroupmod.cg1unpacker) |
@@ -64,14 +64,10 b' class baseprotocolhandler(object):' | |||||
64 | returns a list of values (same order as <args>)""" |
|
64 | returns a list of values (same order as <args>)""" | |
65 |
|
65 | |||
66 | @abc.abstractmethod |
|
66 | @abc.abstractmethod | |
67 |
def |
|
67 | def forwardpayload(self, fp): | |
68 | """write the whole content of a file into a file like object |
|
68 | """Read the raw payload and forward to a file. | |
69 |
|
69 | |||
70 | The file is in the form:: |
|
70 | The payload is read in full before the function returns. | |
71 |
|
||||
72 | (<chunk-size>\n<chunk>)+0\n |
|
|||
73 |
|
||||
74 | chunk size is the ascii version of the int. |
|
|||
75 | """ |
|
71 | """ | |
76 |
|
72 | |||
77 | @abc.abstractmethod |
|
73 | @abc.abstractmethod | |
@@ -145,7 +141,7 b' class webproto(baseprotocolhandler):' | |||||
145 | args.update(cgi.parse_qs(argvalue, keep_blank_values=True)) |
|
141 | args.update(cgi.parse_qs(argvalue, keep_blank_values=True)) | |
146 | return args |
|
142 | return args | |
147 |
|
143 | |||
148 |
def |
|
144 | def forwardpayload(self, fp): | |
149 | length = int(self._req.env[r'CONTENT_LENGTH']) |
|
145 | length = int(self._req.env[r'CONTENT_LENGTH']) | |
150 | # If httppostargs is used, we need to read Content-Length |
|
146 | # If httppostargs is used, we need to read Content-Length | |
151 | # minus the amount that was consumed by args. |
|
147 | # minus the amount that was consumed by args. | |
@@ -392,7 +388,12 b' class sshv1protocolhandler(baseprotocolh' | |||||
392 | data[arg] = val |
|
388 | data[arg] = val | |
393 | return [data[k] for k in keys] |
|
389 | return [data[k] for k in keys] | |
394 |
|
390 | |||
395 |
def |
|
391 | def forwardpayload(self, fpout): | |
|
392 | # The file is in the form: | |||
|
393 | # | |||
|
394 | # <chunk size>\n<chunk> | |||
|
395 | # ... | |||
|
396 | # 0\n | |||
396 | _sshv1respondbytes(self._fout, b'') |
|
397 | _sshv1respondbytes(self._fout, b'') | |
397 | count = int(self._fin.readline()) |
|
398 | count = int(self._fin.readline()) | |
398 | while count: |
|
399 | while count: |
General Comments 0
You need to be logged in to leave comments.
Login now