cookie: small variable type cleanups
- bump cookie counter and "creation time" to use 'unsigned int' - use BIT() for single-bit struct field - make invalid_octets() return bool properly Closes #15921
This commit is contained in:
parent
f6566f332f
commit
0cc458686c
@ -438,7 +438,7 @@ static bool bad_domain(const char *domain, size_t len)
|
|||||||
fine. The prime reason for filtering out control bytes is that some HTTP
|
fine. The prime reason for filtering out control bytes is that some HTTP
|
||||||
servers return 400 for requests that contain such.
|
servers return 400 for requests that contain such.
|
||||||
*/
|
*/
|
||||||
static int invalid_octets(const char *p)
|
static bool invalid_octets(const char *p)
|
||||||
{
|
{
|
||||||
/* Reject all bytes \x01 - \x1f (*except* \x09, TAB) + \x7f */
|
/* Reject all bytes \x01 - \x1f (*except* \x09, TAB) + \x7f */
|
||||||
static const char badoctets[] = {
|
static const char badoctets[] = {
|
||||||
|
|||||||
10
lib/cookie.h
10
lib/cookie.h
@ -38,7 +38,7 @@ struct Cookie {
|
|||||||
char *spath; /* sanitized cookie path */
|
char *spath; /* sanitized cookie path */
|
||||||
char *domain; /* domain = <this> */
|
char *domain; /* domain = <this> */
|
||||||
curl_off_t expires; /* expires = <this> */
|
curl_off_t expires; /* expires = <this> */
|
||||||
int creationtime; /* time when the cookie was written */
|
unsigned int creationtime; /* time when the cookie was written */
|
||||||
BIT(tailmatch); /* tail-match the domain name */
|
BIT(tailmatch); /* tail-match the domain name */
|
||||||
BIT(secure); /* the 'secure' keyword was used */
|
BIT(secure); /* the 'secure' keyword was used */
|
||||||
BIT(livecookie); /* updated from a server, not a stored file */
|
BIT(livecookie); /* updated from a server, not a stored file */
|
||||||
@ -60,10 +60,10 @@ struct CookieInfo {
|
|||||||
/* linked lists of cookies we know of */
|
/* linked lists of cookies we know of */
|
||||||
struct Curl_llist cookielist[COOKIE_HASH_SIZE];
|
struct Curl_llist cookielist[COOKIE_HASH_SIZE];
|
||||||
curl_off_t next_expiration; /* the next time at which expiration happens */
|
curl_off_t next_expiration; /* the next time at which expiration happens */
|
||||||
int numcookies; /* number of cookies in the "jar" */
|
unsigned int numcookies; /* number of cookies in the "jar" */
|
||||||
int lastct; /* last creation-time used in the jar */
|
unsigned int lastct; /* last creation-time used in the jar */
|
||||||
bool running; /* state info, for cookie adding information */
|
BIT(running); /* state info, for cookie adding information */
|
||||||
bool newsession; /* new session, discard session cookies on load */
|
BIT(newsession); /* new session, discard session cookies on load */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The maximum sizes we accept for cookies. RFC 6265 section 6.1 says
|
/* The maximum sizes we accept for cookies. RFC 6265 section 6.1 says
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user