working except for lynx
authorlkcl <lkcl@teenymac.(none)>
Wed, 14 Jul 2010 17:08:04 +0000 (18:08 +0100)
committerlkcl <lkcl@teenymac.(none)>
Wed, 14 Jul 2010 17:08:04 +0000 (18:08 +0100)
ProxyServer.py
httpd.py

index 5f1a731f7eec9b471eed63953fd5e0927e8f3974..875c913c83333c577d4aa8fe5e4b29e72171bb93 100644 (file)
@@ -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'
index eeee6e5b376d0e11b902514036cfd0ce32982a33..e5596008db886e92184fdf64e19f84821cfbc19a 100644 (file)
--- 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