diff options
-rw-r--r-- | src/cow_http_hd.erl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cow_http_hd.erl b/src/cow_http_hd.erl index 6a45fe1..848b8c9 100644 --- a/src/cow_http_hd.erl +++ b/src/cow_http_hd.erl @@ -39,6 +39,7 @@ -export([parse_if_unmodified_since/1]). -export([parse_last_modified/1]). -export([parse_max_forwards/1]). +-export([parse_pragma/1]). -export([parse_range/1]). -export([parse_retry_after/1]). -export([parse_sec_websocket_accept/1]). @@ -2052,6 +2053,19 @@ parse_max_forwards_error_test_() -> [{V, fun() -> {'EXIT', _} = (catch parse_max_forwards(V)) end} || V <- Tests]. -endif. +%% @doc Parse the Pragma header. +%% +%% Legacy header kept for backward compatibility with HTTP/1.0 caches. +%% Only the "no-cache" directive was ever specified, and only for +%% request messages. +%% +%% We take a large shortcut in the parsing of this header, expecting +%% an exact match of "no-cache". + +-spec parse_pragma(binary()) -> cache | no_cache. +parse_pragma(<<"no-cache">>) -> no_cache; +parse_pragma(_) -> cache. + %% @doc Parse the Range header. -spec parse_range(binary()) |