mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-18 18:56:28 +00:00
tahoe_put.py: don't treat "^HTTP 200 OK" appearing somewhere in the body as if it appeared in the header
This commit is contained in:
parent
7e8c6eb50b
commit
e4f07a975f
@ -48,7 +48,6 @@ def put(nodeurl, vdrive, vdrive_fname, local_fname, verbosity):
|
||||
respbuf = []
|
||||
data = so.recv(CHUNKSIZE)
|
||||
while data:
|
||||
# print "debuggery 1 okay now we've got some more data: %r" % (data,)
|
||||
respbuf.append(data)
|
||||
data = so.recv(CHUNKSIZE)
|
||||
|
||||
@ -56,14 +55,17 @@ def put(nodeurl, vdrive, vdrive_fname, local_fname, verbosity):
|
||||
|
||||
data = so.recv(CHUNKSIZE)
|
||||
while data:
|
||||
# print "debuggery 2 okay now we've got some more data: %r" % (data,)
|
||||
respbuf.append(data)
|
||||
data = so.recv(CHUNKSIZE)
|
||||
|
||||
respstr = ''.join(respbuf)
|
||||
|
||||
RESP_RE=re.compile("^HTTP/[0-9]\.[0-9] ([0-9]*) *([A-Za-z_]*)") # This regex is soooo ad hoc... --Zooko 2007-08-16
|
||||
mo = RESP_RE.match(respstr)
|
||||
headerend = respstr.find('\r\n\r\n')
|
||||
if headerend == -1:
|
||||
headerend = len(respstr)
|
||||
header = respstr[:headerend]
|
||||
RESP_RE=re.compile("^HTTP/[0-9]\.[0-9] ([0-9]*) *([A-Za-z_ ]*)") # This regex is soooo ad hoc... --Zooko 2007-08-16
|
||||
mo = RESP_RE.match(header)
|
||||
if mo:
|
||||
code = int(mo.group(1))
|
||||
word = mo.group(2)
|
||||
@ -72,7 +74,7 @@ def put(nodeurl, vdrive, vdrive_fname, local_fname, verbosity):
|
||||
print "%s %s" % (code, word,)
|
||||
return 0
|
||||
|
||||
print respstr
|
||||
print respstr[headerend:]
|
||||
return 1
|
||||
|
||||
def main():
|
||||
|
Loading…
Reference in New Issue
Block a user