From: biao716.wang Date: Fri, 28 Jul 2023 05:51:59 +0000 (+0900) Subject: merge some os source for urlgrabber-4.1.0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be9b9c59426e79f59ba9e27a08e4423c5810fa6f;p=tools%2Fmic.git merge some os source for urlgrabber-4.1.0 Change-Id: I03519e2b2445768ca47d44640d962502cae54489 Signed-off-by: biao716.wang --- diff --git a/mic/3rdparty/urlgrabber/grabber.py b/mic/3rdparty/urlgrabber/grabber.py index 90d8b58..cfc33bb 100755 --- a/mic/3rdparty/urlgrabber/grabber.py +++ b/mic/3rdparty/urlgrabber/grabber.py @@ -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))