Client code could create responses explicitly.
else:
self.status = self.status + '; bad seek'
break
-
class HTTPResponse:
raise BadStatusLine(line)
return version, status, reason
- def _begin(self):
+ def begin(self):
if self.msg is not None:
# we've already started reading the response
return
else:
response = self.response_class(self.sock, strict=self.strict)
- response._begin()
+ response.begin()
assert response.will_close != _UNKNOWN
self.__state = _CS_IDLE
body = "HTTP/1.1 200 Ok\r\n\r\nText"
sock = FakeSocket(body)
resp = httplib.HTTPResponse(sock, 1)
-resp._begin()
+resp.begin()
print resp.read()
resp.close()
sock = FakeSocket(body)
resp = httplib.HTTPResponse(sock, 1)
try:
- resp._begin()
+ resp.begin()
except httplib.BadStatusLine:
print "BadStatusLine raised as expected"
else:
'Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme"')
s = FakeSocket(text)
r = httplib.HTTPResponse(s, 1)
-r._begin()
+r.begin()
cookies = r.getheader("Set-Cookie")
if cookies != hdr:
raise AssertionError, "multiple headers not combined properly"