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
1a4658fa
Commit
1a4658fa
authored
Oct 16, 2014
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
time to spin off a .h
parent
3a13424d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
100 additions
and
65 deletions
+100
-65
Makefile.am
src/Makefile.am
+2
-1
vmod_esicookies.c
src/vmod_esicookies.c
+2
-64
vmod_esicookies.h
src/vmod_esicookies.h
+96
-0
No files found.
src/Makefile.am
View file @
1a4658fa
...
...
@@ -13,7 +13,8 @@ libvmod_esicookies_la_LDFLAGS = $(AM_LDFLAGS) \
-module
-export-dynamic
-avoid-version
-shared
libvmod_esicookies_la_SOURCES
=
\
vmod_esicookies.c
vmod_esicookies.c
\
vmod_esicookies.h
nodist_libvmod_esicookies_la_SOURCES
=
\
vcc_if.c
\
...
...
src/vmod_esicookies.c
View file @
1a4658fa
...
...
@@ -33,6 +33,8 @@
*/
#include "config.h"
#include "vmod_esicookies.h"
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
...
...
@@ -40,7 +42,6 @@
#include <sys/resource.h>
#include "vrt.h"
#include "vct.h"
#include "cache.h"
#include "vcc_if.h"
#include "vas.h"
...
...
@@ -97,50 +98,12 @@ http_IsHdr(const txt *hh, const char *hdr)
}
#endif
/* ----------------------------------------------------------------------
* our own per-session workspaces for modifications of the http0 object.
*
* as long as we are sure to copy the Cookie header every time, we can always
* copy from ws[0] to ws[1]
*
*/
struct
vesico_req
{
unsigned
magic
;
#define VESICO_REQ_MAGIC 0x6874306d
struct
ws
ws
[
2
];
unsigned
xid
;
unsigned
short
next_ws
;
unsigned
warn
;
};
#define VESICO_WS_SIZE (4*1024)
struct
vesico_meta
{
unsigned
magic
;
#define VESICO_META_MAGIC 0x68746d6d
struct
vesico_req
*
mem
;
unsigned
nmem
;
};
/* return values */
#define VESICO_OK 0
#define VESICO_ERR_OVERFLOW (1<<0)
#define VESICO_ERR_LIM (1<<1)
const
char
*
const
vesico_err_str
[
VESICO_ERR_LIM
]
=
{
[
VESICO_OK
]
=
"ok"
,
[
VESICO_ERR_OVERFLOW
]
=
"exceeded number of allowed cookies"
};
/* warn member of vesico_req */
#define VESICO_WARN_SKIPPED (1<<0)
#define VESICO_WARN_TOLERATED (1<<1)
#define VESICO_WARN_LIM (1<<2)
const
char
*
const
vesico_warn_str
[
VESICO_WARN_LIM
]
=
{
[
VESICO_OK
]
=
"ok"
,
[
VESICO_WARN_SKIPPED
]
=
...
...
@@ -283,25 +246,6 @@ vesico_get_mem(struct sess *sp, struct vesico_req *m) {
return
(
ws
);
};
struct
cookie
{
VSTAILQ_ENTRY
(
cookie
)
list
;
txt
name
;
txt
value
;
int
valid
;
};
VSTAILQ_HEAD
(
cookiehead
,
cookie
);
/*
* http://webdesign.about.com/od/cookies/f/cookies-per-domain-limit.htm
* Chrome 9 allowed 180 cookies per domain
*/
#define max_cookies 180
struct
cookies
{
struct
cookie
space
[
max_cookies
];
int
used
;
};
static
struct
cookie
*
vesico_cookie_lookup
(
struct
cookiehead
*
cookies
,
const
txt
name
)
{
struct
cookie
*
c
;
...
...
@@ -454,12 +398,6 @@ 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
,
...
...
src/vmod_esicookies.h
0 → 100644
View file @
1a4658fa
/*-
* Copyright (c) 2013-2014 UPLEX Nils Goroll Systemoptimierung
* All rights reserved
*
* Author: Nils Goroll <nils.goroll@uplex.de>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#include "config.h"
#include "cache.h"
/* ----------------------------------------------------------------------
* our own per-session workspaces for modifications of the http0 object.
*
* as long as we are sure to copy the Cookie header every time, we can always
* copy from ws[0] to ws[1]
*
*/
struct
vesico_req
{
unsigned
magic
;
#define VESICO_REQ_MAGIC 0x6874306d
struct
ws
ws
[
2
];
unsigned
xid
;
unsigned
short
next_ws
;
unsigned
warn
;
};
#define VESICO_WS_SIZE (4*1024)
struct
vesico_meta
{
unsigned
magic
;
#define VESICO_META_MAGIC 0x68746d6d
struct
vesico_req
*
mem
;
unsigned
nmem
;
};
/* return values */
#define VESICO_OK 0
#define VESICO_ERR_OVERFLOW (1<<0)
#define VESICO_ERR_LIM (1<<1)
/* warn member of vesico_req */
#define VESICO_WARN_SKIPPED (1<<0)
#define VESICO_WARN_TOLERATED (1<<1)
#define VESICO_WARN_LIM (1<<2)
struct
cookie
{
VSTAILQ_ENTRY
(
cookie
)
list
;
txt
name
;
txt
value
;
int
valid
;
};
VSTAILQ_HEAD
(
cookiehead
,
cookie
);
/*
* http://webdesign.about.com/od/cookies/f/cookies-per-domain-limit.htm
* Chrome 9 allowed 180 cookies per domain
*/
#define max_cookies 180
struct
cookies
{
struct
cookie
space
[
max_cookies
];
int
used
;
};
enum
vesico_analyze_action
{
VESICOAC_DEL
=
0
,
VESICOAC_ADD
,
_VESICOAC_LIM
};
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