Grail Python2.1

Jeffery D. Collins jcollins at boulder.net
Sun Jun 10 15:52:51 CEST 2001


Apparently, httplib has changed considerably since 1.5.  Here is a
patch that fixes the error, but is undoubtedly the wrong approach.
The module httpAPI.py may require some redesign...

Index: httpAPI.py
===================================================================
RCS file: /cvsroot/grail/grail/src/protocols/httpAPI.py,v
retrieving revision 1.32
diff -u -r1.32 httpAPI.py
--- httpAPI.py 1999/06/29 21:49:25	1.32
+++ httpAPI.py 2001/06/10 13:44:58
@@ -81,14 +81,14 @@
     def close(self):
         if self.file:
             self.file.close()
-        if self.sock:
+        if self._conn.sock:
             try:
-                self.sock.close()
+                self._conn.sock.close()
             except socket.error:
                 # What can you do? :-)
                 pass
         self.file = None
-        self.sock = None
+        self._conn = None
 
 
 class http_access:
@@ -175,7 +175,7 @@
     def pollmeta(self, timeout=0):
         Assert(self.state == META)
 
-        sock = self.h.sock
+        sock = self.h._conn.sock
         try:
             if not select.select([sock], [], [], timeout)[0]:
                 return "waiting for server response", 0
@@ -232,7 +232,7 @@
             self.readahead = self.readahead[maxbytes:]
             return data
         try:
-            data = self.h.sock.recv(maxbytes)
+            data = self.h._conn.sock.recv(maxbytes)
         except socket.error, msg:
             raise IOError, msg, sys.exc_traceback
         if not data:
@@ -241,7 +241,7 @@
         return data
 
     def fileno(self):
-        return self.h.sock.fileno()
+        return self.h._conn.sock.fileno()
 
 
 # To test this, use ProtocolAPI.test()



-- 
Jeffery Collins (http://www.boulder.net/~jcollins)




More information about the Python-list mailing list