aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-02-27 07:38:04 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-02-27 07:38:04 +0000
commit3612c3774ea88214c0821b4fe30899b3e65df3d3 (patch)
tree9a335e83f60b0c4c31e6de518cc0a3125dd56649 /lib
parente6a65bb3efd40f555c565bffb9fc61e6721d2452 (diff)
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/cookie.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/cookie.c b/lib/cookie.c
index 0dc734571..c80dbcc1e 100644
--- a/lib/cookie.c
+++ b/lib/cookie.c
@@ -141,9 +141,17 @@ Curl_cookie_add(struct CookieInfo *c,
name[0]=what[0]=0; /* init the buffers */
if(1 <= sscanf(ptr, "%" MAX_NAME_TXT "[^;=]=%"
- MAX_COOKIE_LINE_TXT "[^;\r\n ]",
+ MAX_COOKIE_LINE_TXT "[^;\r\n]",
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)) {
co->path=strdup(what);
}
@@ -166,7 +174,7 @@ Curl_cookie_add(struct CookieInfo *c,
*/
co->maxage = strdup(what);
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)) {
co->expirestr=strdup(what);