Blob Blame History Raw
From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= <essen@ninenines.eu>
Date: Sat, 12 Mar 2016 18:21:39 +0100
Subject: [PATCH] Add cow_http_hd:parse_http2_settings/1

No tests or benchmarks, we just call base64:decode on the value.

diff --git a/src/cow_http_hd.erl b/src/cow_http_hd.erl
index e47d80d..e6c4524 100644
--- a/src/cow_http_hd.erl
+++ b/src/cow_http_hd.erl
@@ -56,7 +56,7 @@
 % @todo -export([parse_forwarded/1]). RFC7239
 % @todo -export([parse_from/1]). RFC7231
 -export([parse_host/1]).
-% @todo -export([parse_http2_settings/1]). HTTP/2 (upcoming)
+-export([parse_http2_settings/1]).
 -export([parse_if_match/1]).
 -export([parse_if_modified_since/1]).
 -export([parse_if_none_match/1]).
@@ -1885,6 +1885,12 @@ horse_parse_host_ipv6_v4() ->
 	).
 -endif.
 
+%% @doc Parse the HTTP2-Settings header.
+
+-spec parse_http2_settings(binary()) -> binary().
+parse_http2_settings(HTTP2Settings) ->
+	base64:decode(HTTP2Settings).
+
 %% @doc Parse the If-Match header.
 
 -spec parse_if_match(binary()) -> '*' | [etag()].