From 8e2215ee6306b0f4c13553796d401e9f5f93bcb6 Mon Sep 17 00:00:00 2001 From: "Damien F. Katz" Date: Tue, 4 Aug 2009 19:50:46 +0000 Subject: Initial check-in of OAuth and cookie authentication. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@800938 13f79535-47bb-0310-9956-ffa450edef68 --- src/mochiweb/mochiweb_cookies.erl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/mochiweb/mochiweb_cookies.erl') diff --git a/src/mochiweb/mochiweb_cookies.erl b/src/mochiweb/mochiweb_cookies.erl index b9da37b4..61711ff0 100644 --- a/src/mochiweb/mochiweb_cookies.erl +++ b/src/mochiweb/mochiweb_cookies.erl @@ -32,7 +32,7 @@ cookie(Key, Value) -> %% @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 @@ cookie(Key, Value, Options) -> 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)}. -- cgit v1.2.3