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)
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 */
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
* 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]);