[arvados] updated: 2.6.0-29-g7f545f1fe

git repository hosting git at public.arvados.org
Wed Apr 19 19:05:58 UTC 2023


Summary of changes:
 sdk/python/arvados/http_import.py | 5 ++++-
 sdk/python/tests/test_http.py     | 5 +++++
 2 files changed, 9 insertions(+), 1 deletion(-)

       via  7f545f1feabcb30fa0ccb3cab3f46392d01f0fea (commit)
      from  8f737e30667628842cb8f85b1b2d7851536099f8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 7f545f1feabcb30fa0ccb3cab3f46392d01f0fea
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Wed Apr 19 15:02:55 2023 -0400

    20257: Need to parse status code out of the header, because pyCurl
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/sdk/python/arvados/http_import.py b/sdk/python/arvados/http_import.py
index d45eb7b63..f4913a5b7 100644
--- a/sdk/python/arvados/http_import.py
+++ b/sdk/python/arvados/http_import.py
@@ -173,7 +173,10 @@ class CurlDownloader(PyCurlHelper):
         else:
             self.name = self.parsedurl.path.split("/")[-1]
 
-        if self.curl.getinfo(pycurl.RESPONSE_CODE) == 200:
+        mt = re.match(r'^HTTP\/(\d(\.\d)?) ([1-5]\d\d) ([^\r\n\x00-\x08\x0b\x0c\x0e-\x1f\x7f]*)\r\n$', self._headers["x-status-line"])
+        code = int(mt.group(3))
+
+        if code == 200:
             self.target = self.collection.open(self.name, "wb")
 
     def body_write(self, chunk):
diff --git a/sdk/python/tests/test_http.py b/sdk/python/tests/test_http.py
index 44d0d2599..fa61e9ed8 100644
--- a/sdk/python/tests/test_http.py
+++ b/sdk/python/tests/test_http.py
@@ -59,6 +59,11 @@ class CurlMock:
     def perform(self):
         self.perform_was_called = True
 
+        if self.head:
+            self.headerfn("HTTP/1.1 {} Status".format(self.head_response))
+        else:
+            self.headerfn("HTTP/1.1 {} Status".format(self.get_response))
+
         for k,v in self.headers.items():
             self.headerfn("%s: %s" % (k,v))
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list