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)
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)
print "%s %s" % (code, word,)
return 0
- print respstr
+ print respstr[headerend:]
return 1
def main():