Index: Lib/urllib.py
===================================================================
--- Lib/urllib.py	(revision 52914)
+++ Lib/urllib.py	(working copy)
@@ -414,6 +414,8 @@
                 h.send(data)
             errcode, errmsg, headers = h.getreply()
             fp = h.getfile()
+            if fp == None:
+                raise IOError, ('http error', 'invalid data')
             if errcode == 200:
                 return addinfourl(fp, headers, "https:" + url)
             else:
Index: Lib/poplib.py
===================================================================
--- Lib/poplib.py	(revision 52914)
+++ Lib/poplib.py	(working copy)
@@ -6,6 +6,7 @@
 # Author: David Ascher <david_ascher@brown.edu>
 #         [heavily stealing from nntplib.py]
 # Updated: Piers Lauder <piers@cs.su.oz.au> [Jul '97]
+# Updated: Hasan Diwan <hasan.diwan@gmail.com> [Sep '06]
 # String method conversion and test jig improvements by ESR, February 2001.
 # Added the POP3_SSL class. Methods loosely based on IMAP_SSL. Hector Urtubia <urtubia@mrbook.org> Aug 2003
 
@@ -405,7 +406,56 @@
         del self.sslobj, self.sock
         return resp
 
+class poplib_as_list():
+    ''' Allows for a vaguely list-like interface to a pop3 account '''
+    def __init__(self, host, user, password, port=110, ssl=False, keyFile=None, certFile=None):
+        if ssl:
+            self.p =POP3_SSL(host, port, keyFile, certFile)
+        elif ssl == False:
+            self.p =POP3 (host, port)
+        self.p.user(user)
+        self.p.pass_(password)
+        
+    def __getitem__(self, i):
+        '''
+        Defining this allows for index-based access to messages
+        '''
+        return self.p.retr(i)
+    
+    def __len__(self):
+        '''
+        Defining this allows for quick access to the number of messages
+        '''
+        return self.p.stat()[0]+1
+    
+    def __delitem__(self, i):
+        '''
+        Defining this allows for deletion of the ith message
+        '''
+        return self.p.dele(i)
+    
+    def __getattribute__(self, attr):
+        try:
+            return self.p.__getattribute__(self.p,attr)
+        except AttributeError:
+            return super.__getattribute__(self, attr)
+        
+    def __getslice__(self, i, j):
+        '''
+        Get a group of messages and return them as a list
+        '''
+        ret = []
+        for c in range(i,j):
+            ret.append(self[c])
+        return ret
 
+    def __delslice__(self, start, stop):
+        '''
+        Remove a group of messages
+        '''
+        for x in range(start, stop):
+            del x
+
 if __name__ == "__main__":
     import sys
     a = POP3(sys.argv[1])
@@ -421,3 +471,12 @@
             print '   ' + line
         print '-----------------------'
     a.quit()
+    l = poplib_as_list(sys.argv[1])
+    l.user(sys.argv[2])
+    l.pass_(sys.argv[3])
+    for i in range(1,len(l)):
+        (header, msg, octets) = l[i]
+        print "Message %d: "%i
+        for line in msg: print '     '+line
+    print '-----------------------'
+    l.quit()
Index: Makefile.pre.in
===================================================================
--- Makefile.pre.in	(revision 52914)
+++ Makefile.pre.in	(working copy)
@@ -622,6 +622,7 @@
 # Install almost everything without disturbing previous versions
 altinstall:	@FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
                 sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@
+    mkdir -p $(DESTDIR)
 
 # Install shared libraries enabled by Setup
 DESTDIRS=	$(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
