[Webkit-unassigned] [Bug 182328] New: [SOUP] Ensure domain is valid when converting a WebCore Cookie to Soup
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Jan 31 03:13:09 PST 2018
https://bugs.webkit.org/show_bug.cgi?id=182328
Bug ID: 182328
Summary: [SOUP] Ensure domain is valid when converting a
WebCore Cookie to Soup
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Keywords: Soup
Severity: Normal
Priority: P2
Component: Platform
Assignee: webkit-unassigned at lists.webkit.org
Reporter: cgarcia at igalia.com
CC: bburg at apple.com, bugs-noreply at webkitgtk.org,
clopez at igalia.com
soup_cookie_parse() adds the initial '.' to the domain if missing before creating the SoupCookie, but soup_cookie_new() allows for domain to be a hostname that needs to match exactly. When converting a WebCore Cookie into a SoupCookie we always want the domain to be considered as such and not as a hostname, so we need to prepend the '.' if missing. This is causing a WebDriver test to fail:
___________________________________________________________________________________ test_add_domain_cookie ___________________________________________________________________________________
session = <webdriver.client.Session object at 0x7fbf6c169dd0>, url = <function url at 0x7fbf6c183140>
server_config = {'domains': {'': 'localhost'}, 'host': 'localhost', 'ports': {'http': ['8802']}}
def test_add_domain_cookie(session, url, server_config):
session.url = url("/common/blank.html")
clear_all_cookies(session)
create_cookie_request = {
"cookie": {
"name": "hello",
"value": "world",
"domain": server_config["domains"][""],
"path": "/",
"httpOnly": False,
"secure": False
}
}
result = session.transport.send("POST", "session/%s/cookie" % session.session_id, create_cookie_request)
assert result.status == 200
assert "value" in result.body
assert result.body["value"] is None
result = session.transport.send("GET", "session/%s/cookie" % session.session_id)
assert result.status == 200
assert "value" in result.body
assert isinstance(result.body["value"], list)
assert len(result.body["value"]) == 1
assert isinstance(result.body["value"][0], dict)
cookie = result.body["value"][0]
assert "name" in cookie
assert isinstance(cookie["name"], basestring)
assert "value" in cookie
assert isinstance(cookie["value"], basestring)
assert "domain" in cookie
assert isinstance(cookie["domain"], basestring)
assert cookie["name"] == "hello"
assert cookie["value"] == "world"
> assert cookie["domain"] == ".%s" % server_config["domains"][""]
E AssertionError: assert 'localhost' == '.localhost'
E - localhost
E + .localhost
E ? +
cookie = {'domain': 'localhost', 'httpOnly': False, 'name': 'hello', 'path': '/', ...}
create_cookie_request = {'cookie': {'domain': 'localhost', 'httpOnly': False, 'name': 'hello', 'path': '/', ...}}
result = <Responsetatus=200 body={"value": [{"domain": "localhost", "name": "hello", "value": "world", "path": "/", "httpOnly": false, "secure": false}]}>
server_config = {'domains': {'': 'localhost'}, 'host': 'localhost', 'ports': {'http': ['8802']}}
session = <webdriver.client.Session object at 0x7fbf6c169dd0>
url = <function url at 0x7fbf6c183140>
WebDriverTests/imported/w3c/webdriver/tests/cookies/add_cookie.py:39: AssertionError
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180131/fd19e90d/attachment-0001.html>
More information about the webkit-unassigned
mailing list