summaryrefslogtreecommitdiff
path: root/src/c
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-11-08 12:12:50 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-11-08 12:12:50 -0500
commit7d6eed032a2b129056ff264a91076cec68035a34 (patch)
tree3e0286912dbc8c2cd57c2f90fa095b82429434bc /src/c
parentdbf4d428936189bba18ffb1d622029c79da39414 (diff)
Handle EError returning a function; handle multiple cookies in one input header
Diffstat (limited to 'src/c')
-rw-r--r--src/c/urweb.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c
index e8c75275..57584f53 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -1193,9 +1193,21 @@ uw_Basis_string uw_Basis_get_cookie(uw_context ctx, uw_Basis_string c) {
}
while (p = strchr(s, ':')) {
- if (!strncasecmp(s, "Cookie: ", 8) && !strncmp(p + 2, c, len)
- && p + 2 + len < ctx->headers_end && p[2 + len] == '=') {
- return p + 3 + len;
+ if (!strncasecmp(s, "Cookie: ", 8)) {
+ p += 2;
+ while (1) {
+ if (!strncmp(p, c, len)
+ && p + len < ctx->headers_end && p[len] == '=')
+ return p + 1 + len;
+ else if (p = strchr(p, ';'))
+ p += 2;
+ else if ((s = strchr(s, 0)) && s < ctx->headers_end) {
+ s += 2;
+ break;
+ }
+ else
+ return NULL;
+ }
} else {
if ((s = strchr(p, 0)) && s < ctx->headers_end)
s += 2;