diff options
| -rw-r--r-- | doc/config.md | 16 | ||||
| -rw-r--r-- | src/config/config.nim | 1 | ||||
| -rw-r--r-- | src/local/pager.nim | 3 | ||||
| -rw-r--r-- | src/types/cookie.nim | 23 |
4 files changed, 6 insertions, 37 deletions
diff --git a/doc/config.md b/doc/config.md index d3da51aa..05b075f5 100644 --- a/doc/config.md +++ b/doc/config.md @@ -175,8 +175,8 @@ JavaScript with `[[siteconf]]` instead of using this setting.</td> <td>Enable/disable cookies on sites.<br> In Chawan, each website gets a separate cookie jar, so websites relying on cross-site cookies may not work as expected. You may use the -`[[siteconf]]` "share-cookie-jar" and "third-party-cookie" settings to -adjust this behavior for specific sites.</td> +`[[siteconf]]` "share-cookie-jar" setting to adjust this behavior for +specific sites.</td> </tr> <tr> @@ -865,18 +865,6 @@ false for all websites.</td> </tr> <tr> -<td>third-party-cookie</td> -<td>array of regexes</td> -<td>n/a</td> -<td>Domains for which third-party cookies are allowed on this domain. -Only works for buffers which share the same cookie jar.<br> -Regexes are handled according to [match mode](#match-mode) rules.<br> -Note: in the past, this was required for first-party cookies from -subdomains, but this is no longer the case. `third-party-cookie` -declarations on subdomains have no effect.</td> -</tr> - -<tr> <td>share-cookie-jar</td> <td>host</td> <td>n/a</td> diff --git a/src/config/config.nim b/src/config/config.nim index 68725b77..690014b5 100644 --- a/src/config/config.nim +++ b/src/config/config.nim @@ -61,7 +61,6 @@ type host*: Option[Regex] rewrite_url*: Option[JSValueFunction] cookie*: Option[bool] - third_party_cookie*: seq[Regex] share_cookie_jar*: Option[string] referer_from*: Option[bool] scripting*: Option[ScriptingMode] diff --git a/src/local/pager.nim b/src/local/pager.nim index 2d5f7ec4..6123cec5 100644 --- a/src/local/pager.nim +++ b/src/local/pager.nim @@ -1848,8 +1848,7 @@ proc applySiteconf(pager: Pager; url: URL; charsetOverride: Charset; # host/url might have changed by now let jarid = sc.share_cookie_jar.get(url.host) if jarid notin pager.cookiejars: - pager.cookiejars[jarid] = newCookieJar(url, - sc.third_party_cookie) + pager.cookiejars[jarid] = newCookieJar(url) loaderConfig.cookieJar = pager.cookiejars[jarid] else: loaderConfig.cookieJar = nil # override diff --git a/src/types/cookie.nim b/src/types/cookie.nim index ac0f1b39..831d7464 100644 --- a/src/types/cookie.nim +++ b/src/types/cookie.nim @@ -2,7 +2,6 @@ import std/options import std/strutils import std/times -import monoucha/jsregex import types/opt import types/url import utils/twtstr @@ -20,7 +19,6 @@ type CookieJar* = ref object domain: string - allowHosts: seq[Regex] cookies*: seq[Cookie] proc parseCookieDate(val: string): Option[int64] = @@ -114,8 +112,6 @@ proc parseCookieDate(val: string): Option[int64] = proc `$`*(cookieJar: CookieJar): string = result &= $cookieJar.domain result &= ":\n" - for re in cookieJar.allowHosts: - result &= "third-party " & $re & '\n' for cookie in cookieJar.cookies: result &= "Cookie " result &= $cookie[] @@ -178,19 +174,9 @@ proc add(cookieJar: CookieJar; cookie: Cookie) = else: cookieJar.cookies.add(cookie) -proc match(cookieJar: CookieJar; url: URL): bool = - if cookieJar.domain.cookieDomainMatches(url): - return true - if cookieJar.allowHosts.len > 0: - let host = url.host - for re in cookieJar.allowHosts: - if re.match(host): - return true - return false - # https://www.rfc-editor.org/rfc/rfc6265#section-5.4 proc serialize*(cookieJar: CookieJar; url: URL): string = - if not cookieJar.match(url): + if not cookieJar.domain.cookieDomainMatches(url): return "" var res = "" let t = getTime().toUnix() @@ -258,11 +244,8 @@ proc parseCookie(str: string; t: int64; url: URL): Opt[Cookie] = cookie.path = defaultCookiePath(url) return ok(cookie) -proc newCookieJar*(url: URL; allowHosts: seq[Regex]): CookieJar = - return CookieJar( - domain: url.host, - allowHosts: allowHosts - ) +proc newCookieJar*(url: URL): CookieJar = + return CookieJar(domain: url.host) proc setCookie*(cookieJar: CookieJar; header: openArray[string]; url: URL) = let t = getTime().toUnix() |