Hello community, here is the log from the commit of package python-websocket-client for openSUSE:Factory checked in at 2020-03-12 22:58:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-websocket-client (Old) and /work/SRC/openSUSE:Factory/.python-websocket-client.new.3160 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-websocket-client" Thu Mar 12 22:58:57 2020 rev:13 rq:784164 version:0.57.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-websocket-client/python-websocket-client.changes 2019-04-18 13:57:43.139981094 +0200 +++ /work/SRC/openSUSE:Factory/.python-websocket-client.new.3160/python-websocket-client.changes 2020-03-12 22:59:13.923012873 +0100 @@ -1,0 +2,17 @@ +Thu Mar 12 07:49:24 UTC 2020 - Tomáš Chvátal <tchva...@suse.com> + +- Fix build without python2 + +------------------------------------------------------------------- +Thu Feb 6 13:48:44 UTC 2020 - Marketa Calabkova <mcalabk...@suse.com> + +- update to 0.57.0 + * wsdump: Fix --headers option + * Fix getting 400 bad request with long proxy authorization string + * Create dummy `ssl` object + * Show compressed text messages in wsdump.py + * Expose http connection header to user + * fix the compatible issue with gevent+dnspython + * _handshake: hasattr checks on six before accessing the values + +------------------------------------------------------------------- Old: ---- websocket_client-0.56.0.tar.gz New: ---- websocket_client-0.57.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-websocket-client.spec ++++++ --- /var/tmp/diff_new_pack.m16deX/_old 2020-03-12 22:59:14.703013184 +0100 +++ /var/tmp/diff_new_pack.m16deX/_new 2020-03-12 22:59:14.723013192 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-websocket-client # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -23,17 +23,16 @@ %else %define ssl_match_hostname python-backports.ssl_match_hostname %endif +%bcond_without python2 Name: python-websocket-client -Version: 0.56.0 +Version: 0.57.0 Release: 0 Summary: WebSocket client implementation License: LGPL-2.1-only -Group: Development/Languages/Python URL: https://github.com/liris/websocket-client/releases Source0: https://files.pythonhosted.org/packages/source/w/websocket_client/websocket_client-%{version}.tar.gz BuildRequires: %{python_module setuptools} BuildRequires: %{python_module six} -BuildRequires: %{ssl_match_hostname} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-six @@ -42,6 +41,9 @@ Provides: python-websocket-client-test = %{version} Obsoletes: python-websocket-client-test < %{version} BuildArch: noarch +%if %{with python2} +BuildRequires: %{ssl_match_hostname} +%endif %ifpython2 Requires: %{ssl_match_hostname} %endif ++++++ websocket_client-0.56.0.tar.gz -> websocket_client-0.57.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.56.0/ChangeLog new/websocket_client-0.57.0/ChangeLog --- old/websocket_client-0.56.0/ChangeLog 2019-03-21 02:22:50.000000000 +0100 +++ new/websocket_client-0.57.0/ChangeLog 2019-12-25 13:38:50.000000000 +0100 @@ -1,6 +1,21 @@ ChangeLog ============ +- 0.57.0 + - wsdump: Fix --headers option (#589) + - Fix getting 400 bad request with long proxy authorization string (#587) + - Fix for errors that occur when closing websocket from another thread (#586) + - avoid calling repr(data) if tracing is not enabled (#584) + - Fixed typo (#579) + - Create dummy `ssl` object (#577) + - Show compressed text messages in wsdump.py (#576) + - Resolve issue opening socket to intranet on Windows 10 with no proxy settings but behind proxy (#573) + - Expose http connection header to user (#566) + - Improve the readability of HTTP status codes. (#553) + - fix the compatible issue with gevent+dnspython (#547) + - v should be checked for emptry string before splitting it (#539) + - _handshake: hasattr checks on six before accessing the values (#533) + - 0.56.0 - Don't retry sockets with timeout set to 0(#536) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.56.0/PKG-INFO new/websocket_client-0.57.0/PKG-INFO --- old/websocket_client-0.56.0/PKG-INFO 2019-03-21 02:25:33.000000000 +0100 +++ new/websocket_client-0.57.0/PKG-INFO 2019-12-25 13:46:52.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: websocket_client -Version: 0.56.0 +Version: 0.57.0 Summary: WebSocket client for Python. hybi13 is supported. Home-page: https://github.com/websocket-client/websocket-client.git Author: liris diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.56.0/bin/wsdump.py new/websocket_client-0.57.0/bin/wsdump.py --- old/websocket_client-0.56.0/bin/wsdump.py 2017-08-11 10:10:58.000000000 +0200 +++ new/websocket_client-0.57.0/bin/wsdump.py 2019-12-25 13:14:55.000000000 +0100 @@ -6,6 +6,8 @@ import threading import time import ssl +import gzip +import zlib import six from six.moves.urllib.parse import urlparse @@ -130,7 +132,7 @@ if args.nocert: opts = {"cert_reqs": ssl.CERT_NONE, "check_hostname": False} if args.headers: - options['header'] = map(str.strip, args.headers.split(',')) + options['header'] = list(map(str.strip, args.headers.split(','))) ws = websocket.create_connection(args.url, sslopt=opts, **options) if args.raw: console = NonInteractive() @@ -162,10 +164,24 @@ msg = None if six.PY3 and opcode == websocket.ABNF.OPCODE_TEXT and isinstance(data, bytes): data = str(data, "utf-8") - if not args.verbose and opcode in OPCODE_DATA: - msg = data - elif args.verbose: + if isinstance(data, bytes) and len(data)>2 and data[:2] == b'\037\213': # gzip magick + try: + data = "[gzip] " + str(gzip.decompress(data), "utf-8") + except: + pass + elif isinstance(data, bytes): + try: + data = "[zlib] " + str(zlib.decompress(data, -zlib.MAX_WBITS), "utf-8") + except: + pass + + if isinstance(data, bytes): + data = repr(data) + + if args.verbose: msg = "%s: %s" % (websocket.ABNF.OPCODE_MAP.get(opcode), data) + else: + msg = data if msg is not None: if args.timings: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.56.0/setup.py new/websocket_client-0.57.0/setup.py --- old/websocket_client-0.56.0/setup.py 2019-03-21 02:22:05.000000000 +0100 +++ new/websocket_client-0.57.0/setup.py 2019-12-25 13:43:05.000000000 +0100 @@ -3,7 +3,7 @@ from setuptools import setup import pkg_resources -VERSION = "0.56.0" +VERSION = "0.57.0" NAME = "websocket_client" install_requires = ["six"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.56.0/websocket/__init__.py new/websocket_client-0.57.0/websocket/__init__.py --- old/websocket_client-0.56.0/websocket/__init__.py 2019-03-21 02:22:13.000000000 +0100 +++ new/websocket_client-0.57.0/websocket/__init__.py 2019-12-25 13:00:01.000000000 +0100 @@ -26,4 +26,4 @@ from ._logging import * from ._socket import * -__version__ = "0.56.0" +__version__ = "0.57.0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.56.0/websocket/_app.py new/websocket_client-0.57.0/websocket/_app.py --- old/websocket_client-0.56.0/websocket/_app.py 2018-10-28 02:43:24.000000000 +0100 +++ new/websocket_client-0.57.0/websocket/_app.py 2019-12-25 13:35:57.000000000 +0100 @@ -42,11 +42,11 @@ class Dispatcher: def __init__(self, app, ping_timeout): - self.app = app + self.app = app self.ping_timeout = ping_timeout def read(self, sock, read_callback, check_callback): - while self.app.sock.connected: + while self.app.keep_running: r, w, e = select.select( (self.app.sock.sock, ), (), (), self.ping_timeout) if r: @@ -54,13 +54,13 @@ break check_callback() -class SSLDispacther: +class SSLDispatcher: def __init__(self, app, ping_timeout): - self.app = app + self.app = app self.ping_timeout = ping_timeout def read(self, sock, read_callback, check_callback): - while self.app.sock.connected: + while self.app.keep_running: r = self.select() if r: if not read_callback(): @@ -75,6 +75,7 @@ r, w, e = select.select((sock, ), (), (), self.ping_timeout) return r + class WebSocketApp(object): """ Higher level of APIs are provided. @@ -179,7 +180,7 @@ http_no_proxy=None, http_proxy_auth=None, skip_utf8_validation=False, host=None, origin=None, dispatcher=None, - suppress_origin = False, proxy_type=None): + suppress_origin=False, proxy_type=None): """ run event loop for WebSocket framework. This loop is infinite loop and is alive during websocket is available. @@ -314,7 +315,7 @@ def create_dispatcher(self, ping_timeout): timeout = ping_timeout or 10 if self.sock.is_ssl(): - return SSLDispacther(self, timeout) + return SSLDispatcher(self, timeout) return Dispatcher(self, timeout) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.56.0/websocket/_core.py new/websocket_client-0.57.0/websocket/_core.py --- old/websocket_client-0.56.0/websocket/_core.py 2019-02-23 06:20:40.000000000 +0100 +++ new/websocket_client-0.57.0/websocket/_core.py 2019-12-25 13:09:50.000000000 +0100 @@ -271,7 +271,8 @@ frame.get_mask_key = self.get_mask_key data = frame.format() length = len(data) - trace("send: " + repr(data)) + if (isEnabledForTrace()): + trace("send: " + repr(data)) with self.lock: while data: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.56.0/websocket/_exceptions.py new/websocket_client-0.57.0/websocket/_exceptions.py --- old/websocket_client-0.56.0/websocket/_exceptions.py 2018-12-15 06:42:01.000000000 +0100 +++ new/websocket_client-0.57.0/websocket/_exceptions.py 2019-12-25 13:35:57.000000000 +0100 @@ -80,6 +80,7 @@ self.status_code = status_code self.resp_headers = resp_headers + class WebSocketAddressException(WebSocketException): """ If the websocket address info cannot be found, this exception will be raised. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.56.0/websocket/_handshake.py new/websocket_client-0.57.0/websocket/_handshake.py --- old/websocket_client-0.56.0/websocket/_handshake.py 2018-12-15 06:45:33.000000000 +0100 +++ new/websocket_client-0.57.0/websocket/_handshake.py 2019-12-25 13:37:39.000000000 +0100 @@ -31,13 +31,13 @@ from ._logging import * from ._socket import * -if six.PY3: +if hasattr(six, 'PY3') and six.PY3: from base64 import encodebytes as base64encode else: from base64 import encodestring as base64encode -if six.PY3: - if six.PY34: +if hasattr(six, 'PY3') and six.PY3: + if hasattr(six, 'PY34') and six.PY34: from http import client as HTTPStatus else: from http import HTTPStatus @@ -55,7 +55,8 @@ # websocket supported version. VERSION = 13 -SUPPORTED_REDIRECT_STATUSES = [HTTPStatus.MOVED_PERMANENTLY, HTTPStatus.FOUND, HTTPStatus.SEE_OTHER] +SUPPORTED_REDIRECT_STATUSES = (HTTPStatus.MOVED_PERMANENTLY, HTTPStatus.FOUND, HTTPStatus.SEE_OTHER,) +SUCCESS_STATUSES = SUPPORTED_REDIRECT_STATUSES + (HTTPStatus.SWITCHING_PROTOCOLS,) CookieJar = SimpleCookieJar() @@ -85,6 +86,7 @@ return handshake_response(status, resp, subproto) + def _pack_hostname(hostname): # IPv6 address if ':' in hostname: @@ -95,14 +97,12 @@ def _get_handshake_headers(resource, host, port, options): headers = [ "GET %s HTTP/1.1" % resource, - "Upgrade: websocket", - "Connection: Upgrade" + "Upgrade: websocket" ] if port == 80 or port == 443: hostport = _pack_hostname(host) else: hostport = "%s:%d" % (_pack_hostname(host), port) - if "host" in options and options["host"] is not None: headers.append("Host: %s" % options["host"]) else: @@ -126,6 +126,11 @@ if not 'header' in options or 'Sec-WebSocket-Version' not in options['header']: headers.append("Sec-WebSocket-Version: %s" % VERSION) + if not 'connection' in options or options['connection'] is None: + headers.append('Connection: upgrade') + else: + headers.append(options['connection']) + subprotocols = options.get("subprotocols") if subprotocols: headers.append("Sec-WebSocket-Protocol: %s" % ",".join(subprotocols)) @@ -154,12 +159,13 @@ return headers, key -def _get_resp_headers(sock, success_statuses=(101, 301, 302, 303)): +def _get_resp_headers(sock, success_statuses=SUCCESS_STATUSES): status, resp_headers, status_message = read_headers(sock) if status not in success_statuses: raise WebSocketBadStatusException("Handshake status %d %s", status, status_message, resp_headers) return status, resp_headers + _HEADERS_TO_CHECK = { "upgrade": "websocket", "connection": "upgrade", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.56.0/websocket/_http.py new/websocket_client-0.57.0/websocket/_http.py --- old/websocket_client-0.56.0/websocket/_http.py 2019-02-23 06:18:35.000000000 +0100 +++ new/websocket_client-0.57.0/websocket/_http.py 2019-12-25 13:35:57.000000000 +0100 @@ -64,6 +64,7 @@ self.auth = None self.no_proxy = None + def _open_proxied_socket(url, options, proxy): hostname, port, resource, is_secure = parse_url(url) @@ -138,15 +139,18 @@ phost, pport, pauth = get_proxy_info( hostname, is_secure, proxy.host, proxy.port, proxy.auth, proxy.no_proxy) try: + # when running on windows 10, getaddrinfo without socktype returns a socktype 0. + # This generates an error exception: `_on_error: exception Socket type must be stream or datagram, not 0` + # or `OSError: [Errno 22] Invalid argument` when creating socket. Force the socket type to SOCK_STREAM. if not phost: addrinfo_list = socket.getaddrinfo( - hostname, port, 0, 0, socket.SOL_TCP) + hostname, port, 0, socket.SOCK_STREAM, socket.SOL_TCP) return addrinfo_list, False, None else: pport = pport and pport or 80 # when running on windows 10, the getaddrinfo used above # returns a socktype 0. This generates an error exception: - #_on_error: exception Socket type must be stream or datagram, not 0 + # _on_error: exception Socket type must be stream or datagram, not 0 # Force the socket type to SOCK_STREAM addrinfo_list = socket.getaddrinfo(phost, pport, 0, socket.SOCK_STREAM, socket.SOL_TCP) return addrinfo_list, True, pauth @@ -276,7 +280,7 @@ auth_str = auth[0] if auth[1]: auth_str += ":" + auth[1] - encoded_str = base64encode(auth_str.encode()).strip().decode() + encoded_str = base64encode(auth_str.encode()).strip().decode().replace('\n', '') connect_header += "Proxy-Authorization: Basic %s\r\n" % encoded_str connect_header += "\r\n" dump("request header", connect_header) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.56.0/websocket/_logging.py new/websocket_client-0.57.0/websocket/_logging.py --- old/websocket_client-0.56.0/websocket/_logging.py 2018-08-14 08:32:34.000000000 +0200 +++ new/websocket_client-0.57.0/websocket/_logging.py 2019-12-25 13:09:50.000000000 +0100 @@ -34,7 +34,7 @@ _traceEnabled = False __all__ = ["enableTrace", "dump", "error", "warning", "debug", "trace", - "isEnabledForError", "isEnabledForDebug"] + "isEnabledForError", "isEnabledForDebug", "isEnabledForTrace"] def enableTrace(traceable, handler = logging.StreamHandler()): @@ -49,7 +49,6 @@ _logger.addHandler(handler) _logger.setLevel(logging.DEBUG) - def dump(title, message): if _traceEnabled: _logger.debug("--- " + title + " ---") @@ -80,3 +79,6 @@ def isEnabledForDebug(): return _logger.isEnabledFor(logging.DEBUG) + +def isEnabledForTrace(): + return _traceEnabled diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.56.0/websocket/_ssl_compat.py new/websocket_client-0.57.0/websocket/_ssl_compat.py --- old/websocket_client-0.56.0/websocket/_ssl_compat.py 2019-02-23 06:06:12.000000000 +0100 +++ new/websocket_client-0.57.0/websocket/_ssl_compat.py 2019-12-25 13:12:44.000000000 +0100 @@ -49,4 +49,6 @@ class SSLWantWriteError(Exception): pass + ssl = lambda: None + HAVE_SSL = False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.56.0/websocket/_url.py new/websocket_client-0.57.0/websocket/_url.py --- old/websocket_client-0.56.0/websocket/_url.py 2018-05-27 06:41:14.000000000 +0200 +++ new/websocket_client-0.57.0/websocket/_url.py 2019-12-25 13:35:57.000000000 +0100 @@ -103,7 +103,8 @@ def _is_no_proxy_host(hostname, no_proxy): if not no_proxy: v = os.environ.get("no_proxy", "").replace(" ", "") - no_proxy = v.split(",") + if v: + no_proxy = v.split(",") if not no_proxy: no_proxy = DEFAULT_NO_PROXY_HOST diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.56.0/websocket/_utils.py new/websocket_client-0.57.0/websocket/_utils.py --- old/websocket_client-0.56.0/websocket/_utils.py 2019-02-23 06:06:12.000000000 +0100 +++ new/websocket_client-0.57.0/websocket/_utils.py 2019-12-25 13:35:57.000000000 +0100 @@ -32,6 +32,7 @@ def __exit__(self, exc_type, exc_value, traceback): pass + try: # If wsaccel is available we use compiled routines to validate UTF-8 # strings. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.56.0/websocket_client.egg-info/PKG-INFO new/websocket_client-0.57.0/websocket_client.egg-info/PKG-INFO --- old/websocket_client-0.56.0/websocket_client.egg-info/PKG-INFO 2019-03-21 02:25:33.000000000 +0100 +++ new/websocket_client-0.57.0/websocket_client.egg-info/PKG-INFO 2019-12-25 13:46:52.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: websocket-client -Version: 0.56.0 +Version: 0.57.0 Summary: WebSocket client for Python. hybi13 is supported. Home-page: https://github.com/websocket-client/websocket-client.git Author: liris