Hi Paul,

The diff below is already in upstream (r100) as I wrote that one myself :-)

On 11 Aug 2009, at 06:36, Paul Davis wrote:

diff -wur mochiweb/src/mochiweb_cookies.erl cmw/mochiweb_cookies.erl
--- mochiweb/src/mochiweb_cookies.erl 2009-08-11 00:26:17.000000000 -0400
+++ cmw/mochiweb_cookies.erl    2009-08-11 00:23:31.000000000 -0400
@@ -32,7 +32,7 @@
%% @spec cookie(Key::string(), Value::string(), Options::[Option]) - > header() %% where Option = {max_age, integer()} | {local_time, {date(), time()}}
%%                | {domain, string()} | {path, string()}
-%%                | {secure, true | false}
+%% | {secure, true | false} | {http_only, true | false}
%%
%% @doc Generate a Set-Cookie header field tuple.
cookie(Key, Value, Options) ->
@@ -83,7 +83,14 @@
            Path ->
                ["; Path=", quote(Path)]
        end,
- CookieParts = [Cookie, ExpiresPart, SecurePart, DomainPart, PathPart],
+    HttpOnlyPart =
+        case proplists:get_value(http_only, Options) of
+            true ->
+                "; HttpOnly";
+            _ ->
+                ""
+        end,
+    CookieParts = [Cookie, ExpiresPart, SecurePart, DomainPart,
PathPart, HttpOnlyPart],
    {"Set-Cookie", lists:flatten(CookieParts)}.

    test_quote_plus(),


Thanks,
--
Jason Davies

www.jasondavies.com

Reply via email to