| 1 |
= cow_cookie:parse_set_cookie(3) |
| 2 |
|
| 3 |
== Name |
| 4 |
|
| 5 |
cow_cookie:parse_set_cookie - Parse a set-cookie header |
| 6 |
|
| 7 |
== Description |
| 8 |
|
| 9 |
[source,erlang] |
| 10 |
---- |
| 11 |
parse_set_cookie(SetCookie :: binary()) |
| 12 |
-> {ok, Name, Value, Attrs} | ignore |
| 13 |
|
| 14 |
Name :: binary() |
| 15 |
Value :: binary() |
| 16 |
Attrs :: cow_cookie:cookie_attrs() |
| 17 |
---- |
| 18 |
|
| 19 |
Parse a set-cookie header. |
| 20 |
|
| 21 |
== Arguments |
| 22 |
|
| 23 |
SetCookie:: |
| 24 |
|
| 25 |
The set-cookie header value. |
| 26 |
|
| 27 |
== Return value |
| 28 |
|
| 29 |
An `ok` tuple with the cookie name, value and attributes |
| 30 |
is returned on success. |
| 31 |
|
| 32 |
An atom `ignore` is returned when the cookie has both |
| 33 |
an empty name and an empty value, and must be ignored. |
| 34 |
|
| 35 |
== Changelog |
| 36 |
|
| 37 |
* *2.9*: Function introduced. |
| 38 |
|
| 39 |
== Examples |
| 40 |
|
| 41 |
.Parse a cookie header |
| 42 |
[source,erlang] |
| 43 |
---- |
| 44 |
case cow_cookie:parse_set_cookie(SetCookieHd) of |
| 45 |
{ok, Name, Value, Attrs} -> |
| 46 |
cookie_engine_set_cookie(Name, Value, Attrs); |
| 47 |
ignore -> |
| 48 |
do_nothing() |
| 49 |
end. |
| 50 |
---- |
| 51 |
|
| 52 |
== See also |
| 53 |
|
| 54 |
link:man:cow_cookie(3)[cow_cookie(3)], |
| 55 |
link:man:cow_cookie:parse_cookie(3)[cow_cookie:parse_cookie(3)], |
| 56 |
link:man:cow_cookie:cookie(3)[cow_cookie:cookie(3)], |
| 57 |
link:man:cow_cookie:setcookie(3)[cow_cookie:setcookie(3)] |