From 7ce8209ed0d28ea10b4d83fec8335c5b6e622ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 25 Apr 2018 16:48:02 +0200 Subject: Prevent the HPACK configured_max_size from being dropped --- src/cow_hpack.erl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/cow_hpack.erl b/src/cow_hpack.erl index 9583926..c2c732d 100644 --- a/src/cow_hpack.erl +++ b/src/cow_hpack.erl @@ -575,7 +575,7 @@ table_update_decode_test() -> {<<"date">>, <<"Mon, 21 Oct 2013 20:13:21 GMT">>}, {<<"location">>, <<"https://www.example.com">>} ], - #state{size=222, dyn_table=[ + #state{size=222, configured_max_size=256, dyn_table=[ {63,{<<"location">>, <<"https://www.example.com">>}}, {65,{<<"date">>, <<"Mon, 21 Oct 2013 20:13:21 GMT">>}}, {52,{<<"cache-control">>, <<"private">>}}, @@ -596,7 +596,7 @@ table_update_decode_test() -> {<<"date">>, <<"Mon, 21 Oct 2013 20:13:21 GMT">>}, {<<"location">>, <<"https://www.example.com">>} ], - #state{size=264, dyn_table=[ + #state{size=264, configured_max_size=512, dyn_table=[ {42,{<<":status">>, <<"307">>}}, {63,{<<"location">>, <<"https://www.example.com">>}}, {65,{<<"date">>, <<"Mon, 21 Oct 2013 20:13:21 GMT">>}}, @@ -617,7 +617,7 @@ table_update_decode_smaller_test() -> {<<"date">>, <<"Mon, 21 Oct 2013 20:13:21 GMT">>}, {<<"location">>, <<"https://www.example.com">>} ], - #state{size=222, dyn_table=[ + #state{size=222, configured_max_size=256, dyn_table=[ {63,{<<"location">>, <<"https://www.example.com">>}}, {65,{<<"date">>, <<"Mon, 21 Oct 2013 20:13:21 GMT">>}}, {52,{<<"cache-control">>, <<"private">>}}, @@ -638,7 +638,7 @@ table_update_decode_smaller_test() -> {<<"date">>, <<"Mon, 21 Oct 2013 20:13:21 GMT">>}, {<<"location">>, <<"https://www.example.com">>} ], - #state{size=264, dyn_table=[ + #state{size=264, configured_max_size=512, dyn_table=[ {42,{<<":status">>, <<"307">>}}, {63,{<<"location">>, <<"https://www.example.com">>}}, {65,{<<"date">>, <<"Mon, 21 Oct 2013 20:13:21 GMT">>}}, @@ -659,7 +659,7 @@ table_update_decode_too_large_test() -> {<<"date">>, <<"Mon, 21 Oct 2013 20:13:21 GMT">>}, {<<"location">>, <<"https://www.example.com">>} ], - #state{size=222, dyn_table=[ + #state{size=222, configured_max_size=256, dyn_table=[ {63,{<<"location">>, <<"https://www.example.com">>}}, {65,{<<"date">>, <<"Mon, 21 Oct 2013 20:13:21 GMT">>}}, {52,{<<"cache-control">>, <<"private">>}}, @@ -687,7 +687,7 @@ table_update_decode_zero_test() -> {<<"date">>, <<"Mon, 21 Oct 2013 20:13:21 GMT">>}, {<<"location">>, <<"https://www.example.com">>} ], - #state{size=222, dyn_table=[ + #state{size=222, configured_max_size=256, dyn_table=[ {63,{<<"location">>, <<"https://www.example.com">>}}, {65,{<<"date">>, <<"Mon, 21 Oct 2013 20:13:21 GMT">>}}, {52,{<<"cache-control">>, <<"private">>}}, @@ -706,7 +706,7 @@ table_update_decode_zero_test() -> <<2#00100000, 2#00111111>>, MaxSize, <<16#488264025885aec3771a4b6196d07abe941054d444a8200595040b8166e082a62d1bff6e919d29ad171863c78f0b97c8e9ae82ae43d3:432>>]), State2), - #state{size=222, dyn_table=[ + #state{size=222, configured_max_size=512, dyn_table=[ {63,{<<"location">>, <<"https://www.example.com">>}}, {65,{<<"date">>, <<"Mon, 21 Oct 2013 20:13:21 GMT">>}}, {52,{<<"cache-control">>, <<"private">>}}, @@ -1170,12 +1170,12 @@ table_update_encode_test() -> ], {Encoded1, EncState1} = encode(Headers1, EncState0), {Headers1, DecState1} = decode(iolist_to_binary(Encoded1), DecState0), - #state{size=222, dyn_table=[ + #state{size=222, configured_max_size=256, dyn_table=[ {63,{<<"location">>, <<"https://www.example.com">>}}, {65,{<<"date">>, <<"Mon, 21 Oct 2013 20:13:21 GMT">>}}, {52,{<<"cache-control">>, <<"private">>}}, {42,{<<":status">>, <<"302">>}}]} = DecState1, - #state{size=222, dyn_table=[ + #state{size=222, configured_max_size=256, dyn_table=[ {63,{<<"location">>, <<"https://www.example.com">>}}, {65,{<<"date">>, <<"Mon, 21 Oct 2013 20:13:21 GMT">>}}, {52,{<<"cache-control">>, <<"private">>}}, @@ -1512,9 +1512,9 @@ table_update_size(0, State) -> State#state{size=0, max_size=0, dyn_table=[]}; table_update_size(MaxSize, State=#state{max_size=MaxSize}) -> State; -table_update_size(MaxSize, #state{dyn_table=DynTable}) -> +table_update_size(MaxSize, State=#state{dyn_table=DynTable}) -> {DynTable2, Size} = table_resize(DynTable, MaxSize, 0, []), - #state{size=Size, max_size=MaxSize, dyn_table=DynTable2}. + State#state{size=Size, max_size=MaxSize, dyn_table=DynTable2}. -ifdef(TEST). prop_str_raw() -> -- cgit v1.2.3