altsvc.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. /***************************************************************************
  2. * _ _ ____ _
  3. * Project ___| | | | _ \| |
  4. * / __| | | | |_) | |
  5. * | (__| |_| | _ <| |___
  6. * \___|\___/|_| \_\_____|
  7. *
  8. * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. *
  10. * This software is licensed as described in the file COPYING, which
  11. * you should have received as part of this distribution. The terms
  12. * are also available at https://curl.se/docs/copyright.html.
  13. *
  14. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. * copies of the Software, and permit persons to whom the Software is
  16. * furnished to do so, under the terms of the COPYING file.
  17. *
  18. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. * KIND, either express or implied.
  20. *
  21. * SPDX-License-Identifier: curl
  22. *
  23. ***************************************************************************/
  24. /*
  25. * The Alt-Svc: header is defined in RFC 7838:
  26. * https://datatracker.ietf.org/doc/html/rfc7838
  27. */
  28. #include "curl_setup.h"
  29. #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_ALTSVC)
  30. #include <curl/curl.h>
  31. #include "urldata.h"
  32. #include "altsvc.h"
  33. #include "curl_get_line.h"
  34. #include "strcase.h"
  35. #include "parsedate.h"
  36. #include "sendf.h"
  37. #include "warnless.h"
  38. #include "fopen.h"
  39. #include "rename.h"
  40. /* The last 3 #include files should be in this order */
  41. #include "curl_printf.h"
  42. #include "curl_memory.h"
  43. #include "memdebug.h"
  44. #define MAX_ALTSVC_LINE 4095
  45. #define MAX_ALTSVC_DATELENSTR "64"
  46. #define MAX_ALTSVC_DATELEN 64
  47. #define MAX_ALTSVC_HOSTLENSTR "512"
  48. #define MAX_ALTSVC_HOSTLEN 512
  49. #define MAX_ALTSVC_ALPNLENSTR "10"
  50. #define MAX_ALTSVC_ALPNLEN 10
  51. #define H3VERSION "h3"
  52. static enum alpnid alpn2alpnid(char *name)
  53. {
  54. if(strcasecompare(name, "h1"))
  55. return ALPN_h1;
  56. if(strcasecompare(name, "h2"))
  57. return ALPN_h2;
  58. if(strcasecompare(name, H3VERSION))
  59. return ALPN_h3;
  60. return ALPN_none; /* unknown, probably rubbish input */
  61. }
  62. /* Given the ALPN ID, return the name */
  63. const char *Curl_alpnid2str(enum alpnid id)
  64. {
  65. switch(id) {
  66. case ALPN_h1:
  67. return "h1";
  68. case ALPN_h2:
  69. return "h2";
  70. case ALPN_h3:
  71. return H3VERSION;
  72. default:
  73. return ""; /* bad */
  74. }
  75. }
  76. static void altsvc_free(struct altsvc *as)
  77. {
  78. free(as->src.host);
  79. free(as->dst.host);
  80. free(as);
  81. }
  82. static struct altsvc *altsvc_createid(const char *srchost,
  83. const char *dsthost,
  84. enum alpnid srcalpnid,
  85. enum alpnid dstalpnid,
  86. unsigned int srcport,
  87. unsigned int dstport)
  88. {
  89. struct altsvc *as = calloc(sizeof(struct altsvc), 1);
  90. size_t hlen;
  91. if(!as)
  92. return NULL;
  93. hlen = strlen(srchost);
  94. DEBUGASSERT(hlen);
  95. as->src.host = strdup(srchost);
  96. if(!as->src.host)
  97. goto error;
  98. if(hlen && (srchost[hlen - 1] == '.'))
  99. /* strip off trailing any dot */
  100. as->src.host[--hlen] = 0;
  101. as->dst.host = strdup(dsthost);
  102. if(!as->dst.host)
  103. goto error;
  104. as->src.alpnid = srcalpnid;
  105. as->dst.alpnid = dstalpnid;
  106. as->src.port = curlx_ultous(srcport);
  107. as->dst.port = curlx_ultous(dstport);
  108. return as;
  109. error:
  110. altsvc_free(as);
  111. return NULL;
  112. }
  113. static struct altsvc *altsvc_create(char *srchost,
  114. char *dsthost,
  115. char *srcalpn,
  116. char *dstalpn,
  117. unsigned int srcport,
  118. unsigned int dstport)
  119. {
  120. enum alpnid dstalpnid = alpn2alpnid(dstalpn);
  121. enum alpnid srcalpnid = alpn2alpnid(srcalpn);
  122. if(!srcalpnid || !dstalpnid)
  123. return NULL;
  124. return altsvc_createid(srchost, dsthost, srcalpnid, dstalpnid,
  125. srcport, dstport);
  126. }
  127. /* only returns SERIOUS errors */
  128. static CURLcode altsvc_add(struct altsvcinfo *asi, char *line)
  129. {
  130. /* Example line:
  131. h2 example.com 443 h3 shiny.example.com 8443 "20191231 10:00:00" 1
  132. */
  133. char srchost[MAX_ALTSVC_HOSTLEN + 1];
  134. char dsthost[MAX_ALTSVC_HOSTLEN + 1];
  135. char srcalpn[MAX_ALTSVC_ALPNLEN + 1];
  136. char dstalpn[MAX_ALTSVC_ALPNLEN + 1];
  137. char date[MAX_ALTSVC_DATELEN + 1];
  138. unsigned int srcport;
  139. unsigned int dstport;
  140. unsigned int prio;
  141. unsigned int persist;
  142. int rc;
  143. rc = sscanf(line,
  144. "%" MAX_ALTSVC_ALPNLENSTR "s %" MAX_ALTSVC_HOSTLENSTR "s %u "
  145. "%" MAX_ALTSVC_ALPNLENSTR "s %" MAX_ALTSVC_HOSTLENSTR "s %u "
  146. "\"%" MAX_ALTSVC_DATELENSTR "[^\"]\" %u %u",
  147. srcalpn, srchost, &srcport,
  148. dstalpn, dsthost, &dstport,
  149. date, &persist, &prio);
  150. if(9 == rc) {
  151. struct altsvc *as;
  152. time_t expires = Curl_getdate_capped(date);
  153. as = altsvc_create(srchost, dsthost, srcalpn, dstalpn, srcport, dstport);
  154. if(as) {
  155. as->expires = expires;
  156. as->prio = prio;
  157. as->persist = persist ? 1 : 0;
  158. Curl_llist_insert_next(&asi->list, asi->list.tail, as, &as->node);
  159. }
  160. }
  161. return CURLE_OK;
  162. }
  163. /*
  164. * Load alt-svc entries from the given file. The text based line-oriented file
  165. * format is documented here: https://curl.se/docs/alt-svc.html
  166. *
  167. * This function only returns error on major problems that prevent alt-svc
  168. * handling to work completely. It will ignore individual syntactical errors
  169. * etc.
  170. */
  171. static CURLcode altsvc_load(struct altsvcinfo *asi, const char *file)
  172. {
  173. CURLcode result = CURLE_OK;
  174. char *line = NULL;
  175. FILE *fp;
  176. /* we need a private copy of the file name so that the altsvc cache file
  177. name survives an easy handle reset */
  178. free(asi->filename);
  179. asi->filename = strdup(file);
  180. if(!asi->filename)
  181. return CURLE_OUT_OF_MEMORY;
  182. fp = fopen(file, FOPEN_READTEXT);
  183. if(fp) {
  184. line = malloc(MAX_ALTSVC_LINE);
  185. if(!line)
  186. goto fail;
  187. while(Curl_get_line(line, MAX_ALTSVC_LINE, fp)) {
  188. char *lineptr = line;
  189. while(*lineptr && ISBLANK(*lineptr))
  190. lineptr++;
  191. if(*lineptr == '#')
  192. /* skip commented lines */
  193. continue;
  194. altsvc_add(asi, lineptr);
  195. }
  196. free(line); /* free the line buffer */
  197. fclose(fp);
  198. }
  199. return result;
  200. fail:
  201. Curl_safefree(asi->filename);
  202. free(line);
  203. fclose(fp);
  204. return CURLE_OUT_OF_MEMORY;
  205. }
  206. /*
  207. * Write this single altsvc entry to a single output line
  208. */
  209. static CURLcode altsvc_out(struct altsvc *as, FILE *fp)
  210. {
  211. struct tm stamp;
  212. CURLcode result = Curl_gmtime(as->expires, &stamp);
  213. if(result)
  214. return result;
  215. fprintf(fp,
  216. "%s %s %u "
  217. "%s %s %u "
  218. "\"%d%02d%02d "
  219. "%02d:%02d:%02d\" "
  220. "%u %d\n",
  221. Curl_alpnid2str(as->src.alpnid), as->src.host, as->src.port,
  222. Curl_alpnid2str(as->dst.alpnid), as->dst.host, as->dst.port,
  223. stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
  224. stamp.tm_hour, stamp.tm_min, stamp.tm_sec,
  225. as->persist, as->prio);
  226. return CURLE_OK;
  227. }
  228. /* ---- library-wide functions below ---- */
  229. /*
  230. * Curl_altsvc_init() creates a new altsvc cache.
  231. * It returns the new instance or NULL if something goes wrong.
  232. */
  233. struct altsvcinfo *Curl_altsvc_init(void)
  234. {
  235. struct altsvcinfo *asi = calloc(sizeof(struct altsvcinfo), 1);
  236. if(!asi)
  237. return NULL;
  238. Curl_llist_init(&asi->list, NULL);
  239. /* set default behavior */
  240. asi->flags = CURLALTSVC_H1
  241. #ifdef USE_HTTP2
  242. | CURLALTSVC_H2
  243. #endif
  244. #ifdef ENABLE_QUIC
  245. | CURLALTSVC_H3
  246. #endif
  247. ;
  248. return asi;
  249. }
  250. /*
  251. * Curl_altsvc_load() loads alt-svc from file.
  252. */
  253. CURLcode Curl_altsvc_load(struct altsvcinfo *asi, const char *file)
  254. {
  255. CURLcode result;
  256. DEBUGASSERT(asi);
  257. result = altsvc_load(asi, file);
  258. return result;
  259. }
  260. /*
  261. * Curl_altsvc_ctrl() passes on the external bitmask.
  262. */
  263. CURLcode Curl_altsvc_ctrl(struct altsvcinfo *asi, const long ctrl)
  264. {
  265. DEBUGASSERT(asi);
  266. if(!ctrl)
  267. /* unexpected */
  268. return CURLE_BAD_FUNCTION_ARGUMENT;
  269. asi->flags = ctrl;
  270. return CURLE_OK;
  271. }
  272. /*
  273. * Curl_altsvc_cleanup() frees an altsvc cache instance and all associated
  274. * resources.
  275. */
  276. void Curl_altsvc_cleanup(struct altsvcinfo **altsvcp)
  277. {
  278. struct Curl_llist_element *e;
  279. struct Curl_llist_element *n;
  280. if(*altsvcp) {
  281. struct altsvcinfo *altsvc = *altsvcp;
  282. for(e = altsvc->list.head; e; e = n) {
  283. struct altsvc *as = e->ptr;
  284. n = e->next;
  285. altsvc_free(as);
  286. }
  287. free(altsvc->filename);
  288. free(altsvc);
  289. *altsvcp = NULL; /* clear the pointer */
  290. }
  291. }
  292. /*
  293. * Curl_altsvc_save() writes the altsvc cache to a file.
  294. */
  295. CURLcode Curl_altsvc_save(struct Curl_easy *data,
  296. struct altsvcinfo *altsvc, const char *file)
  297. {
  298. struct Curl_llist_element *e;
  299. struct Curl_llist_element *n;
  300. CURLcode result = CURLE_OK;
  301. FILE *out;
  302. char *tempstore = NULL;
  303. if(!altsvc)
  304. /* no cache activated */
  305. return CURLE_OK;
  306. /* if not new name is given, use the one we stored from the load */
  307. if(!file && altsvc->filename)
  308. file = altsvc->filename;
  309. if((altsvc->flags & CURLALTSVC_READONLYFILE) || !file || !file[0])
  310. /* marked as read-only, no file or zero length file name */
  311. return CURLE_OK;
  312. result = Curl_fopen(data, file, &out, &tempstore);
  313. if(!result) {
  314. fputs("# Your alt-svc cache. https://curl.se/docs/alt-svc.html\n"
  315. "# This file was generated by libcurl! Edit at your own risk.\n",
  316. out);
  317. for(e = altsvc->list.head; e; e = n) {
  318. struct altsvc *as = e->ptr;
  319. n = e->next;
  320. result = altsvc_out(as, out);
  321. if(result)
  322. break;
  323. }
  324. fclose(out);
  325. if(!result && tempstore && Curl_rename(tempstore, file))
  326. result = CURLE_WRITE_ERROR;
  327. if(result && tempstore)
  328. unlink(tempstore);
  329. }
  330. free(tempstore);
  331. return result;
  332. }
  333. static CURLcode getalnum(const char **ptr, char *alpnbuf, size_t buflen)
  334. {
  335. size_t len;
  336. const char *protop;
  337. const char *p = *ptr;
  338. while(*p && ISBLANK(*p))
  339. p++;
  340. protop = p;
  341. while(*p && !ISBLANK(*p) && (*p != ';') && (*p != '='))
  342. p++;
  343. len = p - protop;
  344. *ptr = p;
  345. if(!len || (len >= buflen))
  346. return CURLE_BAD_FUNCTION_ARGUMENT;
  347. memcpy(alpnbuf, protop, len);
  348. alpnbuf[len] = 0;
  349. return CURLE_OK;
  350. }
  351. /* hostcompare() returns true if 'host' matches 'check'. The first host
  352. * argument may have a trailing dot present that will be ignored.
  353. */
  354. static bool hostcompare(const char *host, const char *check)
  355. {
  356. size_t hlen = strlen(host);
  357. size_t clen = strlen(check);
  358. if(hlen && (host[hlen - 1] == '.'))
  359. hlen--;
  360. if(hlen != clen)
  361. /* they can't match if they have different lengths */
  362. return FALSE;
  363. return strncasecompare(host, check, hlen);
  364. }
  365. /* altsvc_flush() removes all alternatives for this source origin from the
  366. list */
  367. static void altsvc_flush(struct altsvcinfo *asi, enum alpnid srcalpnid,
  368. const char *srchost, unsigned short srcport)
  369. {
  370. struct Curl_llist_element *e;
  371. struct Curl_llist_element *n;
  372. for(e = asi->list.head; e; e = n) {
  373. struct altsvc *as = e->ptr;
  374. n = e->next;
  375. if((srcalpnid == as->src.alpnid) &&
  376. (srcport == as->src.port) &&
  377. hostcompare(srchost, as->src.host)) {
  378. Curl_llist_remove(&asi->list, e, NULL);
  379. altsvc_free(as);
  380. }
  381. }
  382. }
  383. #ifdef DEBUGBUILD
  384. /* to play well with debug builds, we can *set* a fixed time this will
  385. return */
  386. static time_t altsvc_debugtime(void *unused)
  387. {
  388. char *timestr = getenv("CURL_TIME");
  389. (void)unused;
  390. if(timestr) {
  391. unsigned long val = strtol(timestr, NULL, 10);
  392. return (time_t)val;
  393. }
  394. return time(NULL);
  395. }
  396. #undef time
  397. #define time(x) altsvc_debugtime(x)
  398. #endif
  399. #define ISNEWLINE(x) (((x) == '\n') || (x) == '\r')
  400. /*
  401. * Curl_altsvc_parse() takes an incoming alt-svc response header and stores
  402. * the data correctly in the cache.
  403. *
  404. * 'value' points to the header *value*. That's contents to the right of the
  405. * header name.
  406. *
  407. * Currently this function rejects invalid data without returning an error.
  408. * Invalid host name, port number will result in the specific alternative
  409. * being rejected. Unknown protocols are skipped.
  410. */
  411. CURLcode Curl_altsvc_parse(struct Curl_easy *data,
  412. struct altsvcinfo *asi, const char *value,
  413. enum alpnid srcalpnid, const char *srchost,
  414. unsigned short srcport)
  415. {
  416. const char *p = value;
  417. size_t len;
  418. char namebuf[MAX_ALTSVC_HOSTLEN] = "";
  419. char alpnbuf[MAX_ALTSVC_ALPNLEN] = "";
  420. struct altsvc *as;
  421. unsigned short dstport = srcport; /* the same by default */
  422. CURLcode result = getalnum(&p, alpnbuf, sizeof(alpnbuf));
  423. size_t entries = 0;
  424. #ifdef CURL_DISABLE_VERBOSE_STRINGS
  425. (void)data;
  426. #endif
  427. if(result) {
  428. infof(data, "Excessive alt-svc header, ignoring.");
  429. return CURLE_OK;
  430. }
  431. DEBUGASSERT(asi);
  432. /* "clear" is a magic keyword */
  433. if(strcasecompare(alpnbuf, "clear")) {
  434. /* Flush cached alternatives for this source origin */
  435. altsvc_flush(asi, srcalpnid, srchost, srcport);
  436. return CURLE_OK;
  437. }
  438. do {
  439. if(*p == '=') {
  440. /* [protocol]="[host][:port]" */
  441. enum alpnid dstalpnid = alpn2alpnid(alpnbuf); /* the same by default */
  442. p++;
  443. if(*p == '\"') {
  444. const char *dsthost = "";
  445. const char *value_ptr;
  446. char option[32];
  447. unsigned long num;
  448. char *end_ptr;
  449. bool quoted = FALSE;
  450. time_t maxage = 24 * 3600; /* default is 24 hours */
  451. bool persist = FALSE;
  452. bool valid = TRUE;
  453. p++;
  454. if(*p != ':') {
  455. /* host name starts here */
  456. const char *hostp = p;
  457. while(*p && (ISALNUM(*p) || (*p == '.') || (*p == '-')))
  458. p++;
  459. len = p - hostp;
  460. if(!len || (len >= MAX_ALTSVC_HOSTLEN)) {
  461. infof(data, "Excessive alt-svc host name, ignoring.");
  462. valid = FALSE;
  463. }
  464. else {
  465. memcpy(namebuf, hostp, len);
  466. namebuf[len] = 0;
  467. dsthost = namebuf;
  468. }
  469. }
  470. else {
  471. /* no destination name, use source host */
  472. dsthost = srchost;
  473. }
  474. if(*p == ':') {
  475. unsigned long port = 0;
  476. p++;
  477. if(ISDIGIT(*p))
  478. /* a port number */
  479. port = strtoul(p, &end_ptr, 10);
  480. else
  481. end_ptr = (char *)p; /* not left uninitialized */
  482. if(!port || port > USHRT_MAX || end_ptr == p || *end_ptr != '\"') {
  483. infof(data, "Unknown alt-svc port number, ignoring.");
  484. valid = FALSE;
  485. }
  486. else {
  487. dstport = curlx_ultous(port);
  488. p = end_ptr;
  489. }
  490. }
  491. if(*p++ != '\"')
  492. break;
  493. /* Handle the optional 'ma' and 'persist' flags. Unknown flags
  494. are skipped. */
  495. for(;;) {
  496. while(ISBLANK(*p))
  497. p++;
  498. if(*p != ';')
  499. break;
  500. p++; /* pass the semicolon */
  501. if(!*p || ISNEWLINE(*p))
  502. break;
  503. result = getalnum(&p, option, sizeof(option));
  504. if(result) {
  505. /* skip option if name is too long */
  506. option[0] = '\0';
  507. }
  508. while(*p && ISBLANK(*p))
  509. p++;
  510. if(*p != '=')
  511. return CURLE_OK;
  512. p++;
  513. while(*p && ISBLANK(*p))
  514. p++;
  515. if(!*p)
  516. return CURLE_OK;
  517. if(*p == '\"') {
  518. /* quoted value */
  519. p++;
  520. quoted = TRUE;
  521. }
  522. value_ptr = p;
  523. if(quoted) {
  524. while(*p && *p != '\"')
  525. p++;
  526. if(!*p++)
  527. return CURLE_OK;
  528. }
  529. else {
  530. while(*p && !ISBLANK(*p) && *p!= ';' && *p != ',')
  531. p++;
  532. }
  533. num = strtoul(value_ptr, &end_ptr, 10);
  534. if((end_ptr != value_ptr) && (num < ULONG_MAX)) {
  535. if(strcasecompare("ma", option))
  536. maxage = num;
  537. else if(strcasecompare("persist", option) && (num == 1))
  538. persist = TRUE;
  539. }
  540. }
  541. if(dstalpnid && valid) {
  542. if(!entries++)
  543. /* Flush cached alternatives for this source origin, if any - when
  544. this is the first entry of the line. */
  545. altsvc_flush(asi, srcalpnid, srchost, srcport);
  546. as = altsvc_createid(srchost, dsthost,
  547. srcalpnid, dstalpnid,
  548. srcport, dstport);
  549. if(as) {
  550. /* The expires time also needs to take the Age: value (if any) into
  551. account. [See RFC 7838 section 3.1] */
  552. as->expires = maxage + time(NULL);
  553. as->persist = persist;
  554. Curl_llist_insert_next(&asi->list, asi->list.tail, as, &as->node);
  555. infof(data, "Added alt-svc: %s:%d over %s", dsthost, dstport,
  556. Curl_alpnid2str(dstalpnid));
  557. }
  558. }
  559. }
  560. else
  561. break;
  562. /* after the double quote there can be a comma if there's another
  563. string or a semicolon if no more */
  564. if(*p == ',') {
  565. /* comma means another alternative is presented */
  566. p++;
  567. result = getalnum(&p, alpnbuf, sizeof(alpnbuf));
  568. if(result)
  569. break;
  570. }
  571. }
  572. else
  573. break;
  574. } while(*p && (*p != ';') && (*p != '\n') && (*p != '\r'));
  575. return CURLE_OK;
  576. }
  577. /*
  578. * Return TRUE on a match
  579. */
  580. bool Curl_altsvc_lookup(struct altsvcinfo *asi,
  581. enum alpnid srcalpnid, const char *srchost,
  582. int srcport,
  583. struct altsvc **dstentry,
  584. const int versions) /* one or more bits */
  585. {
  586. struct Curl_llist_element *e;
  587. struct Curl_llist_element *n;
  588. time_t now = time(NULL);
  589. DEBUGASSERT(asi);
  590. DEBUGASSERT(srchost);
  591. DEBUGASSERT(dstentry);
  592. for(e = asi->list.head; e; e = n) {
  593. struct altsvc *as = e->ptr;
  594. n = e->next;
  595. if(as->expires < now) {
  596. /* an expired entry, remove */
  597. Curl_llist_remove(&asi->list, e, NULL);
  598. altsvc_free(as);
  599. continue;
  600. }
  601. if((as->src.alpnid == srcalpnid) &&
  602. hostcompare(srchost, as->src.host) &&
  603. (as->src.port == srcport) &&
  604. (versions & as->dst.alpnid)) {
  605. /* match */
  606. *dstentry = as;
  607. return TRUE;
  608. }
  609. }
  610. return FALSE;
  611. }
  612. #endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_ALTSVC */