summaryrefslogtreecommitdiff
path: root/lib/easy.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-09-05 21:21:26 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-09-06 09:54:54 +0200
commitf93455eb04b57b2d002244bed1f0b59b94c2f0c7 (patch)
treea403a1dffdc45c2b37fa33a69f1aa0af3b1bb52c /lib/easy.c
parent8ca54a03ea08a7b0cf0a402018f329bd93124216 (diff)
downloadcurl-f93455eb04b57b2d002244bed1f0b59b94c2f0c7.tar.gz
altsvc: clone setting in curl_easy_duphandlebagder/altsvc-duphandle
The cache content is not duplicated, like other caches, but the setting and specified file name are. Test 1908 is extended to verify this somewhat. Since the duplicated handle gets the same file name, the test unfortunately overwrites the same file twice (with different contents) which makes it hard to check automatically. Closes #5923
Diffstat (limited to 'lib/easy.c')
-rw-r--r--lib/easy.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/easy.c b/lib/easy.c
index a69eb9e56..4da26f914 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -78,6 +78,7 @@
#include "system_win32.h"
#include "http2.h"
#include "dynbuf.h"
+#include "altsvc.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
@@ -883,6 +884,15 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)
goto fail;
}
+#ifdef USE_ALTSVC
+ if(data->asi) {
+ outcurl->asi = Curl_altsvc_init();
+ if(!outcurl->asi)
+ goto fail;
+ if(outcurl->set.str[STRING_ALTSVC])
+ (void)Curl_altsvc_load(outcurl->asi, outcurl->set.str[STRING_ALTSVC]);
+ }
+#endif
/* Clone the resolver handle, if present, for the new handle */
if(Curl_resolver_duphandle(outcurl,
&outcurl->state.resolver,
@@ -930,6 +940,7 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)
Curl_dyn_free(&outcurl->state.headerb);
Curl_safefree(outcurl->change.url);
Curl_safefree(outcurl->change.referer);
+ Curl_altsvc_cleanup(&outcurl->asi);
Curl_freeset(outcurl);
free(outcurl);
}