Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-esicookies
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-esicookies
Commits
3a13424d
Commit
3a13424d
authored
Oct 16, 2014
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
introduce action argument to add or delete cookies
parent
c7730816
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
8 deletions
+23
-8
vmod_esicookies.c
src/vmod_esicookies.c
+23
-8
No files found.
src/vmod_esicookies.c
View file @
3a13424d
...
...
@@ -454,14 +454,24 @@ vesico_warn(struct sess *sp, struct vesico_req *m,
"%*s^- %s"
,
off
,
""
,
warn
);
}
enum
vesico_analyze_action
{
VESICOAC_DEL
=
0
,
VESICOAC_ADD
,
_VESICOAC_LIM
};
static
int
vesico_analyze_cookie_header
(
struct
sess
*
sp
,
struct
vesico_req
*
m
,
const
txt
hdr
,
struct
cookiehead
*
cookies
,
struct
cookies
*
cs
)
{
struct
cookies
*
cs
,
enum
vesico_analyze_action
act
)
{
txt
work1
,
elem
,
name
,
value
;
struct
cookie
*
c
,
*
c2
;
unsigned
ret
=
VESICO_OK
;
assert
(
act
>=
0
);
assert
(
act
<
_VESICOAC_LIM
);
work1
.
b
=
hdr
.
b
;
work1
.
e
=
hdr
.
e
;
...
...
@@ -498,6 +508,16 @@ vesico_analyze_cookie_header(struct sess *sp, struct vesico_req *m,
return
(
ret
);
}
/* invalidate any previous cookies with this name */
c2
=
vesico_cookie_lookup
(
cookies
,
name
);
if
(
c2
)
c2
->
valid
=
0
;
if
(
act
==
VESICOAC_DEL
)
continue
;
assert
(
act
==
VESICOAC_ADD
);
c
=
&
cs
->
space
[
cs
->
used
++
];
c
->
valid
=
0
;
...
...
@@ -527,11 +547,6 @@ vesico_analyze_cookie_header(struct sess *sp, struct vesico_req *m,
c
->
value
.
b
=
value
.
b
;
c
->
value
.
e
=
value
.
e
;
/* check if seen before and, if yes, make that one invalid */
c2
=
vesico_cookie_lookup
(
cookies
,
c
->
name
);
if
(
c2
)
c2
->
valid
=
0
;
c
->
valid
=
1
;
VSTAILQ_INSERT_TAIL
(
cookies
,
c
,
list
);
}
...
...
@@ -660,7 +675,7 @@ vesico_to_http0(struct sess *sp, struct vmod_priv *priv, enum gethdr_e where,
h
.
e
=
h0
->
hd
[
n
].
e
;
ret
=
vesico_analyze_cookie_header
(
sp
,
m
,
h
,
&
cookies
,
&
cs
);
&
cs
,
VESICOAC_ADD
);
if
(
ret
!=
VESICO_OK
)
return
(
vesico_err_str
[
ret
]);
}
...
...
@@ -687,7 +702,7 @@ vesico_to_http0(struct sess *sp, struct vmod_priv *priv, enum gethdr_e where,
h
.
e
=
hp
->
hd
[
n
].
e
;
ret
=
vesico_analyze_cookie_header
(
sp
,
m
,
h
,
&
cookies
,
&
cs
);
&
cs
,
VESICOAC_ADD
);
if
(
ret
!=
VESICO_OK
)
return
(
vesico_err_str
[
ret
]);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment