From 5d4c7829bfdda8c0a5fd28896fd925d63221b929 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Wed, 27 Jun 2012 16:24:22 +1200 Subject: [PATCH] Minor refactoring. --- netlib/http.py | 3 +++ netlib/tcp.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/netlib/http.py b/netlib/http.py index 150995dd5..9c72c601b 100644 --- a/netlib/http.py +++ b/netlib/http.py @@ -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() diff --git a/netlib/tcp.py b/netlib/tcp.py index 9b1fc65e4..49c8b7a2a 100644 --- a/netlib/tcp.py +++ b/netlib/tcp.py @@ -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: