From: Zooko O'Whielacronx Date: Fri, 17 Aug 2007 19:06:41 +0000 (-0700) Subject: tahoe_put.py: don't treat "^HTTP 200 OK" appearing somewhere in the body as if it... X-Git-Url: https://git.rkrishnan.org/pf/content/en/footer/(%5B%5E?a=commitdiff_plain;h=e4f07a975f441e9932b52d1c535d659015566248;p=tahoe-lafs%2Ftahoe-lafs.git tahoe_put.py: don't treat "^HTTP 200 OK" appearing somewhere in the body as if it appeared in the header --- diff --git a/src/allmydata/scripts/tahoe_put.py b/src/allmydata/scripts/tahoe_put.py index 4b0497af..37d987a3 100644 --- a/src/allmydata/scripts/tahoe_put.py +++ b/src/allmydata/scripts/tahoe_put.py @@ -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():