Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix the Cookie header retrieval (it must use lower case, not upper ca…

…se for the header key)
  • Loading branch information...
commit 0f6d5d8091fad3d947fb5dc0d5255e06463b644a 1 parent f96eb8b
@avsm avsm authored
Showing with 6 additions and 5 deletions.
  1. +3 −2 CHANGES
  2. +2 −2 lib/cookie.ml
  3. +1 −1  lib_test/test_header.ml
View
5 CHANGES
@@ -1,5 +1,6 @@
-0.9.5 (2012-12-20)
-* Update to new mirage-net 0.5.0 API (based on cstruct 0.6.0)
+0.9.5 (trunk):
+* Fix cookie parsing to retrieve the correct header.
+* Update to `mirage-net` 0.5.0 API (based on cstruct 0.6.0).
0.9.4 (2012-12-19):
* Add Lwt `respond_redirect` and `respond_need_auth` helpers.
View
4 lib/cookie.ml
@@ -97,8 +97,8 @@ module Cookie_hdr = struct
| n :: [] -> (n, "")
| n :: v :: _ -> (n, v)
in (List.map split_pair cookies) @ acc
- ) [] (Header.get_multi hdr "Cookie")
+ ) [] (Header.get_multi hdr "cookie")
let serialize cookies =
- "Cookie", String.concat "; " (List.map (fun (k, v) -> k ^ "=" ^ v) cookies)
+ "cookie", String.concat "; " (List.map (fun (k, v) -> k ^ "=" ^ v) cookies)
end
View
2  lib_test/test_header.ml
@@ -38,7 +38,7 @@ let valid_set_cookie () =
let valid_cookie () =
let cookies = [ "foo", "bar"; "a", "b" ] in
let k, v = Cohttp.Cookie.Cookie_hdr.serialize cookies in
- assert_equal ~msg:"key" "Cookie" k;
+ assert_equal ~msg:"key" "cookie" k;
assert_equal ~msg:"value" "foo=bar; a=b" v;
let h = Cohttp.Header.of_list [ k, v ] in
let cookies = Cohttp.Cookie.Cookie_hdr.extract h in
Please sign in to comment.
Something went wrong with that request. Please try again.