You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/02/12 07:21:49 UTC

[17/50] [abbrv] mochiweb commit: updated refs/heads/import-master to 3a54dbf

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


Project: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/commit/94d827c9
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/tree/94d827c9
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/diff/94d827c9

Branch: refs/heads/import-master
Commit: 94d827c97080271724bba8caf818f809f02006c9
Parents: 295fa38
Author: Damien F. Katz <da...@apache.org>
Authored: Tue Aug 4 19:50:46 2009 +0000
Committer: Damien F. Katz <da...@apache.org>
Committed: Tue Aug 4 19:50:46 2009 +0000

----------------------------------------------------------------------
 mochiweb_cookies.erl | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/94d827c9/mochiweb_cookies.erl
----------------------------------------------------------------------
diff --git a/mochiweb_cookies.erl b/mochiweb_cookies.erl
index b9da37b..61711ff 100644
--- a/mochiweb_cookies.erl
+++ b/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)}.