From 180ce23aba863d94c17ee0667cad1ed916f56da1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 6 May 2022 14:23:33 +0200 Subject: Update cookie tests against latest WPT The http-state tests were removed and replaced with tests in HTML pages. I have devised a way to semi- automatically import them and test them. Additional fixes were made following changes in the rfc6265bis draft. --- src/gun_cookies.erl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gun_cookies.erl b/src/gun_cookies.erl index f44ae42..984e491 100644 --- a/src/gun_cookies.erl +++ b/src/gun_cookies.erl @@ -185,6 +185,8 @@ session_gc({Mod, State0}) -> %% @todo The given URI must be normalized. -spec set_cookie(Store, uri_string:uri_map(), binary(), binary(), cow_cookie:cookie_attrs()) -> {ok, Store} | {error, any()} when Store::store(). +set_cookie(_, _, Name, Value, _) when byte_size(Name) + byte_size(Value) > 4096 -> + {error, larger_than_4096_bytes}; set_cookie(Store, URI=#{host := Host}, Name, Value, Attrs) -> %% This is where we would add a feature to block cookies (like a blacklist). CurrentTime = erlang:universaltime(), -- cgit v1.2.3