unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / Atom feed
From: Lars-Dominik Braun <lars@6xq.net>
To: 44036@debbugs.gnu.org
Subject: [bug#44036] [PATCH] Fix xpra HTML server
Date: Fri, 16 Oct 2020 19:17:53 +0200
Message-ID: <20201016171753.GB1315@noor.fritz.box> (raw)

[-- Attachment #1: Type: text/plain, Size: 410 bytes --]

Hi,

version 4.0.4 of xpra broke the builtin HTML server, causing
``--html=on`` to display the following error message:

2020-10-16 12:31:01,810 Error: cannot import websocket connection handler:
2020-10-16 12:31:01,810  No module named 'requests'
2020-10-16 12:31:01,810  the html server will not be available

The attached patch applies an upstream fix, until upstream releases a
new version.

Cheers,
Lars


[-- Attachment #2: 0001-gnu-xpra-Fix-HTML-server.patch --]
[-- Type: text/x-diff, Size: 3699 bytes --]

From a033826b12bd06e523dbe06ad23e6cc62ca18ed6 Mon Sep 17 00:00:00 2001
From: Lars-Dominik Braun <lars@6xq.net>
Date: Fri, 16 Oct 2020 19:15:41 +0200
Subject: [PATCH] gnu: xpra: Fix HTML server

* gnu/packages/patches/xpra-4.0.4-norequests.patch: Add file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/xorg.scm (xpra)[patches]: Apply it.
---
 gnu/local.mk                                  |  1 +
 .../patches/xpra-4.0.4-norequests.patch       | 39 +++++++++++++++++++
 gnu/packages/xorg.scm                         |  3 +-
 3 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/xpra-4.0.4-norequests.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index d41b65957e..111206f34e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1705,6 +1705,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/xplanet-1.3.1-libimage_gif.c.patch	\
   %D%/packages/patches/xplanet-1.3.1-xpUtil-Add2017LeapSecond.cpp.patch	\
   %D%/packages/patches/xpra-4.0.1-systemd-run.patch	\
+  %D%/packages/patches/xpra-4.0.4-norequests.patch	\
   %D%/packages/patches/xsane-fix-memory-leak.patch		\
   %D%/packages/patches/xsane-fix-pdf-floats.patch		\
   %D%/packages/patches/xsane-fix-snprintf-buffer-length.patch	\
diff --git a/gnu/packages/patches/xpra-4.0.4-norequests.patch b/gnu/packages/patches/xpra-4.0.4-norequests.patch
new file mode 100644
index 0000000000..e545be7f1d
--- /dev/null
+++ b/gnu/packages/patches/xpra-4.0.4-norequests.patch
@@ -0,0 +1,39 @@
+Remove python-requests dependency, r27626 upstream.
+
+--- a/xpra/net/websockets/common.py	(revision 27625)
++++ b/xpra/net/websockets/common.py	(revision 27626)
+@@ -7,7 +7,6 @@
+ import uuid
+ from hashlib import sha1
+ from base64 import b64encode
+-from requests.structures import CaseInsensitiveDict
+ 
+ from xpra.os_util import strtobytes, bytestostr, monotonic_time
+ from xpra.log import Logger
+@@ -77,7 +76,7 @@
+     for line in lines:
+         parts = line.split(b": ", 1)
+         if len(parts)==2:
+-            headers[parts[0]] = parts[1]
++            headers[parts[0].lower()] = parts[1]
+     return headers
+ 
+ def verify_response_headers(headers, key):
+@@ -84,14 +83,13 @@
+     log("verify_response_headers(%s)", headers)
+     if not headers:
+         raise Exception("no http headers found in response")
+-    headers = CaseInsensitiveDict(headers)
+-    upgrade = headers.get(b"Upgrade", b"")
++    upgrade = headers.get(b"upgrade", b"")
+     if upgrade!=b"websocket":
+         raise Exception("invalid http upgrade: '%s'" % upgrade)
+-    protocol = headers.get(b"Sec-WebSocket-Protocol", b"")
++    protocol = headers.get(b"sec-websocket-protocol", b"")
+     if protocol!=b"binary":
+         raise Exception("invalid websocket protocol: '%s'" % protocol)
+-    accept_key = headers.get(b"Sec-WebSocket-Accept", b"")
++    accept_key = headers.get(b"sec-websocket-accept", b"")
+     if not accept_key:
+         raise Exception("websocket accept key is missing")
+     expected_key = make_websocket_accept_hash(key)
diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm
index 0eda94bc47..e912eb1be9 100644
--- a/gnu/packages/xorg.scm
+++ b/gnu/packages/xorg.scm
@@ -6312,7 +6312,8 @@ basic eye-candy effects.")
                            version ".tar.xz"))
        (sha256
         (base32 "10alqdfmgml9ixdi1nyd9xlw8a5q0j8m2sv4g9p83pd6z1a0rpv2"))
-       (patches (search-patches "xpra-4.0.1-systemd-run.patch"))))
+       (patches (search-patches "xpra-4.0.1-systemd-run.patch"
+                                "xpra-4.0.4-norequests.patch"))))
     (build-system python-build-system)
     ;; see also http://xpra.org/trac/wiki/Dependencies
     (inputs `(
-- 
2.26.2


             reply	other threads:[~2020-10-16 17:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-16 17:17 Lars-Dominik Braun [this message]
2020-10-17 20:23 ` bug#44036: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201016171753.GB1315@noor.fritz.box \
    --to=lars@6xq.net \
    --cc=44036@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

unofficial mirror of guix-patches@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix-patches/1 guix-patches/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-patches guix-patches/ https://yhetil.org/guix-patches \
		guix-patches@gnu.org
	public-inbox-index guix-patches

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.patches


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git