|
|
@ -29,7 +29,9 @@ |
|
|
#include "http/header.h" |
|
|
#include "http/header.h" |
|
|
#include "http/parser.h" |
|
|
#include "http/parser.h" |
|
|
#include "http/message.h" |
|
|
#include "http/message.h" |
|
|
|
|
|
#include "http/request.h" |
|
|
#include "hash.h" |
|
|
#include "hash.h" |
|
|
|
|
|
#include "hash_value.h" |
|
|
|
|
|
|
|
|
#define MAX(x,y) ((x) > (y) ? (x) : (y)) |
|
|
#define MAX(x,y) ((x) > (y) ? (x) : (y)) |
|
|
|
|
|
|
|
|
@ -67,6 +69,42 @@ httpParserHeader( |
|
|
current->dbody = 0; |
|
|
current->dbody = 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (0 == strncasecmp("cookie", name, nname-1)) { |
|
|
|
|
|
HttpRequest request = (HttpRequest)this->current; |
|
|
|
|
|
char * pair = value; |
|
|
|
|
|
size_t togo = lend - value; |
|
|
|
|
|
|
|
|
|
|
|
while(NULL != pair && 0 < togo) { |
|
|
|
|
|
char * key = pair; |
|
|
|
|
|
char * eqsign; |
|
|
|
|
|
char * val; |
|
|
|
|
|
size_t nval; |
|
|
|
|
|
|
|
|
|
|
|
for (; *key == ' ' && key < lend; key++, togo--); |
|
|
|
|
|
eqsign = memchr(key, '=', togo); |
|
|
|
|
|
|
|
|
|
|
|
if (NULL == eqsign) { |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
togo -= (eqsign - key); |
|
|
|
|
|
pair = memchr(eqsign, ';', togo); |
|
|
|
|
|
|
|
|
|
|
|
if (NULL == pair) { |
|
|
|
|
|
pair = (char *)lend; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
nval = pair-eqsign-1; |
|
|
|
|
|
val = (0 != nval)? eqsign+1 : NULL; |
|
|
|
|
|
|
|
|
|
|
|
hashAdd(request->cookies, |
|
|
|
|
|
new(HashValue, key, eqsign-key, val, nval)); |
|
|
|
|
|
|
|
|
|
|
|
togo -= (pair - eqsign); |
|
|
|
|
|
pair++; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
hashAdd(current->header, |
|
|
hashAdd(current->header, |
|
|
new(HttpHeader, name, nname, value, lend - value)); |
|
|
new(HttpHeader, name, nname, value, lend - value)); |
|
|
} |
|
|
} |
|
|
|