From: lkcl Date: Wed, 14 Jul 2010 17:08:04 +0000 (+0100) Subject: working except for lynx X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fc29fbd0ad3241dcd7b6b99ffcca1b2297e68045;p=multitaskhttpd.git working except for lynx --- diff --git a/ProxyServer.py b/ProxyServer.py index 5f1a731..875c913 100644 --- a/ProxyServer.py +++ b/ProxyServer.py @@ -253,6 +253,7 @@ class ProxyServerRequestHandler(object): break yield self.client.writeMessage(data) + raise StopIteration if self.hr.close_connection: print 'proxy wants client to close_connection' diff --git a/httpd.py b/httpd.py index eeee6e5..e559600 100644 --- a/httpd.py +++ b/httpd.py @@ -277,7 +277,7 @@ class Protocol(object): try: yield self.parseRequests() # parse http requests except ConnectionClosed: - yield self.connectionClosed() + #yield self.connectionClosed() if _debug: print 'parse connection closed' def writeMessage(self, message): @@ -349,6 +349,11 @@ class Protocol(object): print "parseRequest headers", repr(self.hr.headers), str(self.hr.headers) try: yield self.messageReceived(self.hr) + except ConnectionClosed: + if _debug: + print 'parseRequests, ConnectionClosed ' + raise StopIteration + except: if _debug: print 'messageReceived', \ @@ -512,12 +517,12 @@ class Client(Protocol): def connectionClosed(self): '''Called when the client drops the connection''' if _debug: 'Client.connectionClosed' + #self.writeMessage(None) + #yield self.queue.put((None,None)) if self.stream.sock: yield self.stream.close() else: yield None - #self.writeMessage(None) - #yield self.queue.put((None,None)) def messageReceived(self, msg): if _debug: print 'messageReceived cmd=', msg.command, msg.path