Minor refactoring.

This commit is contained in:
Aldo Cortesi 2012-06-27 16:24:22 +12:00
parent abe335e57d
commit 5d4c7829bf
2 changed files with 4 additions and 1 deletions

View File

@ -248,6 +248,9 @@ def read_http_body_response(rfile, headers, all, limit):
def read_response(rfile, method, body_size_limit):
"""
Return an (httpversion, code, msg, headers, content) tuple.
"""
line = rfile.readline()
if line == "\r\n" or line == "\n": # Possible leftover from previous message
line = rfile.readline()

View File

@ -156,8 +156,8 @@ class TCPServer:
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.socket.bind(self.server_address)
self.server_address = self.socket.getsockname()
self.port = self.server_address[1]
self.socket.listen(self.request_queue_size)
self.port = self.socket.getsockname()[1]
def request_thread(self, request, client_address):
try: