-
-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: https://xpra.org/svn/Xpra/trunk@27604 3bb7dfac-3a0b-4e04-842a-767bc560f471
- Loading branch information
Showing
6 changed files
with
90 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This file is part of Xpra. | ||
# Copyright (C) 2020 Antoine Martin <[email protected]> | ||
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any | ||
# later version. See the file COPYING for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# This file is part of Xpra. | ||
# Copyright (C) 2020 mjharkin | ||
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any | ||
# later version. See the file COPYING for details. | ||
|
||
import browser_cookie3 | ||
|
||
from xpra.os_util import strtobytes | ||
|
||
|
||
def get_headers(host, port): #pylint: disable=unused-argument | ||
headers = {} | ||
cookie_domain = host | ||
cookie_string = '' | ||
# get cookies for domain and all parent domains except tld | ||
while cookie_domain.count('.', 2): | ||
cj = browser_cookie3.load(domain_name=cookie_domain) | ||
for c in cj: | ||
cookie = c.name + "=" + c.value + "; " | ||
# add if cookie doesn't already exist from subdomain | ||
if not c.name + "=" in cookie_string: | ||
cookie_string += cookie | ||
cookie_domain = cookie_domain.split('.', 1)[1] | ||
headers[b"Cookie"] = strtobytes(cookie_string) | ||
return headers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# This file is part of Xpra. | ||
# Copyright (C) 2019-2020 Antoine Martin <[email protected]> | ||
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any | ||
# later version. See the file COPYING for details. | ||
|
||
|
||
from xpra.os_util import strtobytes | ||
|
||
HEADERS = { | ||
b"Connection" : b"Upgrade", | ||
b"Upgrade" : b"websocket", | ||
b"Sec-WebSocket-Version" : b"13", | ||
b"Sec-WebSocket-Protocol" : b"binary", | ||
} | ||
|
||
|
||
def get_headers(host, port): | ||
headers = HEADERS.copy() | ||
if host: | ||
headers[b"Host"] = strtobytes("%s:%s" % (host, port)) | ||
return headers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# This file is part of Xpra. | ||
# Copyright (C) 2020 Antoine Martin <[email protected]> | ||
# Copyright (C) 2020 mjharkin | ||
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any | ||
# later version. See the file COPYING for details. | ||
|
||
import os | ||
|
||
from xpra.os_util import strtobytes | ||
|
||
|
||
def get_headers(host, port): #pylint: disable=unused-argument | ||
headers = {} | ||
if "XPRA_WS_COOKIE" in os.environ: | ||
headers[b"Cookie"] = strtobytes(os.environ['XPRA_WS_COOKIE']) | ||
return headers |