mirror of
https://github.com/curl/curl.git
synced 2026-08-26 19:03:32 +03:00
code: language cleanup in comments
Based on the standards and guidelines we use for our documentation. - expand contractions (they're => they are etc) - host name = > hostname - file name => filename - user name = username - man page => manpage - run-time => runtime - set-up => setup - back-end => backend - a HTTP => an HTTP - Two spaces after a period => one space after period Closes #14073
This commit is contained in:
parent
9b683577e1
commit
c074ba64a8
213 changed files with 1719 additions and 1715 deletions
74
lib/cookie.c
74
lib/cookie.c
|
|
@ -61,7 +61,7 @@ struct Cookies *Curl_cookie_getlist(struct CookieInfo *cookie,
|
|||
boolean informs the cookie if a secure connection is achieved or
|
||||
not.
|
||||
|
||||
It shall only return cookies that haven't expired.
|
||||
It shall only return cookies that have not expired.
|
||||
|
||||
|
||||
Example set of cookies:
|
||||
|
|
@ -150,7 +150,7 @@ static bool cookie_tailmatch(const char *cookie_domain,
|
|||
}
|
||||
|
||||
/*
|
||||
* matching cookie path and url path
|
||||
* matching cookie path and URL path
|
||||
* RFC6265 5.1.4 Paths and Path-Match
|
||||
*/
|
||||
static bool pathmatch(const char *cookie_path, const char *request_uri)
|
||||
|
|
@ -374,7 +374,7 @@ static void strstore(char **str, const char *newstr, size_t len)
|
|||
*
|
||||
* Remove expired cookies from the hash by inspecting the expires timestamp on
|
||||
* each cookie in the hash, freeing and deleting any where the timestamp is in
|
||||
* the past. If the cookiejar has recorded the next timestamp at which one or
|
||||
* the past. If the cookiejar has recorded the next timestamp at which one or
|
||||
* more cookies expire, then processing will exit early in case this timestamp
|
||||
* is in the future.
|
||||
*/
|
||||
|
|
@ -386,11 +386,11 @@ static void remove_expired(struct CookieInfo *cookies)
|
|||
|
||||
/*
|
||||
* If the earliest expiration timestamp in the jar is in the future we can
|
||||
* skip scanning the whole jar and instead exit early as there won't be any
|
||||
* cookies to evict. If we need to evict however, reset the next_expiration
|
||||
* counter in order to track the next one. In case the recorded first
|
||||
* expiration is the max offset, then perform the safe fallback of checking
|
||||
* all cookies.
|
||||
* skip scanning the whole jar and instead exit early as there will not be
|
||||
* any cookies to evict. If we need to evict however, reset the
|
||||
* next_expiration counter in order to track the next one. In case the
|
||||
* recorded first expiration is the max offset, then perform the safe
|
||||
* fallback of checking all cookies.
|
||||
*/
|
||||
if(now < cookies->next_expiration &&
|
||||
cookies->next_expiration != CURL_OFF_T_MAX)
|
||||
|
|
@ -415,7 +415,7 @@ static void remove_expired(struct CookieInfo *cookies)
|
|||
}
|
||||
else {
|
||||
/*
|
||||
* If this cookie has an expiration timestamp earlier than what we've
|
||||
* If this cookie has an expiration timestamp earlier than what we have
|
||||
* seen so far then record it for the next round of expirations.
|
||||
*/
|
||||
if(co->expires && co->expires < cookies->next_expiration)
|
||||
|
|
@ -474,7 +474,7 @@ static int invalid_octets(const char *p)
|
|||
* Curl_cookie_add
|
||||
*
|
||||
* Add a single cookie line to the cookie keeping object. Be aware that
|
||||
* sometimes we get an IP-only host name, and that might also be a numerical
|
||||
* sometimes we get an IP-only hostname, and that might also be a numerical
|
||||
* IPv6 address.
|
||||
*
|
||||
* Returns NULL on out of memory or invalid cookie. This is suboptimal,
|
||||
|
|
@ -510,7 +510,7 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||
/* First, alloc and init a new struct for it */
|
||||
co = calloc(1, sizeof(struct Cookie));
|
||||
if(!co)
|
||||
return NULL; /* bail out if we're this low on memory */
|
||||
return NULL; /* bail out if we are this low on memory */
|
||||
|
||||
if(httpheader) {
|
||||
/* This line was read off an HTTP-header */
|
||||
|
|
@ -648,7 +648,7 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||
else if((nlen == 8) && strncasecompare("httponly", namep, 8))
|
||||
co->httponly = TRUE;
|
||||
else if(sep)
|
||||
/* there was a '=' so we're not done parsing this field */
|
||||
/* there was a '=' so we are not done parsing this field */
|
||||
done = FALSE;
|
||||
}
|
||||
if(done)
|
||||
|
|
@ -682,9 +682,9 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||
|
||||
#ifndef USE_LIBPSL
|
||||
/*
|
||||
* Without PSL we don't know when the incoming cookie is set on a
|
||||
* Without PSL we do not know when the incoming cookie is set on a
|
||||
* TLD or otherwise "protected" suffix. To reduce risk, we require a
|
||||
* dot OR the exact host name being "localhost".
|
||||
* dot OR the exact hostname being "localhost".
|
||||
*/
|
||||
if(bad_domain(valuep, vlen))
|
||||
domain = ":";
|
||||
|
|
@ -722,10 +722,10 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||
/*
|
||||
* Defined in RFC2109:
|
||||
*
|
||||
* Optional. The Max-Age attribute defines the lifetime of the
|
||||
* cookie, in seconds. The delta-seconds value is a decimal non-
|
||||
* negative integer. After delta-seconds seconds elapse, the
|
||||
* client should discard the cookie. A value of zero means the
|
||||
* Optional. The Max-Age attribute defines the lifetime of the
|
||||
* cookie, in seconds. The delta-seconds value is a decimal non-
|
||||
* negative integer. After delta-seconds seconds elapse, the
|
||||
* client should discard the cookie. A value of zero means the
|
||||
* cookie should be discarded immediately.
|
||||
*/
|
||||
CURLofft offt;
|
||||
|
|
@ -781,7 +781,7 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||
}
|
||||
|
||||
/*
|
||||
* Else, this is the second (or more) name we don't know about!
|
||||
* Else, this is the second (or more) name we do not know about!
|
||||
*/
|
||||
}
|
||||
else {
|
||||
|
|
@ -807,7 +807,7 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||
|
||||
if(!badcookie && !co->path && path) {
|
||||
/*
|
||||
* No path was given in the header line, set the default. Note that the
|
||||
* No path was given in the header line, set the default. Note that the
|
||||
* passed-in path to this function MAY have a '?' and following part that
|
||||
* MUST NOT be stored as part of the path.
|
||||
*/
|
||||
|
|
@ -836,7 +836,7 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||
}
|
||||
|
||||
/*
|
||||
* If we didn't get a cookie name, or a bad one, the this is an illegal
|
||||
* If we did not get a cookie name, or a bad one, the this is an illegal
|
||||
* line so bail out.
|
||||
*/
|
||||
if(badcookie || !co->name) {
|
||||
|
|
@ -869,7 +869,7 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||
}
|
||||
|
||||
if(lineptr[0]=='#') {
|
||||
/* don't even try the comments */
|
||||
/* do not even try the comments */
|
||||
free(co);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -909,7 +909,7 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||
case 2:
|
||||
/* The file format allows the path field to remain not filled in */
|
||||
if(strcmp("TRUE", ptr) && strcmp("FALSE", ptr)) {
|
||||
/* only if the path doesn't look like a boolean option! */
|
||||
/* only if the path does not look like a boolean option! */
|
||||
co->path = strdup(ptr);
|
||||
if(!co->path)
|
||||
badcookie = TRUE;
|
||||
|
|
@ -921,7 +921,7 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||
}
|
||||
break;
|
||||
}
|
||||
/* this doesn't look like a path, make one up! */
|
||||
/* this does not look like a path, make one up! */
|
||||
co->path = strdup("/");
|
||||
if(!co->path)
|
||||
badcookie = TRUE;
|
||||
|
|
@ -1004,7 +1004,7 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||
|
||||
if(!c->running && /* read from a file */
|
||||
c->newsession && /* clean session cookies */
|
||||
!co->expires) { /* this is a session cookie since it doesn't expire! */
|
||||
!co->expires) { /* this is a session cookie since it does not expire! */
|
||||
freecookie(co);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -1025,7 +1025,7 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||
#ifdef USE_LIBPSL
|
||||
/*
|
||||
* Check if the domain is a Public Suffix and if yes, ignore the cookie. We
|
||||
* must also check that the data handle isn't NULL since the psl code will
|
||||
* must also check that the data handle is not NULL since the psl code will
|
||||
* dereference it.
|
||||
*/
|
||||
if(data && (domain && co->domain && !Curl_host_is_ipnum(co->domain))) {
|
||||
|
|
@ -1125,10 +1125,10 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||
|
||||
if(replace_old && !co->livecookie && clist->livecookie) {
|
||||
/*
|
||||
* Both cookies matched fine, except that the already present cookie is
|
||||
* "live", which means it was set from a header, while the new one was
|
||||
* read from a file and thus isn't "live". "live" cookies are preferred
|
||||
* so the new cookie is freed.
|
||||
* Both cookies matched fine, except that the already present cookie
|
||||
* is "live", which means it was set from a header, while the new one
|
||||
* was read from a file and thus is not "live". "live" cookies are
|
||||
* preferred so the new cookie is freed.
|
||||
*/
|
||||
freecookie(co);
|
||||
return NULL;
|
||||
|
|
@ -1179,7 +1179,7 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||
}
|
||||
|
||||
/*
|
||||
* Now that we've added a new cookie to the jar, update the expiration
|
||||
* Now that we have added a new cookie to the jar, update the expiration
|
||||
* tracker in case it is the next one to expire.
|
||||
*/
|
||||
if(co->expires && (co->expires < c->next_expiration))
|
||||
|
|
@ -1212,12 +1212,12 @@ struct CookieInfo *Curl_cookie_init(struct Curl_easy *data,
|
|||
FILE *handle = NULL;
|
||||
|
||||
if(!inc) {
|
||||
/* we didn't get a struct, create one */
|
||||
/* we did not get a struct, create one */
|
||||
c = calloc(1, sizeof(struct CookieInfo));
|
||||
if(!c)
|
||||
return NULL; /* failed to get memory */
|
||||
/*
|
||||
* Initialize the next_expiration time to signal that we don't have enough
|
||||
* Initialize the next_expiration time to signal that we do not have enough
|
||||
* information yet.
|
||||
*/
|
||||
c->next_expiration = CURL_OFF_T_MAX;
|
||||
|
|
@ -1272,7 +1272,7 @@ struct CookieInfo *Curl_cookie_init(struct Curl_easy *data,
|
|||
}
|
||||
data->state.cookie_engine = TRUE;
|
||||
}
|
||||
c->running = TRUE; /* now, we're running */
|
||||
c->running = TRUE; /* now, we are running */
|
||||
|
||||
return c;
|
||||
}
|
||||
|
|
@ -1368,7 +1368,7 @@ fail:
|
|||
* should send to the server if used now. The secure boolean informs the cookie
|
||||
* if a secure connection is achieved or not.
|
||||
*
|
||||
* It shall only return cookies that haven't expired.
|
||||
* It shall only return cookies that have not expired.
|
||||
*/
|
||||
struct Cookie *Curl_cookie_getlist(struct Curl_easy *data,
|
||||
struct CookieInfo *c,
|
||||
|
|
@ -1394,7 +1394,7 @@ struct Cookie *Curl_cookie_getlist(struct Curl_easy *data,
|
|||
co = c->cookies[myhash];
|
||||
|
||||
while(co) {
|
||||
/* if the cookie requires we're secure we must only continue if we are! */
|
||||
/* if the cookie requires we are secure we must only continue if we are! */
|
||||
if(co->secure?secure:TRUE) {
|
||||
|
||||
/* now check if the domain is correct */
|
||||
|
|
@ -1606,7 +1606,7 @@ static char *get_netscape_format(const struct Cookie *co)
|
|||
* cookie_output()
|
||||
*
|
||||
* Writes all internally known cookies to the specified file. Specify
|
||||
* "-" as file name to write to stdout.
|
||||
* "-" as filename to write to stdout.
|
||||
*
|
||||
* The function returns non-zero on write failure.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue