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

svn path=/main/trunk/; revision=9943

pym/portage/getbinpkg.py

index 5ace5b0b63dd84504c703f21b1b0b6b3a7fd34fc..75f3a352a4551b4bf2f03924763afdfcbb175184 100644 (file)
@@ -616,6 +616,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)