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