[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 320/411: url: make sure an HSTS upgrade updates URL and scheme c
From: |
gnunet |
Subject: |
[gnurl] 320/411: url: make sure an HSTS upgrade updates URL and scheme correctly |
Date: |
Wed, 13 Jan 2021 01:22:15 +0100 |
This is an automated email from the git hooks/post-receive script.
nikita pushed a commit to branch master
in repository gnurl.
commit 20558ff269708bdc796558f7352fa95d82b9b55e
Author: Daniel Stenberg <daniel@haxx.se>
AuthorDate: Thu Nov 5 09:18:52 2020 +0100
url: make sure an HSTS upgrade updates URL and scheme correctly
Closes #6175
---
lib/url.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/lib/url.c b/lib/url.c
index b01d470e5..381f98dc6 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1922,8 +1922,26 @@ static CURLcode parseurlandfillconn(struct Curl_easy
*data,
#ifdef USE_HSTS
if(data->hsts && strcasecompare("http", data->state.up.scheme)) {
- if(Curl_hsts(data->hsts, data->state.up.hostname, TRUE))
- infof(data, "Switch from HTTP to HTTPS due to HSTS!\n");
+ if(Curl_hsts(data->hsts, data->state.up.hostname, TRUE)) {
+ char *url;
+ Curl_safefree(data->state.up.scheme);
+ uc = curl_url_set(uh, CURLUPART_SCHEME, "https", 0);
+ if(uc)
+ return Curl_uc_to_curlcode(uc);
+ if(data->change.url_alloc)
+ Curl_safefree(data->change.url);
+ /* after update, get the updated version */
+ uc = curl_url_get(uh, CURLUPART_URL, &url, 0);
+ if(uc)
+ return Curl_uc_to_curlcode(uc);
+ uc = curl_url_get(uh, CURLUPART_SCHEME, &data->state.up.scheme, 0);
+ if(uc)
+ return Curl_uc_to_curlcode(uc);
+ data->change.url = url;
+ data->change.url_alloc = TRUE;
+ infof(data, "Switched from HTTP to HTTPS due to HSTS => %s\n",
+ data->change.url);
+ }
}
#endif
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnurl] 266/411: KNOWN_BUGS: mention the individual cmake issues, (continued)
- [gnurl] 266/411: KNOWN_BUGS: mention the individual cmake issues, gnunet, 2021/01/12
- [gnurl] 362/411: KNOWN_BUGS: wakeup socket disconnect causes havoc, gnunet, 2021/01/12
- [gnurl] 317/411: FAQ: refreshed, gnunet, 2021/01/12
- [gnurl] 322/411: FAQ: refresh "Why do I get "certificate verify failed", gnunet, 2021/01/12
- [gnurl] 302/411: RELEASE-NOTES: synced, gnunet, 2021/01/12
- [gnurl] 267/411: libssh2: require version 1.0 or later, gnunet, 2021/01/12
- [gnurl] 286/411: RELEASE-NOTES: synced, gnunet, 2021/01/12
- [gnurl] 308/411: KNOWN_BUGS: LDAPS with NSS is slow, gnunet, 2021/01/12
- [gnurl] 299/411: hsts: add support for Strict-Transport-Security, gnunet, 2021/01/12
- [gnurl] 300/411: hsts: add read/write callbacks, gnunet, 2021/01/12
- [gnurl] 320/411: url: make sure an HSTS upgrade updates URL and scheme correctly,
gnunet <=
- [gnurl] 369/411: examples: update .gitignore, gnunet, 2021/01/12
- [gnurl] 328/411: examples/httpput: remove use of CURLOPT_PUT, gnunet, 2021/01/12
- [gnurl] 325/411: configure: pass -pthread to Libs.private for pkg-config, gnunet, 2021/01/12
- [gnurl] 301/411: curlver: bumped to 7.74.0, gnunet, 2021/01/12
- [gnurl] 332/411: mqttd: fclose test file when done, gnunet, 2021/01/12
- [gnurl] 309/411: KNOWN_BUGS: SMB tests fail with Python 2, gnunet, 2021/01/12
- [gnurl] 324/411: altsvc: minimize variable scope and avoid "DEAD_STORE", gnunet, 2021/01/12
- [gnurl] 282/411: libssh2: fix transport over HTTPS proxy, gnunet, 2021/01/12
- [gnurl] 363/411: KNOWN_BUGS: curl with wolfSSL lacks support for renegotiation, gnunet, 2021/01/12
- [gnurl] 335/411: http_proxy: use enum with state names for 'keepon', gnunet, 2021/01/12