mirror of
https://github.com/curl/curl.git
synced 2026-04-15 00:31:41 +03:00
parent
80005b4c8a
commit
97169a91d9
3 changed files with 12 additions and 7 deletions
|
|
@ -571,18 +571,22 @@ CURLcode Curl_hsts_loadcb(struct Curl_easy *data, struct hsts *h)
|
|||
return CURLE_OK;
|
||||
}
|
||||
|
||||
void Curl_hsts_loadfiles(struct Curl_easy *data)
|
||||
CURLcode Curl_hsts_loadfiles(struct Curl_easy *data)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
struct curl_slist *l = data->state.hstslist;
|
||||
if(l) {
|
||||
Curl_share_lock(data, CURL_LOCK_DATA_HSTS, CURL_LOCK_ACCESS_SINGLE);
|
||||
|
||||
while(l) {
|
||||
(void)Curl_hsts_loadfile(data, data->hsts, l->data);
|
||||
result = Curl_hsts_loadfile(data, data->hsts, l->data);
|
||||
if(result)
|
||||
break;
|
||||
l = l->next;
|
||||
}
|
||||
Curl_share_unlock(data, CURL_LOCK_DATA_HSTS);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#if defined(DEBUGBUILD) || defined(UNITTESTS)
|
||||
|
|
|
|||
|
|
@ -59,11 +59,11 @@ CURLcode Curl_hsts_loadfile(struct Curl_easy *data,
|
|||
struct hsts *h, const char *file);
|
||||
CURLcode Curl_hsts_loadcb(struct Curl_easy *data,
|
||||
struct hsts *h);
|
||||
void Curl_hsts_loadfiles(struct Curl_easy *data);
|
||||
CURLcode Curl_hsts_loadfiles(struct Curl_easy *data);
|
||||
#else
|
||||
#define Curl_hsts_cleanup(x)
|
||||
#define Curl_hsts_loadcb(x,y) CURLE_OK
|
||||
#define Curl_hsts_save(x,y,z)
|
||||
#define Curl_hsts_loadfiles(x)
|
||||
#define Curl_hsts_loadfiles(x) CURLE_OK
|
||||
#endif /* CURL_DISABLE_HTTP || CURL_DISABLE_HSTS */
|
||||
#endif /* HEADER_CURL_HSTS_H */
|
||||
|
|
|
|||
|
|
@ -554,8 +554,9 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
|
|||
if(!result && data->state.resolve)
|
||||
result = Curl_loadhostpairs(data);
|
||||
|
||||
/* If there is a list of hsts files to read */
|
||||
Curl_hsts_loadfiles(data);
|
||||
if(!result)
|
||||
/* If there is a list of hsts files to read */
|
||||
result = Curl_hsts_loadfiles(data);
|
||||
|
||||
if(!result) {
|
||||
/* Allow data->set.use_port to set which port to use. This needs to be
|
||||
|
|
@ -608,7 +609,7 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
|
|||
* basically anything through an HTTP proxy we cannot limit this based on
|
||||
* protocol.
|
||||
*/
|
||||
if(data->set.str[STRING_USERAGENT]) {
|
||||
if(!result && data->set.str[STRING_USERAGENT]) {
|
||||
free(data->state.aptr.uagent);
|
||||
data->state.aptr.uagent =
|
||||
curl_maprintf("User-Agent: %s\r\n", data->set.str[STRING_USERAGENT]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue