20257: Need to parse status code out of the header, because pyCurl
[arvados.git] / sdk / python / arvados / http_import.py
index d45eb7b633222aa855b6f365e94be4ce72ad6679..f4913a5b74da018deccc0d4d1a0d3e009d911e94 100644 (file)
@@ -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):