Lines Matching refs:co

100 static void freecookie(struct Cookie *co)  in freecookie()  argument
102 free(co->domain); in freecookie()
103 free(co->path); in freecookie()
104 free(co->spath); in freecookie()
105 free(co->name); in freecookie()
106 free(co->value); in freecookie()
107 free(co); in freecookie()
370 struct Cookie *co; in remove_expired() local
393 co = Curl_node_elem(n); in remove_expired()
395 if(co->expires && co->expires < now) { in remove_expired()
397 freecookie(co); in remove_expired()
405 if(co->expires && co->expires < ci->next_expiration) in remove_expired()
406 ci->next_expiration = co->expires; in remove_expired()
474 struct Cookie *co, in parse_cookie_header() argument
560 co->prefix_secure = TRUE; in parse_cookie_header()
562 co->prefix_host = TRUE; in parse_cookie_header()
571 if(!co->name) { in parse_cookie_header()
577 strstore(&co->name, namep, nlen); in parse_cookie_header()
578 strstore(&co->value, valuep, vlen); in parse_cookie_header()
580 if(!co->name || !co->value) in parse_cookie_header()
583 if(invalid_octets(co->value) || invalid_octets(co->name)) { in parse_cookie_header()
601 co->secure = TRUE; in parse_cookie_header()
608 co->httponly = TRUE; in parse_cookie_header()
616 strstore(&co->path, valuep, vlen); in parse_cookie_header()
617 if(!co->path) in parse_cookie_header()
619 free(co->spath); /* if this is set again */ in parse_cookie_header()
620 co->spath = sanitize_cookie_path(co->path); in parse_cookie_header()
621 if(!co->spath) in parse_cookie_header()
654 strstore(&co->domain, valuep, vlen); in parse_cookie_header()
655 if(!co->domain) in parse_cookie_header()
659 co->tailmatch = TRUE; /* we always do that if the domain name was in parse_cookie_header()
689 &co->expires); in parse_cookie_header()
693 co->expires = CURL_OFF_T_MAX; in parse_cookie_header()
697 co->expires = 1; in parse_cookie_header()
700 if(!co->expires) in parse_cookie_header()
702 co->expires = 1; in parse_cookie_header()
703 else if(CURL_OFF_T_MAX - now < co->expires) in parse_cookie_header()
705 co->expires = CURL_OFF_T_MAX; in parse_cookie_header()
707 co->expires += now; in parse_cookie_header()
712 if(!co->expires) { in parse_cookie_header()
719 co->expires = Curl_getdate_capped(valuep); in parse_cookie_header()
726 if(co->expires == 0) in parse_cookie_header()
727 co->expires = 1; in parse_cookie_header()
728 else if(co->expires < 0) in parse_cookie_header()
729 co->expires = 0; in parse_cookie_header()
749 if(!co->domain && domain) { in parse_cookie_header()
751 co->domain = strdup(domain); in parse_cookie_header()
752 if(!co->domain) in parse_cookie_header()
756 if(!co->path && path) { in parse_cookie_header()
775 co->path = Curl_memdup0(path, pathlen); in parse_cookie_header()
776 if(co->path) { in parse_cookie_header()
777 co->spath = sanitize_cookie_path(co->path); in parse_cookie_header()
778 if(!co->spath) in parse_cookie_header()
790 if(!co->name) in parse_cookie_header()
798 parse_netscape(struct Cookie *co, in parse_netscape() argument
821 co->httponly = TRUE; in parse_netscape()
850 co->domain = strdup(ptr); in parse_netscape()
851 if(!co->domain) in parse_netscape()
860 co->tailmatch = !!strcasecompare(ptr, "TRUE"); in parse_netscape()
866 co->path = strdup(ptr); in parse_netscape()
867 if(!co->path) in parse_netscape()
870 co->spath = sanitize_cookie_path(co->path); in parse_netscape()
871 if(!co->spath) in parse_netscape()
877 co->path = strdup("/"); in parse_netscape()
878 if(!co->path) in parse_netscape()
880 co->spath = strdup("/"); in parse_netscape()
881 if(!co->spath) in parse_netscape()
886 co->secure = FALSE; in parse_netscape()
889 co->secure = TRUE; in parse_netscape()
895 if(curlx_strtoofft(ptr, NULL, 10, &co->expires)) in parse_netscape()
899 co->name = strdup(ptr); in parse_netscape()
900 if(!co->name) in parse_netscape()
904 if(strncasecompare("__Secure-", co->name, 9)) in parse_netscape()
905 co->prefix_secure = TRUE; in parse_netscape()
906 else if(strncasecompare("__Host-", co->name, 7)) in parse_netscape()
907 co->prefix_host = TRUE; in parse_netscape()
911 co->value = strdup(ptr); in parse_netscape()
912 if(!co->value) in parse_netscape()
919 co->value = strdup(""); in parse_netscape()
920 if(!co->value) in parse_netscape()
935 struct Cookie *co, in is_public_suffix() argument
945 co->name, co->domain, domain)); in is_public_suffix()
946 if(data && (domain && co->domain && !Curl_host_is_ipnum(co->domain))) { in is_public_suffix()
951 size_t clen = strlen(co->domain); in is_public_suffix()
957 Curl_strntolower(lcookie, co->domain, clen + 1); in is_public_suffix()
967 "set cookies for '%s'", co->name, domain, co->domain); in is_public_suffix()
973 (void)co; in is_public_suffix()
976 co->name, co->domain, domain)); in is_public_suffix()
983 struct Cookie *co, in replace_existing() argument
991 size_t myhash = cookiehash(co->domain); in replace_existing()
994 if(!strcmp(clist->name, co->name)) { in replace_existing()
998 if(clist->domain && co->domain) { in replace_existing()
999 if(strcasecompare(clist->domain, co->domain)) in replace_existing()
1003 else if(!clist->domain && !co->domain) in replace_existing()
1007 clist->spath && co->spath && /* both have paths */ in replace_existing()
1008 clist->secure && !co->secure && !secure) { in replace_existing()
1026 if(strncasecompare(clist->spath, co->spath, cllen)) { in replace_existing()
1028 "overlay an existing cookie", co->name, co->domain); in replace_existing()
1034 if(!replace_n && !strcmp(clist->name, co->name)) { in replace_existing()
1037 if(clist->domain && co->domain) { in replace_existing()
1038 if(strcasecompare(clist->domain, co->domain) && in replace_existing()
1039 (clist->tailmatch == co->tailmatch)) in replace_existing()
1043 else if(!clist->domain && !co->domain) in replace_existing()
1049 if(clist->spath && co->spath && in replace_existing()
1050 !strcasecompare(clist->spath, co->spath)) in replace_existing()
1052 else if(!clist->spath != !co->spath) in replace_existing()
1056 if(replace_old && !co->livecookie && clist->livecookie) { in replace_existing()
1073 co->creationtime = repl->creationtime; in replace_existing()
1107 struct Cookie *co; in Curl_cookie_add() local
1118 co = calloc(1, sizeof(struct Cookie)); in Curl_cookie_add()
1119 if(!co) in Curl_cookie_add()
1123 rc = parse_cookie_header(data, co, ci, lineptr, domain, path, secure); in Curl_cookie_add()
1125 rc = parse_netscape(co, ci, lineptr, secure); in Curl_cookie_add()
1130 if(co->prefix_secure && !co->secure) in Curl_cookie_add()
1134 if(co->prefix_host) { in Curl_cookie_add()
1139 if(co->secure && co->path && strcmp(co->path, "/") == 0 && !co->tailmatch) in Curl_cookie_add()
1147 !co->expires) /* this is a session cookie since it does not expire */ in Curl_cookie_add()
1150 co->livecookie = ci->running; in Curl_cookie_add()
1151 co->creationtime = ++ci->lastct; in Curl_cookie_add()
1163 if(is_public_suffix(data, co, domain)) in Curl_cookie_add()
1166 if(replace_existing(data, co, ci, secure, &replaces)) in Curl_cookie_add()
1170 myhash = cookiehash(co->domain); in Curl_cookie_add()
1171 Curl_llist_append(&ci->cookielist[myhash], co, &co->node); in Curl_cookie_add()
1177 replaces ? "Replaced":"Added", co->name, co->value, in Curl_cookie_add()
1178 co->domain, co->path, co->expires); in Curl_cookie_add()
1187 if(co->expires && (co->expires < ci->next_expiration)) in Curl_cookie_add()
1188 ci->next_expiration = co->expires; in Curl_cookie_add()
1190 return co; in Curl_cookie_add()
1192 freecookie(co); in Curl_cookie_add()
1374 struct Cookie *co = Curl_node_elem(n); in Curl_cookie_getlist() local
1377 if(co->secure ? secure : TRUE) { in Curl_cookie_getlist()
1380 if(!co->domain || in Curl_cookie_getlist()
1381 (co->tailmatch && !is_ip && in Curl_cookie_getlist()
1382 cookie_tailmatch(co->domain, strlen(co->domain), host)) || in Curl_cookie_getlist()
1383 ((!co->tailmatch || is_ip) && strcasecompare(host, co->domain)) ) { in Curl_cookie_getlist()
1393 if(!co->spath || pathmatch(co->spath, path) ) { in Curl_cookie_getlist()
1398 Curl_llist_append(list, co, &co->getnode); in Curl_cookie_getlist()
1520 static char *get_netscape_format(const struct Cookie *co) in get_netscape_format() argument
1531 co->httponly ? "#HttpOnly_" : "", in get_netscape_format()
1536 (co->tailmatch && co->domain && co->domain[0] != '.') ? "." : "", in get_netscape_format()
1537 co->domain ? co->domain : "unknown", in get_netscape_format()
1538 co->tailmatch ? "TRUE" : "FALSE", in get_netscape_format()
1539 co->path ? co->path : "/", in get_netscape_format()
1540 co->secure ? "TRUE" : "FALSE", in get_netscape_format()
1541 co->expires, in get_netscape_format()
1542 co->name, in get_netscape_format()
1543 co->value ? co->value : ""); in get_netscape_format()
1602 struct Cookie *co = Curl_node_elem(n); in cookie_output() local
1603 if(!co->domain) in cookie_output()
1605 array[nvalid++] = co; in cookie_output()