made Max-Age work as defined in the RFC.
my brain damaged fix to not parse spaces as part of the value is now fixed to instead strip off trailing spaces from values.
This commit is contained in:
parent
e6a65bb3ef
commit
3612c3774e
14
lib/cookie.c
14
lib/cookie.c
@ -141,9 +141,17 @@ Curl_cookie_add(struct CookieInfo *c,
|
|||||||
|
|
||||||
name[0]=what[0]=0; /* init the buffers */
|
name[0]=what[0]=0; /* init the buffers */
|
||||||
if(1 <= sscanf(ptr, "%" MAX_NAME_TXT "[^;=]=%"
|
if(1 <= sscanf(ptr, "%" MAX_NAME_TXT "[^;=]=%"
|
||||||
MAX_COOKIE_LINE_TXT "[^;\r\n ]",
|
MAX_COOKIE_LINE_TXT "[^;\r\n]",
|
||||||
name, what)) {
|
name, what)) {
|
||||||
/* this is a legal <what>=<this> pair */
|
/* this is a <name>=<what> pair */
|
||||||
|
|
||||||
|
/* Strip off trailing whitespace from the 'what' */
|
||||||
|
int len=strlen(what);
|
||||||
|
while(len && isspace((int)what[len-1])) {
|
||||||
|
what[len-1]=0;
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
|
||||||
if(strequal("path", name)) {
|
if(strequal("path", name)) {
|
||||||
co->path=strdup(what);
|
co->path=strdup(what);
|
||||||
}
|
}
|
||||||
@ -166,7 +174,7 @@ Curl_cookie_add(struct CookieInfo *c,
|
|||||||
*/
|
*/
|
||||||
co->maxage = strdup(what);
|
co->maxage = strdup(what);
|
||||||
co->expires =
|
co->expires =
|
||||||
atoi((*co->maxage=='\"')?&co->maxage[1]:&co->maxage[0]);
|
atoi((*co->maxage=='\"')?&co->maxage[1]:&co->maxage[0]) + now;
|
||||||
}
|
}
|
||||||
else if(strequal("expires", name)) {
|
else if(strequal("expires", name)) {
|
||||||
co->expirestr=strdup(what);
|
co->expirestr=strdup(what);
|
||||||
|
Loading…
Reference in New Issue
Block a user