-
Notifications
You must be signed in to change notification settings - Fork 183
Cookie extraction should use case-insensitive comparison for headers #855
Copy link
Copy link
Closed
Labels
Description
The HTTP headers are not always lower cased. For instance, when working with the mediawiki Docker container I'm getting a Set-Cookie field instead of set-cookie, which Cohttp.Cookie.Set_cookie_hdr.extract assumes, and this makes a difference:
utop # #require "cohttp";;
utop # Cohttp.Header.of_list ["set-cookie", "my_wiki_session=bq02atpavmnv00b2mn6j62sc5li43cu3; path=/; HttpOnly"] |> Cohttp.Cookie.Set_cookie_hdr.extract;;
- : (string * Cohttp.Cookie.Set_cookie_hdr.t) list =
[("my_wiki_session",
{Cohttp.Cookie.Set_cookie_hdr.cookie =
("my_wiki_session", "bq02atpavmnv00b2mn6j62sc5li43cu3");
expiration = `Session; domain = None; path = Some "/"; secure = false;
http_only = true})]
utop # Cohttp.Header.of_list ["Set-Cookie", "my_wiki_session=bq02atpavmnv00b2mn6j62sc5li43cu3; path=/; HttpOnly"] |> Cohttp.Cookie.Set_cookie_hdr.extract;;
- : (string * Cohttp.Cookie.Set_cookie_hdr.t) list = []I am thinking it could be passed through String.lowercase_ascii, but I'm not sure if the best place would be when parsed, on-demand in the iterators, or on the consumer side (in exctract).
I'm using Cohttp 5.0.0.
Reactions are currently unavailable