Make dir_get_metadata() retry if a httplib.ResponseNotReady exception
authorZac Medico <zmedico@gentoo.org>
Tue, 22 Apr 2008 18:30:54 +0000 (18:30 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 22 Apr 2008 18:30:54 +0000 (18:30 -0000)
occurs. (trunk r9943)

svn path=/main/branches/2.1.2/; revision=9944

pym/getbinpkg.py

index 861e98dd8826ccd139a8b3b202886f4cc557782a..0f2cd501b1f3e7f763e12d1c46f71931f19639ea 100644 (file)
@@ -620,6 +620,14 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache=
                                        # connection before sending a valid response".
                                        conn, protocol, address, params, headers = create_conn(
                                                baseurl)
+                               except httplib.ResponseNotReady:
+                                       # With some http servers this error is known to be thrown
+                                       # from conn.getresponse() in make_http_request() when the
+                                       # remote file does not have appropriate read permissions.
+                                       # Maybe it's possible to recover from this exception in
+                                       # cases though, so retry.
+                                       conn, protocol, address, params, headers = create_conn(
+                                               baseurl)
 
                        if myid and myid[0]:
                                metadata[baseurl]["data"][x] = make_metadata_dict(myid)