merge some os source for urlgrabber-4.1.0
authorbiao716.wang <biao716.wang@samsung.com>
Fri, 28 Jul 2023 05:51:59 +0000 (14:51 +0900)
committerbiao716.wang <biao716.wang@samsung.com>
Fri, 28 Jul 2023 05:51:59 +0000 (14:51 +0900)
Change-Id: I03519e2b2445768ca47d44640d962502cae54489
Signed-off-by: biao716.wang <biao716.wang@samsung.com>
mic/3rdparty/urlgrabber/grabber.py

index 90d8b58..cfc33bb 100755 (executable)
@@ -1089,7 +1089,7 @@ class URLGrabberOptions:
         return self.format()
 
     def format(self, indent='  '):
-        keys = self.__dict__.keys()
+        keys = list(self.__dict__.keys())
         if self.delegate is not None:
             keys.remove('delegate')
         keys.sort()
@@ -1208,12 +1208,12 @@ class URLGrabber(object):
             if not filename:
                 # This is better than nothing.
                 filename = 'index.html'
-        if scheme == 'file' and not opts.copy_local:
+        if scheme == b'file' and not opts.copy_local:
             # just return the name of the local file - don't make a
             # copy currently
-            path = url2pathname(path)
+            path = url2pathname(_urlunquote_convert(path))
             if host:
-                path = os.path.normpath('//' + host + path)
+                path = os.path.normpath('//' + _urlunquote_convert(host) + path)
             if not os.path.exists(path):
                 err = URLGrabError(2,
                       _('Local file does not exist: %s') % (path, ))
@@ -1510,6 +1510,8 @@ class PyCurlFileObject(object):
             self.curl_obj.setopt(pycurl.SSL_VERIFYPEER, opts.ssl_verify_peer)
             if opts.ssl_verify_host: # 1 is meaningless to curl
                 self.curl_obj.setopt(pycurl.SSL_VERIFYHOST, 2)
+            else:
+                self.curl_obj.setopt(pycurl.SSL_VERIFYHOST, 0)
             if opts.ssl_key:
                 self.curl_obj.setopt(pycurl.SSLKEY, opts.ssl_key)
             if opts.ssl_key_type:
@@ -1855,7 +1857,7 @@ class PyCurlFileObject(object):
                     raise err
             # re open it
             try:
-                self.fo = open(self.filename, 'r')
+                self.fo = open(self.filename, 'rb')
             except IOError as e:
                 err = URLGrabError(16, _('error opening file from %s, IOError: %s')
                                    % (self.url, e))