1diff --git a/src/third_party/curl/COPYING b/src/third_party/curl/COPYING
2--- a/src/third_party/curl/COPYING
3+++ b/src/third_party/curl/COPYING
4@@ -1,11 +1,12 @@
5 COPYRIGHT AND PERMISSION NOTICE
6
7-Copyright (c) 1996 - 2011, Daniel Stenberg, <daniel@haxx.se>.
8+Copyright (c) 1996 - 2019, Daniel Stenberg, <daniel@haxx.se>, and many
9+contributors, see the THANKS file.
10
11 All rights reserved.
12
13 Permission to use, copy, modify, and distribute this software for any purpose
14 with or without fee is hereby granted, provided that the above copyright
15 notice and this permission notice appear in all copies.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18@@ -14,9 +15,8 @@ FITNESS FOR A PARTICULAR PURPOSE AND NON
19 NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
22 OR OTHER DEALINGS IN THE SOFTWARE.
23
24 Except as contained in this notice, the name of a copyright holder shall not
25 be used in advertising or otherwise to promote the sale, use or other dealings
26 in this Software without prior written authorization of the copyright holder.
27-
28diff --git a/src/third_party/curl/curl.h b/src/third_party/curl/curl.h
29--- a/src/third_party/curl/curl.h
30+++ b/src/third_party/curl/curl.h
31@@ -2,234 +2,402 @@
32 #define __CURL_CURL_H
33 /***************************************************************************
34  *                                  _   _ ____  _
35  *  Project                     ___| | | |  _ \| |
36  *                             / __| | | | |_) | |
37  *                            | (__| |_| |  _ <| |___
38  *                             \___|\___/|_| \_\_____|
39  *
40- * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
41+ * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
42  *
43  * This software is licensed as described in the file COPYING, which
44  * you should have received as part of this distribution. The terms
45- * are also available at http://curl.haxx.se/docs/copyright.html.
46+ * are also available at https://curl.haxx.se/docs/copyright.html.
47  *
48  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
49  * copies of the Software, and permit persons to whom the Software is
50  * furnished to do so, under the terms of the COPYING file.
51  *
52  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
53  * KIND, either express or implied.
54  *
55- * $Id: curl.h,v 1.396 2009-10-16 13:30:31 yangtse Exp $
56  ***************************************************************************/
57
58 /*
59  * If you have libcurl problems, all docs and details are found here:
60- *   http://curl.haxx.se/libcurl/
61+ *   https://curl.haxx.se/libcurl/
62  *
63  * curl-library mailing list subscription and unsubscription web interface:
64- *   http://cool.haxx.se/mailman/listinfo/curl-library/
65+ *   https://cool.haxx.se/mailman/listinfo/curl-library/
66  */
67
68-/*
69- * Leading 'curl' path on the 'curlbuild.h' include statement is
70- * required to properly allow building outside of the source tree,
71- * due to the fact that in this case 'curlbuild.h' is generated in
72- * a subdirectory of the build tree while 'curl.h actually remains
73- * in a subdirectory of the source tree.
74- */
75-
76-#include "third_party/curl/curlver.h"         /* libcurl version defines   */
77-#include "third_party/curl/curlbuild.h"       /* libcurl build definitions */
78-#include "third_party/curl/curlrules.h"       /* libcurl rules enforcement */
79+#ifdef CURL_NO_OLDIES
80+#define CURL_STRICTER
81+#endif
82+
83+#include "curlver.h"         /* libcurl version defines   */
84+#include "system.h"          /* determine things run-time */
85
86 /*
87  * Define WIN32 when build target is Win32 API
88  */
89
90 #if (defined(_WIN32) || defined(__WIN32__)) && \
91      !defined(WIN32) && !defined(__SYMBIAN32__)
92 #define WIN32
93 #endif
94
95 #include <stdio.h>
96 #include <limits.h>
97
98+#if defined(__FreeBSD__) && (__FreeBSD__ >= 2)
99+/* Needed for __FreeBSD_version symbol definition */
100+#include <osreldate.h>
101+#endif
102+
103 /* The include stuff here below is mainly for time_t! */
104 #include <sys/types.h>
105 #include <time.h>
106
107-#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__GNUC__) && \
108-  !defined(__CYGWIN__) || defined(__MINGW32__)
109-#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H))
110+#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__)
111+#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || \
112+      defined(__LWIP_OPT_H__) || defined(LWIP_HDR_OPT_H))
113 /* The check above prevents the winsock2 inclusion if winsock.h already was
114    included, since they can't co-exist without problems */
115 #include <winsock2.h>
116 #include <ws2tcpip.h>
117 #endif
118-#else
119+#endif
120
121 /* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
122-   libc5-based Linux systems. Only include it on system that are known to
123+   libc5-based Linux systems. Only include it on systems that are known to
124    require it! */
125 #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
126     defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \
127-    defined(__ANDROID__)
128+    defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \
129+    defined(__CYGWIN__) || \
130+   (defined(__FreeBSD_version) && (__FreeBSD_version < 800000))
131 #include <sys/select.h>
132 #endif
133
134-#ifndef _WIN32_WCE
135+#if !defined(WIN32) && !defined(_WIN32_WCE)
136 #include <sys/socket.h>
137 #endif
138+
139 #if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__)
140 #include <sys/time.h>
141 #endif
142-#include <sys/types.h>
143-#endif
144
145 #ifdef __BEOS__
146 #include <support/SupportDefs.h>
147 #endif
148
149+/* Compatibility for non-Clang compilers */
150+#ifndef __has_declspec_attribute
151+#  define __has_declspec_attribute(x) 0
152+#endif
153+
154 #ifdef  __cplusplus
155 extern "C" {
156 #endif
157
158+#if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER)
159+typedef struct Curl_easy CURL;
160+typedef struct Curl_share CURLSH;
161+#else
162 typedef void CURL;
163+typedef void CURLSH;
164+#endif
165
166 /*
167- * Decorate exportable functions for Win32 and Symbian OS DLL linking.
168- * This avoids using a .def file for building libcurl.dll.
169+ * libcurl external API function linkage decorations.
170  */
171-#if (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) && \
172-     !defined(CURL_STATICLIB)
173-#if defined(BUILDING_LIBCURL)
174-#define CURL_EXTERN  __declspec(dllexport)
175-#else
176-#define CURL_EXTERN  __declspec(dllimport)
177-#endif
178+
179+#ifdef CURL_STATICLIB
180+#  define CURL_EXTERN
181+#elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__) || \
182+     (__has_declspec_attribute(dllexport) && \
183+      __has_declspec_attribute(dllimport))
184+#  if defined(BUILDING_LIBCURL)
185+#    define CURL_EXTERN  __declspec(dllexport)
186+#  else
187+#    define CURL_EXTERN  __declspec(dllimport)
188+#  endif
189+#elif defined(BUILDING_LIBCURL) && defined(CURL_HIDDEN_SYMBOLS)
190+#  define CURL_EXTERN CURL_EXTERN_SYMBOL
191 #else
192-
193-#ifdef CURL_HIDDEN_SYMBOLS
194-/*
195- * This definition is used to make external definitions visible in the
196- * shared library when symbols are hidden by default.  It makes no
197- * difference when compiling applications whether this is set or not,
198- * only when compiling the library.
199- */
200-#define CURL_EXTERN CURL_EXTERN_SYMBOL
201-#else
202-#define CURL_EXTERN
203-#endif
204+#  define CURL_EXTERN
205 #endif
206
207 #ifndef curl_socket_typedef
208 /* socket typedef */
209-#ifdef WIN32
210+#if defined(WIN32) && !defined(__LWIP_OPT_H__) && !defined(LWIP_HDR_OPT_H)
211 typedef SOCKET curl_socket_t;
212 #define CURL_SOCKET_BAD INVALID_SOCKET
213 #else
214 typedef int curl_socket_t;
215 #define CURL_SOCKET_BAD -1
216 #endif
217 #define curl_socket_typedef
218 #endif /* curl_socket_typedef */
219
220+/* enum for the different supported SSL backends */
221+typedef enum {
222+  CURLSSLBACKEND_NONE = 0,
223+  CURLSSLBACKEND_OPENSSL = 1,
224+  CURLSSLBACKEND_GNUTLS = 2,
225+  CURLSSLBACKEND_NSS = 3,
226+  CURLSSLBACKEND_OBSOLETE4 = 4,  /* Was QSOSSL. */
227+  CURLSSLBACKEND_GSKIT = 5,
228+  CURLSSLBACKEND_POLARSSL = 6,
229+  CURLSSLBACKEND_WOLFSSL = 7,
230+  CURLSSLBACKEND_SCHANNEL = 8,
231+  CURLSSLBACKEND_SECURETRANSPORT = 9,
232+  CURLSSLBACKEND_AXTLS = 10, /* never used since 7.63.0 */
233+  CURLSSLBACKEND_MBEDTLS = 11,
234+  CURLSSLBACKEND_MESALINK = 12
235+} curl_sslbackend;
236+
237+/* aliases for library clones and renames */
238+#define CURLSSLBACKEND_LIBRESSL CURLSSLBACKEND_OPENSSL
239+#define CURLSSLBACKEND_BORINGSSL CURLSSLBACKEND_OPENSSL
240+
241+/* deprecated names: */
242+#define CURLSSLBACKEND_CYASSL CURLSSLBACKEND_WOLFSSL
243+#define CURLSSLBACKEND_DARWINSSL CURLSSLBACKEND_SECURETRANSPORT
244+
245 struct curl_httppost {
246   struct curl_httppost *next;       /* next entry in the list */
247   char *name;                       /* pointer to allocated name */
248   long namelength;                  /* length of name length */
249   char *contents;                   /* pointer to allocated data contents */
250-  long contentslength;              /* length of contents field */
251+  long contentslength;              /* length of contents field, see also
252+                                       CURL_HTTPPOST_LARGE */
253   char *buffer;                     /* pointer to allocated buffer contents */
254   long bufferlength;                /* length of buffer field */
255   char *contenttype;                /* Content-Type */
256-  struct curl_slist* contentheader; /* list of extra headers for this form */
257+  struct curl_slist *contentheader; /* list of extra headers for this form */
258   struct curl_httppost *more;       /* if one field name has more than one
259                                        file, this link should link to following
260                                        files */
261   long flags;                       /* as defined below */
262-#define HTTPPOST_FILENAME (1<<0)    /* specified content is a file name */
263-#define HTTPPOST_READFILE (1<<1)    /* specified content is a file name */
264-#define HTTPPOST_PTRNAME (1<<2)     /* name is only stored pointer
265-                                       do not free in formfree */
266-#define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer
267-                                       do not free in formfree */
268-#define HTTPPOST_BUFFER (1<<4)      /* upload file from buffer */
269-#define HTTPPOST_PTRBUFFER (1<<5)   /* upload file from pointer contents */
270-#define HTTPPOST_CALLBACK (1<<6)    /* upload file contents by using the
271-                                       regular read callback to get the data
272-                                       and pass the given pointer as custom
273-                                       pointer */
274+
275+/* specified content is a file name */
276+#define CURL_HTTPPOST_FILENAME (1<<0)
277+/* specified content is a file name */
278+#define CURL_HTTPPOST_READFILE (1<<1)
279+/* name is only stored pointer do not free in formfree */
280+#define CURL_HTTPPOST_PTRNAME (1<<2)
281+/* contents is only stored pointer do not free in formfree */
282+#define CURL_HTTPPOST_PTRCONTENTS (1<<3)
283+/* upload file from buffer */
284+#define CURL_HTTPPOST_BUFFER (1<<4)
285+/* upload file from pointer contents */
286+#define CURL_HTTPPOST_PTRBUFFER (1<<5)
287+/* upload file contents by using the regular read callback to get the data and
288+   pass the given pointer as custom pointer */
289+#define CURL_HTTPPOST_CALLBACK (1<<6)
290+/* use size in 'contentlen', added in 7.46.0 */
291+#define CURL_HTTPPOST_LARGE (1<<7)
292
293   char *showfilename;               /* The file name to show. If not set, the
294                                        actual file name will be used (if this
295                                        is a file part) */
296   void *userp;                      /* custom pointer used for
297                                        HTTPPOST_CALLBACK posts */
298+  curl_off_t contentlen;            /* alternative length of contents
299+                                       field. Used if CURL_HTTPPOST_LARGE is
300+                                       set. Added in 7.46.0 */
301 };
302
303+/* This is the CURLOPT_PROGRESSFUNCTION callback proto. It is now considered
304+   deprecated but was the only choice up until 7.31.0 */
305 typedef int (*curl_progress_callback)(void *clientp,
306                                       double dltotal,
307                                       double dlnow,
308                                       double ultotal,
309                                       double ulnow);
310
311+/* This is the CURLOPT_XFERINFOFUNCTION callback proto. It was introduced in
312+   7.32.0, it avoids floating point and provides more detailed information. */
313+typedef int (*curl_xferinfo_callback)(void *clientp,
314+                                      curl_off_t dltotal,
315+                                      curl_off_t dlnow,
316+                                      curl_off_t ultotal,
317+                                      curl_off_t ulnow);
318+
319+#ifndef CURL_MAX_READ_SIZE
320+  /* The maximum receive buffer size configurable via CURLOPT_BUFFERSIZE. */
321+#define CURL_MAX_READ_SIZE 524288
322+#endif
323+
324 #ifndef CURL_MAX_WRITE_SIZE
325   /* Tests have proven that 20K is a very bad buffer size for uploads on
326      Windows, while 16K for some odd reason performed a lot better.
327      We do the ifndef check to allow this value to easier be changed at build
328-     time for those who feel adventurous. */
329+     time for those who feel adventurous. The practical minimum is about
330+     400 bytes since libcurl uses a buffer of this size as a scratch area
331+     (unrelated to network send operations). */
332 #define CURL_MAX_WRITE_SIZE 16384
333 #endif
334
335 #ifndef CURL_MAX_HTTP_HEADER
336 /* The only reason to have a max limit for this is to avoid the risk of a bad
337    server feeding libcurl with a never-ending header that will cause reallocs
338    infinitely */
339 #define CURL_MAX_HTTP_HEADER (100*1024)
340 #endif
341
342-
343 /* This is a magic return code for the write callback that, when returned,
344    will signal libcurl to pause receiving on the current transfer. */
345 #define CURL_WRITEFUNC_PAUSE 0x10000001
346+
347 typedef size_t (*curl_write_callback)(char *buffer,
348                                       size_t size,
349                                       size_t nitems,
350                                       void *outstream);
351
352+/* This callback will be called when a new resolver request is made */
353+typedef int (*curl_resolver_start_callback)(void *resolver_state,
354+                                            void *reserved, void *userdata);
355+
356+/* enumeration of file types */
357+typedef enum {
358+  CURLFILETYPE_FILE = 0,
359+  CURLFILETYPE_DIRECTORY,
360+  CURLFILETYPE_SYMLINK,
361+  CURLFILETYPE_DEVICE_BLOCK,
362+  CURLFILETYPE_DEVICE_CHAR,
363+  CURLFILETYPE_NAMEDPIPE,
364+  CURLFILETYPE_SOCKET,
365+  CURLFILETYPE_DOOR, /* is possible only on Sun Solaris now */
366+
367+  CURLFILETYPE_UNKNOWN /* should never occur */
368+} curlfiletype;
369+
370+#define CURLFINFOFLAG_KNOWN_FILENAME    (1<<0)
371+#define CURLFINFOFLAG_KNOWN_FILETYPE    (1<<1)
372+#define CURLFINFOFLAG_KNOWN_TIME        (1<<2)
373+#define CURLFINFOFLAG_KNOWN_PERM        (1<<3)
374+#define CURLFINFOFLAG_KNOWN_UID         (1<<4)
375+#define CURLFINFOFLAG_KNOWN_GID         (1<<5)
376+#define CURLFINFOFLAG_KNOWN_SIZE        (1<<6)
377+#define CURLFINFOFLAG_KNOWN_HLINKCOUNT  (1<<7)
378+
379+/* Content of this structure depends on information which is known and is
380+   achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man
381+   page for callbacks returning this structure -- some fields are mandatory,
382+   some others are optional. The FLAG field has special meaning. */
383+struct curl_fileinfo {
384+  char *filename;
385+  curlfiletype filetype;
386+  time_t time;
387+  unsigned int perm;
388+  int uid;
389+  int gid;
390+  curl_off_t size;
391+  long int hardlinks;
392+
393+  struct {
394+    /* If some of these fields is not NULL, it is a pointer to b_data. */
395+    char *time;
396+    char *perm;
397+    char *user;
398+    char *group;
399+    char *target; /* pointer to the target filename of a symlink */
400+  } strings;
401+
402+  unsigned int flags;
403+
404+  /* used internally */
405+  char *b_data;
406+  size_t b_size;
407+  size_t b_used;
408+};
409+
410+/* return codes for CURLOPT_CHUNK_BGN_FUNCTION */
411+#define CURL_CHUNK_BGN_FUNC_OK      0
412+#define CURL_CHUNK_BGN_FUNC_FAIL    1 /* tell the lib to end the task */
413+#define CURL_CHUNK_BGN_FUNC_SKIP    2 /* skip this chunk over */
414+
415+/* if splitting of data transfer is enabled, this callback is called before
416+   download of an individual chunk started. Note that parameter "remains" works
417+   only for FTP wildcard downloading (for now), otherwise is not used */
418+typedef long (*curl_chunk_bgn_callback)(const void *transfer_info,
419+                                        void *ptr,
420+                                        int remains);
421+
422+/* return codes for CURLOPT_CHUNK_END_FUNCTION */
423+#define CURL_CHUNK_END_FUNC_OK      0
424+#define CURL_CHUNK_END_FUNC_FAIL    1 /* tell the lib to end the task */
425+
426+/* If splitting of data transfer is enabled this callback is called after
427+   download of an individual chunk finished.
428+   Note! After this callback was set then it have to be called FOR ALL chunks.
429+   Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC.
430+   This is the reason why we don't need "transfer_info" parameter in this
431+   callback and we are not interested in "remains" parameter too. */
432+typedef long (*curl_chunk_end_callback)(void *ptr);
433+
434+/* return codes for FNMATCHFUNCTION */
435+#define CURL_FNMATCHFUNC_MATCH    0 /* string corresponds to the pattern */
436+#define CURL_FNMATCHFUNC_NOMATCH  1 /* pattern doesn't match the string */
437+#define CURL_FNMATCHFUNC_FAIL     2 /* an error occurred */
438+
439+/* callback type for wildcard downloading pattern matching. If the
440+   string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */
441+typedef int (*curl_fnmatch_callback)(void *ptr,
442+                                     const char *pattern,
443+                                     const char *string);
444+
445 /* These are the return codes for the seek callbacks */
446 #define CURL_SEEKFUNC_OK       0
447 #define CURL_SEEKFUNC_FAIL     1 /* fail the entire transfer */
448 #define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so
449                                     libcurl might try other means instead */
450 typedef int (*curl_seek_callback)(void *instream,
451                                   curl_off_t offset,
452                                   int origin); /* 'whence' */
453
454 /* This is a return code for the read callback that, when returned, will
455    signal libcurl to immediately abort the current transfer. */
456 #define CURL_READFUNC_ABORT 0x10000000
457 /* This is a return code for the read callback that, when returned, will
458    signal libcurl to pause sending data on the current transfer. */
459 #define CURL_READFUNC_PAUSE 0x10000001
460
461+/* Return code for when the trailing headers' callback has terminated
462+   without any errors*/
463+#define CURL_TRAILERFUNC_OK 0
464+/* Return code for when was an error in the trailing header's list and we
465+  want to abort the request */
466+#define CURL_TRAILERFUNC_ABORT 1
467+
468 typedef size_t (*curl_read_callback)(char *buffer,
469                                       size_t size,
470                                       size_t nitems,
471                                       void *instream);
472
473-typedef enum  {
474-  CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */
475-  CURLSOCKTYPE_LAST   /* never use */
476+typedef int (*curl_trailer_callback)(struct curl_slist **list,
477+                                      void *userdata);
478+
479+typedef enum {
480+  CURLSOCKTYPE_IPCXN,  /* socket created for a specific IP connection */
481+  CURLSOCKTYPE_ACCEPT, /* socket created by accept() call */
482+  CURLSOCKTYPE_LAST    /* never use */
483 } curlsocktype;
484
485+/* The return code from the sockopt_callback can signal information back
486+   to libcurl: */
487+#define CURL_SOCKOPT_OK 0
488+#define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return
489+                                CURLE_ABORTED_BY_CALLBACK */
490+#define CURL_SOCKOPT_ALREADY_CONNECTED 2
491+
492 typedef int (*curl_sockopt_callback)(void *clientp,
493                                      curl_socket_t curlfd,
494                                      curlsocktype purpose);
495
496 struct curl_sockaddr {
497   int family;
498   int socktype;
499   int protocol;
500@@ -239,53 +407,52 @@ struct curl_sockaddr {
501   struct sockaddr addr;
502 };
503
504 typedef curl_socket_t
505 (*curl_opensocket_callback)(void *clientp,
506                             curlsocktype purpose,
507                             struct curl_sockaddr *address);
508
509-#ifndef CURL_NO_OLDIES
510-  /* not used since 7.10.8, will be removed in a future release */
511-typedef int (*curl_passwd_callback)(void *clientp,
512-                                    const char *prompt,
513-                                    char *buffer,
514-                                    int buflen);
515-#endif
516+typedef int
517+(*curl_closesocket_callback)(void *clientp, curl_socket_t item);
518
519 typedef enum {
520   CURLIOE_OK,            /* I/O operation successful */
521   CURLIOE_UNKNOWNCMD,    /* command was unknown to callback */
522   CURLIOE_FAILRESTART,   /* failed to restart the read */
523   CURLIOE_LAST           /* never use */
524 } curlioerr;
525
526-typedef enum  {
527+typedef enum {
528   CURLIOCMD_NOP,         /* no operation */
529   CURLIOCMD_RESTARTREAD, /* restart the read stream from start */
530   CURLIOCMD_LAST         /* never use */
531 } curliocmd;
532
533 typedef curlioerr (*curl_ioctl_callback)(CURL *handle,
534                                          int cmd,
535                                          void *clientp);
536
537+#ifndef CURL_DID_MEMORY_FUNC_TYPEDEFS
538 /*
539  * The following typedef's are signatures of malloc, free, realloc, strdup and
540  * calloc respectively.  Function pointers of these types can be passed to the
541  * curl_global_init_mem() function to set user defined memory management
542  * callback routines.
543  */
544 typedef void *(*curl_malloc_callback)(size_t size);
545 typedef void (*curl_free_callback)(void *ptr);
546 typedef void *(*curl_realloc_callback)(void *ptr, size_t size);
547 typedef char *(*curl_strdup_callback)(const char *str);
548 typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size);
549
550+#define CURL_DID_MEMORY_FUNC_TYPEDEFS
551+#endif
552+
553 /* the kind of data that is passed to information_callback*/
554 typedef enum {
555   CURLINFO_TEXT = 0,
556   CURLINFO_HEADER_IN,    /* 1 */
557   CURLINFO_HEADER_OUT,   /* 2 */
558   CURLINFO_DATA_IN,      /* 3 */
559   CURLINFO_DATA_OUT,     /* 4 */
560   CURLINFO_SSL_DATA_IN,  /* 5 */
561@@ -307,31 +474,37 @@ typedef int (*curl_debug_callback)
562    codes must remain the same!
563  */
564
565 typedef enum {
566   CURLE_OK = 0,
567   CURLE_UNSUPPORTED_PROTOCOL,    /* 1 */
568   CURLE_FAILED_INIT,             /* 2 */
569   CURLE_URL_MALFORMAT,           /* 3 */
570-  CURLE_OBSOLETE4,               /* 4 - NOT USED */
571+  CURLE_NOT_BUILT_IN,            /* 4 - [was obsoleted in August 2007 for
572+                                    7.17.0, reused in April 2011 for 7.21.5] */
573   CURLE_COULDNT_RESOLVE_PROXY,   /* 5 */
574   CURLE_COULDNT_RESOLVE_HOST,    /* 6 */
575   CURLE_COULDNT_CONNECT,         /* 7 */
576-  CURLE_FTP_WEIRD_SERVER_REPLY,  /* 8 */
577+  CURLE_WEIRD_SERVER_REPLY,      /* 8 */
578   CURLE_REMOTE_ACCESS_DENIED,    /* 9 a service was denied by the server
579                                     due to lack of access - when login fails
580                                     this is not returned. */
581-  CURLE_OBSOLETE10,              /* 10 - NOT USED */
582+  CURLE_FTP_ACCEPT_FAILED,       /* 10 - [was obsoleted in April 2006 for
583+                                    7.15.4, reused in Dec 2011 for 7.24.0]*/
584   CURLE_FTP_WEIRD_PASS_REPLY,    /* 11 */
585-  CURLE_OBSOLETE12,              /* 12 - NOT USED */
586+  CURLE_FTP_ACCEPT_TIMEOUT,      /* 12 - timeout occurred accepting server
587+                                    [was obsoleted in August 2007 for 7.17.0,
588+                                    reused in Dec 2011 for 7.24.0]*/
589   CURLE_FTP_WEIRD_PASV_REPLY,    /* 13 */
590   CURLE_FTP_WEIRD_227_FORMAT,    /* 14 */
591   CURLE_FTP_CANT_GET_HOST,       /* 15 */
592-  CURLE_OBSOLETE16,              /* 16 - NOT USED */
593+  CURLE_HTTP2,                   /* 16 - A problem in the http2 framing layer.
594+                                    [was obsoleted in August 2007 for 7.17.0,
595+                                    reused in July 2014 for 7.38.0] */
596   CURLE_FTP_COULDNT_SET_TYPE,    /* 17 */
597   CURLE_PARTIAL_FILE,            /* 18 */
598   CURLE_FTP_COULDNT_RETR_FILE,   /* 19 */
599   CURLE_OBSOLETE20,              /* 20 - NOT USED */
600   CURLE_QUOTE_ERROR,             /* 21 - quote command failure */
601   CURLE_HTTP_RETURNED_ERROR,     /* 22 */
602   CURLE_WRITE_ERROR,             /* 23 */
603   CURLE_OBSOLETE24,              /* 24 - NOT USED */
604@@ -350,39 +523,39 @@ typedef enum {
605   CURLE_RANGE_ERROR,             /* 33 - RANGE "command" didn't work */
606   CURLE_HTTP_POST_ERROR,         /* 34 */
607   CURLE_SSL_CONNECT_ERROR,       /* 35 - wrong when connecting with SSL */
608   CURLE_BAD_DOWNLOAD_RESUME,     /* 36 - couldn't resume download */
609   CURLE_FILE_COULDNT_READ_FILE,  /* 37 */
610   CURLE_LDAP_CANNOT_BIND,        /* 38 */
611   CURLE_LDAP_SEARCH_FAILED,      /* 39 */
612   CURLE_OBSOLETE40,              /* 40 - NOT USED */
613-  CURLE_FUNCTION_NOT_FOUND,      /* 41 */
614+  CURLE_FUNCTION_NOT_FOUND,      /* 41 - NOT USED starting with 7.53.0 */
615   CURLE_ABORTED_BY_CALLBACK,     /* 42 */
616   CURLE_BAD_FUNCTION_ARGUMENT,   /* 43 */
617   CURLE_OBSOLETE44,              /* 44 - NOT USED */
618   CURLE_INTERFACE_FAILED,        /* 45 - CURLOPT_INTERFACE failed */
619   CURLE_OBSOLETE46,              /* 46 - NOT USED */
620-  CURLE_TOO_MANY_REDIRECTS ,     /* 47 - catch endless re-direct loops */
621-  CURLE_UNKNOWN_TELNET_OPTION,   /* 48 - User specified an unknown option */
622-  CURLE_TELNET_OPTION_SYNTAX ,   /* 49 - Malformed telnet option */
623+  CURLE_TOO_MANY_REDIRECTS,      /* 47 - catch endless re-direct loops */
624+  CURLE_UNKNOWN_OPTION,          /* 48 - User specified an unknown option */
625+  CURLE_TELNET_OPTION_SYNTAX,    /* 49 - Malformed telnet option */
626   CURLE_OBSOLETE50,              /* 50 - NOT USED */
627-  CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint
628-                                     wasn't verified fine */
629+  CURLE_OBSOLETE51,              /* 51 - NOT USED */
630   CURLE_GOT_NOTHING,             /* 52 - when this is a specific error */
631   CURLE_SSL_ENGINE_NOTFOUND,     /* 53 - SSL crypto engine not found */
632   CURLE_SSL_ENGINE_SETFAILED,    /* 54 - can not set SSL crypto engine as
633                                     default */
634   CURLE_SEND_ERROR,              /* 55 - failed sending network data */
635   CURLE_RECV_ERROR,              /* 56 - failure in receiving network data */
636   CURLE_OBSOLETE57,              /* 57 - NOT IN USE */
637   CURLE_SSL_CERTPROBLEM,         /* 58 - problem with the local certificate */
638   CURLE_SSL_CIPHER,              /* 59 - couldn't use specified cipher */
639-  CURLE_SSL_CACERT,              /* 60 - problem with the CA cert (path?) */
640-  CURLE_BAD_CONTENT_ENCODING,    /* 61 - Unrecognized transfer encoding */
641+  CURLE_PEER_FAILED_VERIFICATION, /* 60 - peer's certificate or fingerprint
642+                                     wasn't verified fine */
643+  CURLE_BAD_CONTENT_ENCODING,    /* 61 - Unrecognized/bad encoding */
644   CURLE_LDAP_INVALID_URL,        /* 62 - Invalid LDAP URL */
645   CURLE_FILESIZE_EXCEEDED,       /* 63 - Maximum file size exceeded */
646   CURLE_USE_SSL_FAILED,          /* 64 - Requested FTP SSL level failed */
647   CURLE_SEND_FAIL_REWIND,        /* 65 - Sending the data requires a rewind
648                                     that failed */
649   CURLE_SSL_ENGINE_INITFAILED,   /* 66 - failed to initialise ENGINE */
650   CURLE_LOGIN_DENIED,            /* 67 - user, password or similar was not
651                                     accepted and we failed to login */
652@@ -410,43 +583,72 @@ typedef enum {
653                                     connection */
654   CURLE_AGAIN,                   /* 81 - socket is not ready for send/recv,
655                                     wait till it's ready and try again (Added
656                                     in 7.18.2) */
657   CURLE_SSL_CRL_BADFILE,         /* 82 - could not load CRL file, missing or
658                                     wrong format (Added in 7.19.0) */
659   CURLE_SSL_ISSUER_ERROR,        /* 83 - Issuer check failed.  (Added in
660                                     7.19.0) */
661+  CURLE_FTP_PRET_FAILED,         /* 84 - a PRET command failed */
662+  CURLE_RTSP_CSEQ_ERROR,         /* 85 - mismatch of RTSP CSeq numbers */
663+  CURLE_RTSP_SESSION_ERROR,      /* 86 - mismatch of RTSP Session Ids */
664+  CURLE_FTP_BAD_FILE_LIST,       /* 87 - unable to parse FTP file list */
665+  CURLE_CHUNK_FAILED,            /* 88 - chunk callback reported error */
666+  CURLE_NO_CONNECTION_AVAILABLE, /* 89 - No connection available, the
667+                                    session will be queued */
668+  CURLE_SSL_PINNEDPUBKEYNOTMATCH, /* 90 - specified pinned public key did not
669+                                     match */
670+  CURLE_SSL_INVALIDCERTSTATUS,   /* 91 - invalid certificate status */
671+  CURLE_HTTP2_STREAM,            /* 92 - stream error in HTTP/2 framing layer
672+                                    */
673+  CURLE_RECURSIVE_API_CALL,      /* 93 - an api function was called from
674+                                    inside a callback */
675   CURL_LAST /* never use! */
676 } CURLcode;
677
678 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
679                           the obsolete stuff removed! */
680
681-/* Backwards compatibility with older names */
682+/* Previously obsolete error code re-used in 7.38.0 */
683+#define CURLE_OBSOLETE16 CURLE_HTTP2
684+
685+/* Previously obsolete error codes re-used in 7.24.0 */
686+#define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED
687+#define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT
688+
689+/*  compatibility with older names */
690+#define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING
691+#define CURLE_FTP_WEIRD_SERVER_REPLY CURLE_WEIRD_SERVER_REPLY
692+
693+/* The following were added in 7.62.0 */
694+#define CURLE_SSL_CACERT CURLE_PEER_FAILED_VERIFICATION
695+
696+/* The following were added in 7.21.5, April 2011 */
697+#define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION
698
699 /* The following were added in 7.17.1 */
700 /* These are scheduled to disappear by 2009 */
701 #define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION
702
703 /* The following were added in 7.17.0 */
704 /* These are scheduled to disappear by 2009 */
705-#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* noone should be using this! */
706+#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */
707 #define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46
708 #define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44
709 #define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10
710 #define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16
711 #define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32
712 #define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29
713 #define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12
714 #define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20
715 #define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40
716 #define CURLE_MALFORMAT_USER CURLE_OBSOLETE24
717 #define CURLE_SHARE_IN_USE CURLE_OBSOLETE57
718-#define CURLE_URL_MALFORMAT_USER CURLE_OBSOLETE4
719+#define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN
720
721 #define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED
722 #define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE
723 #define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR
724 #define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL
725 #define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS
726 #define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR
727 #define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED
728@@ -462,69 +664,115 @@ typedef enum {
729 #define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE
730 #define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME
731
732 /* This was the error code 50 in 7.7.3 and a few earlier versions, this
733    is no longer used by libcurl but is instead #defined here only to not
734    make programs break */
735 #define CURLE_ALREADY_COMPLETE 99999
736
737+/* Provide defines for really old option names */
738+#define CURLOPT_FILE CURLOPT_WRITEDATA /* name changed in 7.9.7 */
739+#define CURLOPT_INFILE CURLOPT_READDATA /* name changed in 7.9.7 */
740+#define CURLOPT_WRITEHEADER CURLOPT_HEADERDATA
741+
742+/* Since long deprecated options with no code in the lib that does anything
743+   with them. */
744+#define CURLOPT_WRITEINFO CURLOPT_OBSOLETE40
745+#define CURLOPT_CLOSEPOLICY CURLOPT_OBSOLETE72
746+
747 #endif /*!CURL_NO_OLDIES*/
748
749 /* This prototype applies to all conversion callbacks */
750 typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length);
751
752 typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl,    /* easy handle */
753                                           void *ssl_ctx, /* actually an
754                                                             OpenSSL SSL_CTX */
755                                           void *userptr);
756
757 typedef enum {
758   CURLPROXY_HTTP = 0,   /* added in 7.10, new in 7.19.4 default is to use
759                            CONNECT HTTP/1.1 */
760   CURLPROXY_HTTP_1_0 = 1,   /* added in 7.19.4, force to use CONNECT
761                                HTTP/1.0  */
762+  CURLPROXY_HTTPS = 2, /* added in 7.52.0 */
763   CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already
764                            in 7.10 */
765   CURLPROXY_SOCKS5 = 5, /* added in 7.10 */
766   CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */
767   CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the
768                                    host name rather than the IP address. added
769                                    in 7.18.0 */
770 } curl_proxytype;  /* this enum was added in 7.10 */
771
772-#define CURLAUTH_NONE         0       /* nothing */
773-#define CURLAUTH_BASIC        (1<<0)  /* Basic (default) */
774-#define CURLAUTH_DIGEST       (1<<1)  /* Digest */
775-#define CURLAUTH_GSSNEGOTIATE (1<<2)  /* GSS-Negotiate */
776-#define CURLAUTH_NTLM         (1<<3)  /* NTLM */
777-#define CURLAUTH_DIGEST_IE    (1<<4)  /* Digest with IE flavour */
778-#define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE)  /* all fine types set */
779-#define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))
780+/*
781+ * Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options:
782+ *
783+ * CURLAUTH_NONE         - No HTTP authentication
784+ * CURLAUTH_BASIC        - HTTP Basic authentication (default)
785+ * CURLAUTH_DIGEST       - HTTP Digest authentication
786+ * CURLAUTH_NEGOTIATE    - HTTP Negotiate (SPNEGO) authentication
787+ * CURLAUTH_GSSNEGOTIATE - Alias for CURLAUTH_NEGOTIATE (deprecated)
788+ * CURLAUTH_NTLM         - HTTP NTLM authentication
789+ * CURLAUTH_DIGEST_IE    - HTTP Digest authentication with IE flavour
790+ * CURLAUTH_NTLM_WB      - HTTP NTLM authentication delegated to winbind helper
791+ * CURLAUTH_BEARER       - HTTP Bearer token authentication
792+ * CURLAUTH_ONLY         - Use together with a single other type to force no
793+ *                         authentication or just that single type
794+ * CURLAUTH_ANY          - All fine types set
795+ * CURLAUTH_ANYSAFE      - All fine types except Basic
796+ */
797+
798+#define CURLAUTH_NONE         ((unsigned long)0)
799+#define CURLAUTH_BASIC        (((unsigned long)1)<<0)
800+#define CURLAUTH_DIGEST       (((unsigned long)1)<<1)
801+#define CURLAUTH_NEGOTIATE    (((unsigned long)1)<<2)
802+/* Deprecated since the advent of CURLAUTH_NEGOTIATE */
803+#define CURLAUTH_GSSNEGOTIATE CURLAUTH_NEGOTIATE
804+/* Used for CURLOPT_SOCKS5_AUTH to stay terminologically correct */
805+#define CURLAUTH_GSSAPI CURLAUTH_NEGOTIATE
806+#define CURLAUTH_NTLM         (((unsigned long)1)<<3)
807+#define CURLAUTH_DIGEST_IE    (((unsigned long)1)<<4)
808+#define CURLAUTH_NTLM_WB      (((unsigned long)1)<<5)
809+#define CURLAUTH_BEARER       (((unsigned long)1)<<6)
810+#define CURLAUTH_ONLY         (((unsigned long)1)<<31)
811+#define CURLAUTH_ANY          (~CURLAUTH_DIGEST_IE)
812+#define CURLAUTH_ANYSAFE      (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))
813
814 #define CURLSSH_AUTH_ANY       ~0     /* all types supported by the server */
815 #define CURLSSH_AUTH_NONE      0      /* none allowed, silly but complete */
816 #define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */
817 #define CURLSSH_AUTH_PASSWORD  (1<<1) /* password */
818 #define CURLSSH_AUTH_HOST      (1<<2) /* host key files */
819 #define CURLSSH_AUTH_KEYBOARD  (1<<3) /* keyboard interactive */
820+#define CURLSSH_AUTH_AGENT     (1<<4) /* agent (ssh-agent, pageant...) */
821+#define CURLSSH_AUTH_GSSAPI    (1<<5) /* gssapi (kerberos, ...) */
822 #define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY
823
824+#define CURLGSSAPI_DELEGATION_NONE        0      /* no delegation (default) */
825+#define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */
826+#define CURLGSSAPI_DELEGATION_FLAG        (1<<1) /* delegate always */
827+
828 #define CURL_ERROR_SIZE 256
829
830+enum curl_khtype {
831+  CURLKHTYPE_UNKNOWN,
832+  CURLKHTYPE_RSA1,
833+  CURLKHTYPE_RSA,
834+  CURLKHTYPE_DSS,
835+  CURLKHTYPE_ECDSA,
836+  CURLKHTYPE_ED25519
837+};
838+
839 struct curl_khkey {
840   const char *key; /* points to a zero-terminated string encoded with base64
841                       if len is zero, otherwise to the "raw" data */
842   size_t len;
843-  enum type {
844-    CURLKHTYPE_UNKNOWN,
845-    CURLKHTYPE_RSA1,
846-    CURLKHTYPE_RSA,
847-    CURLKHTYPE_DSS
848-  } keytype;
849+  enum curl_khtype keytype;
850 };
851
852 /* this is the set of return values expected from the curl_sshkeycallback
853    callback */
854 enum curl_khstat {
855   CURLKHSTAT_FINE_ADD_TO_FILE,
856   CURLKHSTAT_FINE,
857   CURLKHSTAT_REJECT, /* reject the connection, return an error */
858@@ -553,16 +801,37 @@ typedef int
859 typedef enum {
860   CURLUSESSL_NONE,    /* do not attempt to use SSL */
861   CURLUSESSL_TRY,     /* try using SSL, proceed anyway otherwise */
862   CURLUSESSL_CONTROL, /* SSL for the control connection or fail */
863   CURLUSESSL_ALL,     /* SSL for all communication or fail */
864   CURLUSESSL_LAST     /* not an option, never use */
865 } curl_usessl;
866
867+/* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */
868+
869+/* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the
870+   name of improving interoperability with older servers. Some SSL libraries
871+   have introduced work-arounds for this flaw but those work-arounds sometimes
872+   make the SSL communication fail. To regain functionality with those broken
873+   servers, a user can this way allow the vulnerability back. */
874+#define CURLSSLOPT_ALLOW_BEAST (1<<0)
875+
876+/* - NO_REVOKE tells libcurl to disable certificate revocation checks for those
877+   SSL backends where such behavior is present. */
878+#define CURLSSLOPT_NO_REVOKE (1<<1)
879+
880+/* The default connection attempt delay in milliseconds for happy eyeballs.
881+   CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.3 and happy-eyeballs-timeout-ms.d document
882+   this value, keep them in sync. */
883+#define CURL_HET_DEFAULT 200L
884+
885+/* The default connection upkeep interval in milliseconds. */
886+#define CURL_UPKEEP_INTERVAL_DEFAULT 60000L
887+
888 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
889                           the obsolete stuff removed! */
890
891 /* Backwards compatibility with older names */
892 /* These are scheduled to disappear by 2009 */
893
894 #define CURLFTPSSL_NONE CURLUSESSL_NONE
895 #define CURLFTPSSL_TRY CURLUSESSL_TRY
896@@ -603,91 +872,124 @@ typedef enum {
897 typedef enum {
898   CURLFTPMETHOD_DEFAULT,   /* let libcurl pick */
899   CURLFTPMETHOD_MULTICWD,  /* single CWD operation for each path part */
900   CURLFTPMETHOD_NOCWD,     /* no CWD at all */
901   CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */
902   CURLFTPMETHOD_LAST       /* not an option, never use */
903 } curl_ftpmethod;
904
905+/* bitmask defines for CURLOPT_HEADEROPT */
906+#define CURLHEADER_UNIFIED  0
907+#define CURLHEADER_SEPARATE (1<<0)
908+
909+/* CURLALTSVC_* are bits for the CURLOPT_ALTSVC_CTRL option */
910+#define CURLALTSVC_IMMEDIATELY  (1<<0)
911+#define CURLALTSVC_ALTUSED      (1<<1)
912+#define CURLALTSVC_READONLYFILE (1<<2)
913+#define CURLALTSVC_H1           (1<<3)
914+#define CURLALTSVC_H2           (1<<4)
915+#define CURLALTSVC_H3           (1<<5)
916+
917 /* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */
918 #define CURLPROTO_HTTP   (1<<0)
919 #define CURLPROTO_HTTPS  (1<<1)
920 #define CURLPROTO_FTP    (1<<2)
921 #define CURLPROTO_FTPS   (1<<3)
922 #define CURLPROTO_SCP    (1<<4)
923 #define CURLPROTO_SFTP   (1<<5)
924 #define CURLPROTO_TELNET (1<<6)
925 #define CURLPROTO_LDAP   (1<<7)
926 #define CURLPROTO_LDAPS  (1<<8)
927 #define CURLPROTO_DICT   (1<<9)
928 #define CURLPROTO_FILE   (1<<10)
929 #define CURLPROTO_TFTP   (1<<11)
930+#define CURLPROTO_IMAP   (1<<12)
931+#define CURLPROTO_IMAPS  (1<<13)
932+#define CURLPROTO_POP3   (1<<14)
933+#define CURLPROTO_POP3S  (1<<15)
934+#define CURLPROTO_SMTP   (1<<16)
935+#define CURLPROTO_SMTPS  (1<<17)
936+#define CURLPROTO_RTSP   (1<<18)
937+#define CURLPROTO_RTMP   (1<<19)
938+#define CURLPROTO_RTMPT  (1<<20)
939+#define CURLPROTO_RTMPE  (1<<21)
940+#define CURLPROTO_RTMPTE (1<<22)
941+#define CURLPROTO_RTMPS  (1<<23)
942+#define CURLPROTO_RTMPTS (1<<24)
943+#define CURLPROTO_GOPHER (1<<25)
944+#define CURLPROTO_SMB    (1<<26)
945+#define CURLPROTO_SMBS   (1<<27)
946 #define CURLPROTO_ALL    (~0) /* enable everything */
947
948 /* long may be 32 or 64 bits, but we should never depend on anything else
949    but 32 */
950 #define CURLOPTTYPE_LONG          0
951 #define CURLOPTTYPE_OBJECTPOINT   10000
952+#define CURLOPTTYPE_STRINGPOINT   10000
953 #define CURLOPTTYPE_FUNCTIONPOINT 20000
954 #define CURLOPTTYPE_OFF_T         30000
955
956+/* *STRINGPOINT is an alias for OBJECTPOINT to allow tools to extract the
957+   string options from the header file */
958+
959 /* name is uppercase CURLOPT_<name>,
960    type is one of the defined CURLOPTTYPE_<type>
961    number is unique identifier */
962 #ifdef CINIT
963 #undef CINIT
964 #endif
965
966 #ifdef CURL_ISOCPP
967-#define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number
968+#define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu
969 #else
970 /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
971 #define LONG          CURLOPTTYPE_LONG
972 #define OBJECTPOINT   CURLOPTTYPE_OBJECTPOINT
973+#define STRINGPOINT   CURLOPTTYPE_OBJECTPOINT
974 #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
975 #define OFF_T         CURLOPTTYPE_OFF_T
976 #define CINIT(name,type,number) CURLOPT_/**/name = type + number
977 #endif
978
979 /*
980  * This macro-mania below setups the CURLOPT_[what] enum, to be used with
981  * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]
982  * word.
983  */
984
985 typedef enum {
986   /* This is the FILE * or void * the regular output should be written to. */
987-  CINIT(FILE, OBJECTPOINT, 1),
988+  CINIT(WRITEDATA, OBJECTPOINT, 1),
989
990   /* The full URL to get/put */
991-  CINIT(URL,  OBJECTPOINT, 2),
992+  CINIT(URL, STRINGPOINT, 2),
993
994   /* Port number to connect to, if other than default. */
995   CINIT(PORT, LONG, 3),
996
997   /* Name of proxy to use. */
998-  CINIT(PROXY, OBJECTPOINT, 4),
999-
1000-  /* "name:password" to use when fetching. */
1001-  CINIT(USERPWD, OBJECTPOINT, 5),
1002-
1003-  /* "name:password" to use with proxy. */
1004-  CINIT(PROXYUSERPWD, OBJECTPOINT, 6),
1005+  CINIT(PROXY, STRINGPOINT, 4),
1006+
1007+  /* "user:password;options" to use when fetching. */
1008+  CINIT(USERPWD, STRINGPOINT, 5),
1009+
1010+  /* "user:password" to use with proxy. */
1011+  CINIT(PROXYUSERPWD, STRINGPOINT, 6),
1012
1013   /* Range to get, specified as an ASCII string. */
1014-  CINIT(RANGE, OBJECTPOINT, 7),
1015+  CINIT(RANGE, STRINGPOINT, 7),
1016
1017   /* not used */
1018
1019   /* Specified file stream to upload from (use as input): */
1020-  CINIT(INFILE, OBJECTPOINT, 9),
1021+  CINIT(READDATA, OBJECTPOINT, 9),
1022
1023   /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
1024-   * bytes big. If this is not used, error messages go to stderr instead: */
1025+   * bytes big. */
1026   CINIT(ERRORBUFFER, OBJECTPOINT, 10),
1027
1028   /* Function that will be called to store the output (instead of fwrite). The
1029    * parameters will use fwrite() syntax, make sure to follow them. */
1030   CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),
1031
1032   /* Function that will be called to read the input (instead of fread). The
1033    * parameters will use fread() syntax, make sure to follow them. */
1034@@ -706,24 +1008,24 @@ typedef enum {
1035    * sizes to handle larger files.  See below for INFILESIZE_LARGE.
1036    */
1037   CINIT(INFILESIZE, LONG, 14),
1038
1039   /* POST static input fields. */
1040   CINIT(POSTFIELDS, OBJECTPOINT, 15),
1041
1042   /* Set the referrer page (needed by some CGIs) */
1043-  CINIT(REFERER, OBJECTPOINT, 16),
1044+  CINIT(REFERER, STRINGPOINT, 16),
1045
1046   /* Set the FTP PORT string (interface name, named or numerical IP address)
1047      Use i.e '-' to use default address. */
1048-  CINIT(FTPPORT, OBJECTPOINT, 17),
1049+  CINIT(FTPPORT, STRINGPOINT, 17),
1050
1051   /* Set the User-Agent string (examined by some CGIs) */
1052-  CINIT(USERAGENT, OBJECTPOINT, 18),
1053+  CINIT(USERAGENT, STRINGPOINT, 18),
1054
1055   /* If the download receives less than "low speed limit" bytes/second
1056    * during "low speed time" seconds, the operations is aborted.
1057    * You could i.e if you have a pretty high speed connection, abort if
1058    * it is less than 2000 bytes/sec during 20 seconds.
1059    */
1060
1061   /* Set the "low speed limit" */
1062@@ -736,43 +1038,44 @@ typedef enum {
1063    *
1064    * Note there is also a _LARGE version of this key which uses
1065    * off_t types, allowing for large file offsets on platforms which
1066    * use larger-than-32-bit off_t's.  Look below for RESUME_FROM_LARGE.
1067    */
1068   CINIT(RESUME_FROM, LONG, 21),
1069
1070   /* Set cookie in request: */
1071-  CINIT(COOKIE, OBJECTPOINT, 22),
1072-
1073-  /* This points to a linked list of headers, struct curl_slist kind */
1074+  CINIT(COOKIE, STRINGPOINT, 22),
1075+
1076+  /* This points to a linked list of headers, struct curl_slist kind. This
1077+     list is also used for RTSP (in spite of its name) */
1078   CINIT(HTTPHEADER, OBJECTPOINT, 23),
1079
1080   /* This points to a linked list of post entries, struct curl_httppost */
1081   CINIT(HTTPPOST, OBJECTPOINT, 24),
1082
1083   /* name of the file keeping your private SSL-certificate */
1084-  CINIT(SSLCERT, OBJECTPOINT, 25),
1085+  CINIT(SSLCERT, STRINGPOINT, 25),
1086
1087   /* password for the SSL or SSH private key */
1088-  CINIT(KEYPASSWD, OBJECTPOINT, 26),
1089+  CINIT(KEYPASSWD, STRINGPOINT, 26),
1090
1091   /* send TYPE parameter? */
1092   CINIT(CRLF, LONG, 27),
1093
1094   /* send linked-list of QUOTE commands */
1095   CINIT(QUOTE, OBJECTPOINT, 28),
1096
1097   /* send FILE * or void * to store headers to, if you use a callback it
1098      is simply passed to the callback unmodified */
1099-  CINIT(WRITEHEADER, OBJECTPOINT, 29),
1100+  CINIT(HEADERDATA, OBJECTPOINT, 29),
1101
1102   /* point to a file to read the initial cookies from, also enables
1103      "cookie awareness" */
1104-  CINIT(COOKIEFILE, OBJECTPOINT, 31),
1105+  CINIT(COOKIEFILE, STRINGPOINT, 31),
1106
1107   /* What version to specifically try to use.
1108      See CURL_SSLVERSION defines below. */
1109   CINIT(SSLVERSION, LONG, 32),
1110
1111   /* What kind of HTTP time condition to use, see defines */
1112   CINIT(TIMECONDITION, LONG, 33),
1113
1114@@ -781,87 +1084,88 @@ typedef enum {
1115   CINIT(TIMEVALUE, LONG, 34),
1116
1117   /* 35 = OBSOLETE */
1118
1119   /* Custom request, for customizing the get command like
1120      HTTP: DELETE, TRACE and others
1121      FTP: to use a different list command
1122      */
1123-  CINIT(CUSTOMREQUEST, OBJECTPOINT, 36),
1124-
1125-  /* HTTP request, for odd commands like DELETE, TRACE and others */
1126+  CINIT(CUSTOMREQUEST, STRINGPOINT, 36),
1127+
1128+  /* FILE handle to use instead of stderr */
1129   CINIT(STDERR, OBJECTPOINT, 37),
1130
1131   /* 38 is not used */
1132
1133   /* send linked-list of post-transfer QUOTE commands */
1134   CINIT(POSTQUOTE, OBJECTPOINT, 39),
1135
1136-  /* Pass a pointer to string of the output using full variable-replacement
1137-     as described elsewhere. */
1138-  CINIT(WRITEINFO, OBJECTPOINT, 40),
1139+  CINIT(OBSOLETE40, OBJECTPOINT, 40), /* OBSOLETE, do not use! */
1140
1141   CINIT(VERBOSE, LONG, 41),      /* talk a lot */
1142   CINIT(HEADER, LONG, 42),       /* throw the header out too */
1143   CINIT(NOPROGRESS, LONG, 43),   /* shut off the progress meter */
1144   CINIT(NOBODY, LONG, 44),       /* use HEAD to get http document */
1145-  CINIT(FAILONERROR, LONG, 45),  /* no output on http error codes >= 300 */
1146+  CINIT(FAILONERROR, LONG, 45),  /* no output on http error codes >= 400 */
1147   CINIT(UPLOAD, LONG, 46),       /* this is an upload */
1148   CINIT(POST, LONG, 47),         /* HTTP POST method */
1149-  CINIT(DIRLISTONLY, LONG, 48),  /* return bare names when listing directories */
1150+  CINIT(DIRLISTONLY, LONG, 48),  /* bare names when listing directories */
1151
1152   CINIT(APPEND, LONG, 50),       /* Append instead of overwrite on upload! */
1153
1154   /* Specify whether to read the user+password from the .netrc or the URL.
1155    * This must be one of the CURL_NETRC_* enums below. */
1156   CINIT(NETRC, LONG, 51),
1157
1158   CINIT(FOLLOWLOCATION, LONG, 52),  /* use Location: Luke! */
1159
1160   CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */
1161   CINIT(PUT, LONG, 54),          /* HTTP PUT */
1162
1163   /* 55 = OBSOLETE */
1164
1165-  /* Function that will be called instead of the internal progress display
1166+  /* DEPRECATED
1167+   * Function that will be called instead of the internal progress display
1168    * function. This function should be defined as the curl_progress_callback
1169    * prototype defines. */
1170   CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),
1171
1172-  /* Data passed to the progress callback */
1173+  /* Data passed to the CURLOPT_PROGRESSFUNCTION and CURLOPT_XFERINFOFUNCTION
1174+     callbacks */
1175   CINIT(PROGRESSDATA, OBJECTPOINT, 57),
1176+#define CURLOPT_XFERINFODATA CURLOPT_PROGRESSDATA
1177
1178   /* We want the referrer field set automatically when following locations */
1179   CINIT(AUTOREFERER, LONG, 58),
1180
1181   /* Port of the proxy, can be set in the proxy string as well with:
1182      "[host]:[port]" */
1183   CINIT(PROXYPORT, LONG, 59),
1184
1185   /* size of the POST input data, if strlen() is not good to use */
1186   CINIT(POSTFIELDSIZE, LONG, 60),
1187
1188   /* tunnel non-http operations through a HTTP proxy */
1189   CINIT(HTTPPROXYTUNNEL, LONG, 61),
1190
1191   /* Set the interface string to use as outgoing network interface */
1192-  CINIT(INTERFACE, OBJECTPOINT, 62),
1193+  CINIT(INTERFACE, STRINGPOINT, 62),
1194
1195   /* Set the krb4/5 security level, this also enables krb4/5 awareness.  This
1196    * is a string, 'clear', 'safe', 'confidential' or 'private'.  If the string
1197    * is set but doesn't match one of these, 'private' will be used.  */
1198-  CINIT(KRBLEVEL, OBJECTPOINT, 63),
1199+  CINIT(KRBLEVEL, STRINGPOINT, 63),
1200
1201   /* Set if we should verify the peer in ssl handshake, set 1 to verify. */
1202   CINIT(SSL_VERIFYPEER, LONG, 64),
1203
1204   /* The CApath or CAfile used to validate the peer certificate
1205      this option is used only if SSL_VERIFYPEER is true */
1206-  CINIT(CAINFO, OBJECTPOINT, 65),
1207+  CINIT(CAINFO, STRINGPOINT, 65),
1208
1209   /* 66 = OBSOLETE */
1210   /* 67 = OBSOLETE */
1211
1212   /* Maximum number of http redirects to follow */
1213   CINIT(MAXREDIRS, LONG, 68),
1214
1215   /* Pass a long set to 1 to get the date of the requested document (if
1216@@ -869,42 +1173,39 @@ typedef enum {
1217   CINIT(FILETIME, LONG, 69),
1218
1219   /* This points to a linked list of telnet options */
1220   CINIT(TELNETOPTIONS, OBJECTPOINT, 70),
1221
1222   /* Max amount of cached alive connections */
1223   CINIT(MAXCONNECTS, LONG, 71),
1224
1225-  /* What policy to use when closing connections when the cache is filled
1226-     up */
1227-  CINIT(CLOSEPOLICY, LONG, 72),
1228+  CINIT(OBSOLETE72, LONG, 72), /* OBSOLETE, do not use! */
1229
1230   /* 73 = OBSOLETE */
1231
1232   /* Set to explicitly use a new connection for the upcoming transfer.
1233      Do not use this unless you're absolutely sure of this, as it makes the
1234      operation slower and is less friendly for the network. */
1235   CINIT(FRESH_CONNECT, LONG, 74),
1236
1237   /* Set to explicitly forbid the upcoming transfer's connection to be re-used
1238      when done. Do not use this unless you're absolutely sure of this, as it
1239      makes the operation slower and is less friendly for the network. */
1240   CINIT(FORBID_REUSE, LONG, 75),
1241
1242   /* Set to a file name that contains random data for libcurl to use to
1243      seed the random engine when doing SSL connects. */
1244-  CINIT(RANDOM_FILE, OBJECTPOINT, 76),
1245+  CINIT(RANDOM_FILE, STRINGPOINT, 76),
1246
1247   /* Set to the Entropy Gathering Daemon socket pathname */
1248-  CINIT(EGDSOCKET, OBJECTPOINT, 77),
1249-
1250-  /* Time-out connect operations after this amount of seconds, if connects
1251-     are OK within this time, then fine... This only aborts the connect
1252-     phase. [Only works on unix-style/SIGALRM operating systems] */
1253+  CINIT(EGDSOCKET, STRINGPOINT, 77),
1254+
1255+  /* Time-out connect operations after this amount of seconds, if connects are
1256+     OK within this time, then fine... This only aborts the connect phase. */
1257   CINIT(CONNECTTIMEOUT, LONG, 78),
1258
1259   /* Function that will be called to store headers (instead of fwrite). The
1260    * parameters will use fwrite() syntax, make sure to follow them. */
1261   CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),
1262
1263   /* Set this to force the HTTP request to get back to GET. Only really usable
1264      if POST, PUT or a custom request have been used first.
1265@@ -913,49 +1214,49 @@ typedef enum {
1266
1267   /* Set if we should verify the Common name from the peer certificate in ssl
1268    * handshake, set 1 to check existence, 2 to ensure that it matches the
1269    * provided hostname. */
1270   CINIT(SSL_VERIFYHOST, LONG, 81),
1271
1272   /* Specify which file name to write all known cookies in after completed
1273      operation. Set file name to "-" (dash) to make it go to stdout. */
1274-  CINIT(COOKIEJAR, OBJECTPOINT, 82),
1275+  CINIT(COOKIEJAR, STRINGPOINT, 82),
1276
1277   /* Specify which SSL ciphers to use */
1278-  CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83),
1279+  CINIT(SSL_CIPHER_LIST, STRINGPOINT, 83),
1280
1281   /* Specify which HTTP version to use! This must be set to one of the
1282      CURL_HTTP_VERSION* enums set below. */
1283   CINIT(HTTP_VERSION, LONG, 84),
1284
1285   /* Specifically switch on or off the FTP engine's use of the EPSV command. By
1286      default, that one will always be attempted before the more traditional
1287      PASV command. */
1288   CINIT(FTP_USE_EPSV, LONG, 85),
1289
1290   /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */
1291-  CINIT(SSLCERTTYPE, OBJECTPOINT, 86),
1292+  CINIT(SSLCERTTYPE, STRINGPOINT, 86),
1293
1294   /* name of the file keeping your private SSL-key */
1295-  CINIT(SSLKEY, OBJECTPOINT, 87),
1296+  CINIT(SSLKEY, STRINGPOINT, 87),
1297
1298   /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */
1299-  CINIT(SSLKEYTYPE, OBJECTPOINT, 88),
1300+  CINIT(SSLKEYTYPE, STRINGPOINT, 88),
1301
1302   /* crypto engine for the SSL-sub system */
1303-  CINIT(SSLENGINE, OBJECTPOINT, 89),
1304+  CINIT(SSLENGINE, STRINGPOINT, 89),
1305
1306   /* set the crypto engine for the SSL-sub system as default
1307      the param has no meaning...
1308    */
1309   CINIT(SSLENGINE_DEFAULT, LONG, 90),
1310
1311   /* Non-zero value means to use the global dns cache */
1312-  CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* To become OBSOLETE soon */
1313+  CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */
1314
1315   /* DNS cache timeout */
1316   CINIT(DNS_CACHE_TIMEOUT, LONG, 92),
1317
1318   /* send linked-list of pre-transfer QUOTE commands */
1319   CINIT(PREQUOTE, OBJECTPOINT, 93),
1320
1321   /* set the debug function */
1322@@ -964,50 +1265,52 @@ typedef enum {
1323   /* set the data for the debug function */
1324   CINIT(DEBUGDATA, OBJECTPOINT, 95),
1325
1326   /* mark this as start of a cookie session */
1327   CINIT(COOKIESESSION, LONG, 96),
1328
1329   /* The CApath directory used to validate the peer certificate
1330      this option is used only if SSL_VERIFYPEER is true */
1331-  CINIT(CAPATH, OBJECTPOINT, 97),
1332+  CINIT(CAPATH, STRINGPOINT, 97),
1333
1334   /* Instruct libcurl to use a smaller receive buffer */
1335   CINIT(BUFFERSIZE, LONG, 98),
1336
1337   /* Instruct libcurl to not use any signal/alarm handlers, even when using
1338      timeouts. This option is useful for multi-threaded applications.
1339      See libcurl-the-guide for more background information. */
1340   CINIT(NOSIGNAL, LONG, 99),
1341
1342   /* Provide a CURLShare for mutexing non-ts data */
1343   CINIT(SHARE, OBJECTPOINT, 100),
1344
1345   /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),
1346-     CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */
1347+     CURLPROXY_HTTPS, CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and
1348+     CURLPROXY_SOCKS5. */
1349   CINIT(PROXYTYPE, LONG, 101),
1350
1351   /* Set the Accept-Encoding string. Use this to tell a server you would like
1352-     the response to be compressed. */
1353-  CINIT(ENCODING, OBJECTPOINT, 102),
1354+     the response to be compressed. Before 7.21.6, this was known as
1355+     CURLOPT_ENCODING */
1356+  CINIT(ACCEPT_ENCODING, STRINGPOINT, 102),
1357
1358   /* Set pointer to private data */
1359   CINIT(PRIVATE, OBJECTPOINT, 103),
1360
1361   /* Set aliases for HTTP 200 in the HTTP Response header */
1362   CINIT(HTTP200ALIASES, OBJECTPOINT, 104),
1363
1364   /* Continue to send authentication (user+password) when following locations,
1365      even when hostname changed. This can potentially send off the name
1366      and password to whatever host the server decides. */
1367   CINIT(UNRESTRICTED_AUTH, LONG, 105),
1368
1369-  /* Specifically switch on or off the FTP engine's use of the EPRT command ( it
1370-     also disables the LPRT attempt). By default, those ones will always be
1371+  /* Specifically switch on or off the FTP engine's use of the EPRT command (
1372+     it also disables the LPRT attempt). By default, those ones will always be
1373      attempted before the good old traditional PORT command. */
1374   CINIT(FTP_USE_EPRT, LONG, 106),
1375
1376   /* Set this to a bitmask value to enable the particular authentications
1377      methods you like. Use this in combination with CURLOPT_USERPWD.
1378      Note that setting multiple bits may cause extra network round-trips. */
1379   CINIT(HTTPAUTH, LONG, 107),
1380
1381@@ -1031,16 +1334,17 @@ typedef enum {
1382      Note that setting multiple bits may cause extra network round-trips. */
1383   CINIT(PROXYAUTH, LONG, 111),
1384
1385   /* FTP option that changes the timeout, in seconds, associated with
1386      getting a response.  This is different from transfer timeout time and
1387      essentially places a demand on the FTP server to acknowledge commands
1388      in a timely manner. */
1389   CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112),
1390+#define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT
1391
1392   /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
1393      tell libcurl to resolve names to those IP versions only. This only has
1394      affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */
1395   CINIT(IPRESOLVE, LONG, 113),
1396
1397   /* Set this option to limit the size of a file that will be downloaded from
1398      an HTTP or FTP server.
1399@@ -1063,22 +1367,22 @@ typedef enum {
1400    * an HTTP or FTP server.  See MAXFILESIZE above for the LONG version.
1401    */
1402   CINIT(MAXFILESIZE_LARGE, OFF_T, 117),
1403
1404   /* Set this option to the file name of your .netrc file you want libcurl
1405      to parse (using the CURLOPT_NETRC option). If not set, libcurl will do
1406      a poor attempt to find the user's home directory and check for a .netrc
1407      file in there. */
1408-  CINIT(NETRC_FILE, OBJECTPOINT, 118),
1409+  CINIT(NETRC_FILE, STRINGPOINT, 118),
1410
1411   /* Enable SSL/TLS for FTP, pick one of:
1412-     CURLFTPSSL_TRY     - try using SSL, proceed anyway otherwise
1413-     CURLFTPSSL_CONTROL - SSL for the control connection or fail
1414-     CURLFTPSSL_ALL     - SSL for all communication or fail
1415+     CURLUSESSL_TRY     - try using SSL, proceed anyway otherwise
1416+     CURLUSESSL_CONTROL - SSL for the control connection or fail
1417+     CURLUSESSL_ALL     - SSL for all communication or fail
1418   */
1419   CINIT(USE_SSL, LONG, 119),
1420
1421   /* The _LARGE version of the standard POSTFIELDSIZE option */
1422   CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),
1423
1424   /* Enable/disable the TCP Nagle algorithm */
1425   CINIT(TCP_NODELAY, LONG, 121),
1426@@ -1106,20 +1410,20 @@ typedef enum {
1427   CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130),
1428   CINIT(IOCTLDATA, OBJECTPOINT, 131),
1429
1430   /* 132 OBSOLETE. Gone in 7.16.0 */
1431   /* 133 OBSOLETE. Gone in 7.16.0 */
1432
1433   /* zero terminated string for pass on to the FTP server when asked for
1434      "account" info */
1435-  CINIT(FTP_ACCOUNT, OBJECTPOINT, 134),
1436-
1437-  /* feed cookies into cookie engine */
1438-  CINIT(COOKIELIST, OBJECTPOINT, 135),
1439+  CINIT(FTP_ACCOUNT, STRINGPOINT, 134),
1440+
1441+  /* feed cookie into cookie engine */
1442+  CINIT(COOKIELIST, STRINGPOINT, 135),
1443
1444   /* ignore Content-Length */
1445   CINIT(IGNORE_CONTENT_LENGTH, LONG, 136),
1446
1447   /* Set to non-zero to skip the IP address received in a 227 PASV FTP server
1448      response. Typically used for FTP-SSL purposes but is not restricted to
1449      that. libcurl will then instead use the same IP address it used for the
1450      control connection. */
1451@@ -1155,32 +1459,32 @@ typedef enum {
1452   CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144),
1453
1454   /* if the connection proceeds too quickly then need to slow it down */
1455   /* limit-rate: maximum number of bytes per second to send or receive */
1456   CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145),
1457   CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146),
1458
1459   /* Pointer to command string to send if USER/PASS fails. */
1460-  CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147),
1461+  CINIT(FTP_ALTERNATIVE_TO_USER, STRINGPOINT, 147),
1462
1463   /* callback function for setting socket options */
1464   CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148),
1465   CINIT(SOCKOPTDATA, OBJECTPOINT, 149),
1466
1467   /* set to 0 to disable session ID re-use for this transfer, default is
1468      enabled (== 1) */
1469   CINIT(SSL_SESSIONID_CACHE, LONG, 150),
1470
1471   /* allowed SSH authentication methods */
1472   CINIT(SSH_AUTH_TYPES, LONG, 151),
1473
1474   /* Used by scp/sftp to do public/private key authentication */
1475-  CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152),
1476-  CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153),
1477+  CINIT(SSH_PUBLIC_KEYFILE, STRINGPOINT, 152),
1478+  CINIT(SSH_PRIVATE_KEYFILE, STRINGPOINT, 153),
1479
1480   /* Send CCC (Clear Command Channel) after authentication */
1481   CINIT(FTP_SSL_CCC, LONG, 154),
1482
1483   /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */
1484   CINIT(TIMEOUT_MS, LONG, 155),
1485   CINIT(CONNECTTIMEOUT_MS, LONG, 156),
1486
1487@@ -1194,17 +1498,17 @@ typedef enum {
1488   CINIT(NEW_FILE_PERMS, LONG, 159),
1489   CINIT(NEW_DIRECTORY_PERMS, LONG, 160),
1490
1491   /* Set the behaviour of POST when redirecting. Values must be set to one
1492      of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */
1493   CINIT(POSTREDIR, LONG, 161),
1494
1495   /* used by scp/sftp to verify the host's public key */
1496-  CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162),
1497+  CINIT(SSH_HOST_PUBLIC_KEY_MD5, STRINGPOINT, 162),
1498
1499   /* Callback function for opening socket (instead of socket(2)). Optionally,
1500      callback is able change the address or refuse to connect returning
1501      CURL_SOCKET_BAD.  The callback should have type
1502      curl_opensocket_callback */
1503   CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163),
1504   CINIT(OPENSOCKETDATA, OBJECTPOINT, 164),
1505
1506@@ -1214,51 +1518,50 @@ typedef enum {
1507   /* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy */
1508   CINIT(PROXY_TRANSFER_MODE, LONG, 166),
1509
1510   /* Callback function for seeking in the input stream */
1511   CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167),
1512   CINIT(SEEKDATA, OBJECTPOINT, 168),
1513
1514   /* CRL file */
1515-  CINIT(CRLFILE, OBJECTPOINT, 169),
1516+  CINIT(CRLFILE, STRINGPOINT, 169),
1517
1518   /* Issuer certificate */
1519-  CINIT(ISSUERCERT, OBJECTPOINT, 170),
1520+  CINIT(ISSUERCERT, STRINGPOINT, 170),
1521
1522   /* (IPv6) Address scope */
1523   CINIT(ADDRESS_SCOPE, LONG, 171),
1524
1525   /* Collect certificate chain info and allow it to get retrievable with
1526-     CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only
1527-     working with OpenSSL-powered builds. */
1528+     CURLINFO_CERTINFO after the transfer is complete. */
1529   CINIT(CERTINFO, LONG, 172),
1530
1531   /* "name" and "pwd" to use when fetching. */
1532-  CINIT(USERNAME, OBJECTPOINT, 173),
1533-  CINIT(PASSWORD, OBJECTPOINT, 174),
1534+  CINIT(USERNAME, STRINGPOINT, 173),
1535+  CINIT(PASSWORD, STRINGPOINT, 174),
1536
1537     /* "name" and "pwd" to use with Proxy when fetching. */
1538-  CINIT(PROXYUSERNAME, OBJECTPOINT, 175),
1539-  CINIT(PROXYPASSWORD, OBJECTPOINT, 176),
1540+  CINIT(PROXYUSERNAME, STRINGPOINT, 175),
1541+  CINIT(PROXYPASSWORD, STRINGPOINT, 176),
1542
1543   /* Comma separated list of hostnames defining no-proxy zones. These should
1544      match both hostnames directly, and hostnames within a domain. For
1545      example, local.com will match local.com and www.local.com, but NOT
1546      notlocal.com or www.notlocal.com. For compatibility with other
1547      implementations of this, .local.com will be considered to be the same as
1548      local.com. A single * is the only valid wildcard, and effectively
1549      disables the use of proxy. */
1550-  CINIT(NOPROXY, OBJECTPOINT, 177),
1551+  CINIT(NOPROXY, STRINGPOINT, 177),
1552
1553   /* block size for TFTP transfers */
1554   CINIT(TFTP_BLKSIZE, LONG, 178),
1555
1556   /* Socks Service */
1557-  CINIT(SOCKS5_GSSAPI_SERVICE, OBJECTPOINT, 179),
1558+  CINIT(SOCKS5_GSSAPI_SERVICE, STRINGPOINT, 179), /* DEPRECATED, do not use! */
1559
1560   /* Socks Service */
1561   CINIT(SOCKS5_GSSAPI_NEC, LONG, 180),
1562
1563   /* set the bitmask for the protocols that are allowed to be used for the
1564      transfer, which thus helps the app which takes URLs from users or other
1565      external inputs and want to restrict what protocol(s) to deal
1566      with. Defaults to CURLPROTO_ALL. */
1567@@ -1266,25 +1569,360 @@ typedef enum {
1568
1569   /* set the bitmask for the protocols that libcurl is allowed to follow to,
1570      as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs
1571      to be set in both bitmasks to be allowed to get redirected to. Defaults
1572      to all protocols except FILE and SCP. */
1573   CINIT(REDIR_PROTOCOLS, LONG, 182),
1574
1575   /* set the SSH knownhost file name to use */
1576-  CINIT(SSH_KNOWNHOSTS, OBJECTPOINT, 183),
1577+  CINIT(SSH_KNOWNHOSTS, STRINGPOINT, 183),
1578
1579   /* set the SSH host key callback, must point to a curl_sshkeycallback
1580      function */
1581   CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184),
1582
1583   /* set the SSH host key callback custom pointer */
1584   CINIT(SSH_KEYDATA, OBJECTPOINT, 185),
1585
1586+  /* set the SMTP mail originator */
1587+  CINIT(MAIL_FROM, STRINGPOINT, 186),
1588+
1589+  /* set the list of SMTP mail receiver(s) */
1590+  CINIT(MAIL_RCPT, OBJECTPOINT, 187),
1591+
1592+  /* FTP: send PRET before PASV */
1593+  CINIT(FTP_USE_PRET, LONG, 188),
1594+
1595+  /* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */
1596+  CINIT(RTSP_REQUEST, LONG, 189),
1597+
1598+  /* The RTSP session identifier */
1599+  CINIT(RTSP_SESSION_ID, STRINGPOINT, 190),
1600+
1601+  /* The RTSP stream URI */
1602+  CINIT(RTSP_STREAM_URI, STRINGPOINT, 191),
1603+
1604+  /* The Transport: header to use in RTSP requests */
1605+  CINIT(RTSP_TRANSPORT, STRINGPOINT, 192),
1606+
1607+  /* Manually initialize the client RTSP CSeq for this handle */
1608+  CINIT(RTSP_CLIENT_CSEQ, LONG, 193),
1609+
1610+  /* Manually initialize the server RTSP CSeq for this handle */
1611+  CINIT(RTSP_SERVER_CSEQ, LONG, 194),
1612+
1613+  /* The stream to pass to INTERLEAVEFUNCTION. */
1614+  CINIT(INTERLEAVEDATA, OBJECTPOINT, 195),
1615+
1616+  /* Let the application define a custom write method for RTP data */
1617+  CINIT(INTERLEAVEFUNCTION, FUNCTIONPOINT, 196),
1618+
1619+  /* Turn on wildcard matching */
1620+  CINIT(WILDCARDMATCH, LONG, 197),
1621+
1622+  /* Directory matching callback called before downloading of an
1623+     individual file (chunk) started */
1624+  CINIT(CHUNK_BGN_FUNCTION, FUNCTIONPOINT, 198),
1625+
1626+  /* Directory matching callback called after the file (chunk)
1627+     was downloaded, or skipped */
1628+  CINIT(CHUNK_END_FUNCTION, FUNCTIONPOINT, 199),
1629+
1630+  /* Change match (fnmatch-like) callback for wildcard matching */
1631+  CINIT(FNMATCH_FUNCTION, FUNCTIONPOINT, 200),
1632+
1633+  /* Let the application define custom chunk data pointer */
1634+  CINIT(CHUNK_DATA, OBJECTPOINT, 201),
1635+
1636+  /* FNMATCH_FUNCTION user pointer */
1637+  CINIT(FNMATCH_DATA, OBJECTPOINT, 202),
1638+
1639+  /* send linked-list of name:port:address sets */
1640+  CINIT(RESOLVE, OBJECTPOINT, 203),
1641+
1642+  /* Set a username for authenticated TLS */
1643+  CINIT(TLSAUTH_USERNAME, STRINGPOINT, 204),
1644+
1645+  /* Set a password for authenticated TLS */
1646+  CINIT(TLSAUTH_PASSWORD, STRINGPOINT, 205),
1647+
1648+  /* Set authentication type for authenticated TLS */
1649+  CINIT(TLSAUTH_TYPE, STRINGPOINT, 206),
1650+
1651+  /* Set to 1 to enable the "TE:" header in HTTP requests to ask for
1652+     compressed transfer-encoded responses. Set to 0 to disable the use of TE:
1653+     in outgoing requests. The current default is 0, but it might change in a
1654+     future libcurl release.
1655+
1656+     libcurl will ask for the compressed methods it knows of, and if that
1657+     isn't any, it will not ask for transfer-encoding at all even if this
1658+     option is set to 1.
1659+
1660+  */
1661+  CINIT(TRANSFER_ENCODING, LONG, 207),
1662+
1663+  /* Callback function for closing socket (instead of close(2)). The callback
1664+     should have type curl_closesocket_callback */
1665+  CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208),
1666+  CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209),
1667+
1668+  /* allow GSSAPI credential delegation */
1669+  CINIT(GSSAPI_DELEGATION, LONG, 210),
1670+
1671+  /* Set the name servers to use for DNS resolution */
1672+  CINIT(DNS_SERVERS, STRINGPOINT, 211),
1673+
1674+  /* Time-out accept operations (currently for FTP only) after this amount
1675+     of milliseconds. */
1676+  CINIT(ACCEPTTIMEOUT_MS, LONG, 212),
1677+
1678+  /* Set TCP keepalive */
1679+  CINIT(TCP_KEEPALIVE, LONG, 213),
1680+
1681+  /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */
1682+  CINIT(TCP_KEEPIDLE, LONG, 214),
1683+  CINIT(TCP_KEEPINTVL, LONG, 215),
1684+
1685+  /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */
1686+  CINIT(SSL_OPTIONS, LONG, 216),
1687+
1688+  /* Set the SMTP auth originator */
1689+  CINIT(MAIL_AUTH, STRINGPOINT, 217),
1690+
1691+  /* Enable/disable SASL initial response */
1692+  CINIT(SASL_IR, LONG, 218),
1693+
1694+  /* Function that will be called instead of the internal progress display
1695+   * function. This function should be defined as the curl_xferinfo_callback
1696+   * prototype defines. (Deprecates CURLOPT_PROGRESSFUNCTION) */
1697+  CINIT(XFERINFOFUNCTION, FUNCTIONPOINT, 219),
1698+
1699+  /* The XOAUTH2 bearer token */
1700+  CINIT(XOAUTH2_BEARER, STRINGPOINT, 220),
1701+
1702+  /* Set the interface string to use as outgoing network
1703+   * interface for DNS requests.
1704+   * Only supported by the c-ares DNS backend */
1705+  CINIT(DNS_INTERFACE, STRINGPOINT, 221),
1706+
1707+  /* Set the local IPv4 address to use for outgoing DNS requests.
1708+   * Only supported by the c-ares DNS backend */
1709+  CINIT(DNS_LOCAL_IP4, STRINGPOINT, 222),
1710+
1711+  /* Set the local IPv6 address to use for outgoing DNS requests.
1712+   * Only supported by the c-ares DNS backend */
1713+  CINIT(DNS_LOCAL_IP6, STRINGPOINT, 223),
1714+
1715+  /* Set authentication options directly */
1716+  CINIT(LOGIN_OPTIONS, STRINGPOINT, 224),
1717+
1718+  /* Enable/disable TLS NPN extension (http2 over ssl might fail without) */
1719+  CINIT(SSL_ENABLE_NPN, LONG, 225),
1720+
1721+  /* Enable/disable TLS ALPN extension (http2 over ssl might fail without) */
1722+  CINIT(SSL_ENABLE_ALPN, LONG, 226),
1723+
1724+  /* Time to wait for a response to a HTTP request containing an
1725+   * Expect: 100-continue header before sending the data anyway. */
1726+  CINIT(EXPECT_100_TIMEOUT_MS, LONG, 227),
1727+
1728+  /* This points to a linked list of headers used for proxy requests only,
1729+     struct curl_slist kind */
1730+  CINIT(PROXYHEADER, OBJECTPOINT, 228),
1731+
1732+  /* Pass in a bitmask of "header options" */
1733+  CINIT(HEADEROPT, LONG, 229),
1734+
1735+  /* The public key in DER form used to validate the peer public key
1736+     this option is used only if SSL_VERIFYPEER is true */
1737+  CINIT(PINNEDPUBLICKEY, STRINGPOINT, 230),
1738+
1739+  /* Path to Unix domain socket */
1740+  CINIT(UNIX_SOCKET_PATH, STRINGPOINT, 231),
1741+
1742+  /* Set if we should verify the certificate status. */
1743+  CINIT(SSL_VERIFYSTATUS, LONG, 232),
1744+
1745+  /* Set if we should enable TLS false start. */
1746+  CINIT(SSL_FALSESTART, LONG, 233),
1747+
1748+  /* Do not squash dot-dot sequences */
1749+  CINIT(PATH_AS_IS, LONG, 234),
1750+
1751+  /* Proxy Service Name */
1752+  CINIT(PROXY_SERVICE_NAME, STRINGPOINT, 235),
1753+
1754+  /* Service Name */
1755+  CINIT(SERVICE_NAME, STRINGPOINT, 236),
1756+
1757+  /* Wait/don't wait for pipe/mutex to clarify */
1758+  CINIT(PIPEWAIT, LONG, 237),
1759+
1760+  /* Set the protocol used when curl is given a URL without a protocol */
1761+  CINIT(DEFAULT_PROTOCOL, STRINGPOINT, 238),
1762+
1763+  /* Set stream weight, 1 - 256 (default is 16) */
1764+  CINIT(STREAM_WEIGHT, LONG, 239),
1765+
1766+  /* Set stream dependency on another CURL handle */
1767+  CINIT(STREAM_DEPENDS, OBJECTPOINT, 240),
1768+
1769+  /* Set E-xclusive stream dependency on another CURL handle */
1770+  CINIT(STREAM_DEPENDS_E, OBJECTPOINT, 241),
1771+
1772+  /* Do not send any tftp option requests to the server */
1773+  CINIT(TFTP_NO_OPTIONS, LONG, 242),
1774+
1775+  /* Linked-list of host:port:connect-to-host:connect-to-port,
1776+     overrides the URL's host:port (only for the network layer) */
1777+  CINIT(CONNECT_TO, OBJECTPOINT, 243),
1778+
1779+  /* Set TCP Fast Open */
1780+  CINIT(TCP_FASTOPEN, LONG, 244),
1781+
1782+  /* Continue to send data if the server responds early with an
1783+   * HTTP status code >= 300 */
1784+  CINIT(KEEP_SENDING_ON_ERROR, LONG, 245),
1785+
1786+  /* The CApath or CAfile used to validate the proxy certificate
1787+     this option is used only if PROXY_SSL_VERIFYPEER is true */
1788+  CINIT(PROXY_CAINFO, STRINGPOINT, 246),
1789+
1790+  /* The CApath directory used to validate the proxy certificate
1791+     this option is used only if PROXY_SSL_VERIFYPEER is true */
1792+  CINIT(PROXY_CAPATH, STRINGPOINT, 247),
1793+
1794+  /* Set if we should verify the proxy in ssl handshake,
1795+     set 1 to verify. */
1796+  CINIT(PROXY_SSL_VERIFYPEER, LONG, 248),
1797+
1798+  /* Set if we should verify the Common name from the proxy certificate in ssl
1799+   * handshake, set 1 to check existence, 2 to ensure that it matches
1800+   * the provided hostname. */
1801+  CINIT(PROXY_SSL_VERIFYHOST, LONG, 249),
1802+
1803+  /* What version to specifically try to use for proxy.
1804+     See CURL_SSLVERSION defines below. */
1805+  CINIT(PROXY_SSLVERSION, LONG, 250),
1806+
1807+  /* Set a username for authenticated TLS for proxy */
1808+  CINIT(PROXY_TLSAUTH_USERNAME, STRINGPOINT, 251),
1809+
1810+  /* Set a password for authenticated TLS for proxy */
1811+  CINIT(PROXY_TLSAUTH_PASSWORD, STRINGPOINT, 252),
1812+
1813+  /* Set authentication type for authenticated TLS for proxy */
1814+  CINIT(PROXY_TLSAUTH_TYPE, STRINGPOINT, 253),
1815+
1816+  /* name of the file keeping your private SSL-certificate for proxy */
1817+  CINIT(PROXY_SSLCERT, STRINGPOINT, 254),
1818+
1819+  /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") for
1820+     proxy */
1821+  CINIT(PROXY_SSLCERTTYPE, STRINGPOINT, 255),
1822+
1823+  /* name of the file keeping your private SSL-key for proxy */
1824+  CINIT(PROXY_SSLKEY, STRINGPOINT, 256),
1825+
1826+  /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") for
1827+     proxy */
1828+  CINIT(PROXY_SSLKEYTYPE, STRINGPOINT, 257),
1829+
1830+  /* password for the SSL private key for proxy */
1831+  CINIT(PROXY_KEYPASSWD, STRINGPOINT, 258),
1832+
1833+  /* Specify which SSL ciphers to use for proxy */
1834+  CINIT(PROXY_SSL_CIPHER_LIST, STRINGPOINT, 259),
1835+
1836+  /* CRL file for proxy */
1837+  CINIT(PROXY_CRLFILE, STRINGPOINT, 260),
1838+
1839+  /* Enable/disable specific SSL features with a bitmask for proxy, see
1840+     CURLSSLOPT_* */
1841+  CINIT(PROXY_SSL_OPTIONS, LONG, 261),
1842+
1843+  /* Name of pre proxy to use. */
1844+  CINIT(PRE_PROXY, STRINGPOINT, 262),
1845+
1846+  /* The public key in DER form used to validate the proxy public key
1847+     this option is used only if PROXY_SSL_VERIFYPEER is true */
1848+  CINIT(PROXY_PINNEDPUBLICKEY, STRINGPOINT, 263),
1849+
1850+  /* Path to an abstract Unix domain socket */
1851+  CINIT(ABSTRACT_UNIX_SOCKET, STRINGPOINT, 264),
1852+
1853+  /* Suppress proxy CONNECT response headers from user callbacks */
1854+  CINIT(SUPPRESS_CONNECT_HEADERS, LONG, 265),
1855+
1856+  /* The request target, instead of extracted from the URL */
1857+  CINIT(REQUEST_TARGET, STRINGPOINT, 266),
1858+
1859+  /* bitmask of allowed auth methods for connections to SOCKS5 proxies */
1860+  CINIT(SOCKS5_AUTH, LONG, 267),
1861+
1862+  /* Enable/disable SSH compression */
1863+  CINIT(SSH_COMPRESSION, LONG, 268),
1864+
1865+  /* Post MIME data. */
1866+  CINIT(MIMEPOST, OBJECTPOINT, 269),
1867+
1868+  /* Time to use with the CURLOPT_TIMECONDITION. Specified in number of
1869+     seconds since 1 Jan 1970. */
1870+  CINIT(TIMEVALUE_LARGE, OFF_T, 270),
1871+
1872+  /* Head start in milliseconds to give happy eyeballs. */
1873+  CINIT(HAPPY_EYEBALLS_TIMEOUT_MS, LONG, 271),
1874+
1875+  /* Function that will be called before a resolver request is made */
1876+  CINIT(RESOLVER_START_FUNCTION, FUNCTIONPOINT, 272),
1877+
1878+  /* User data to pass to the resolver start callback. */
1879+  CINIT(RESOLVER_START_DATA, OBJECTPOINT, 273),
1880+
1881+  /* send HAProxy PROXY protocol header? */
1882+  CINIT(HAPROXYPROTOCOL, LONG, 274),
1883+
1884+  /* shuffle addresses before use when DNS returns multiple */
1885+  CINIT(DNS_SHUFFLE_ADDRESSES, LONG, 275),
1886+
1887+  /* Specify which TLS 1.3 ciphers suites to use */
1888+  CINIT(TLS13_CIPHERS, STRINGPOINT, 276),
1889+  CINIT(PROXY_TLS13_CIPHERS, STRINGPOINT, 277),
1890+
1891+  /* Disallow specifying username/login in URL. */
1892+  CINIT(DISALLOW_USERNAME_IN_URL, LONG, 278),
1893+
1894+  /* DNS-over-HTTPS URL */
1895+  CINIT(DOH_URL, STRINGPOINT, 279),
1896+
1897+  /* Preferred buffer size to use for uploads */
1898+  CINIT(UPLOAD_BUFFERSIZE, LONG, 280),
1899+
1900+  /* Time in ms between connection upkeep calls for long-lived connections. */
1901+  CINIT(UPKEEP_INTERVAL_MS, LONG, 281),
1902+
1903+  /* Specify URL using CURL URL API. */
1904+  CINIT(CURLU, OBJECTPOINT, 282),
1905+
1906+  /* add trailing data just after no more data is available */
1907+  CINIT(TRAILERFUNCTION, FUNCTIONPOINT, 283),
1908+
1909+  /* pointer to be passed to HTTP_TRAILER_FUNCTION */
1910+  CINIT(TRAILERDATA, OBJECTPOINT, 284),
1911+
1912+  /* set this to 1L to allow HTTP/0.9 responses or 0L to disallow */
1913+  CINIT(HTTP09_ALLOWED, LONG, 285),
1914+
1915+  /* alt-svc control bitmask */
1916+  CINIT(ALTSVC_CTRL, LONG, 286),
1917+
1918+  /* alt-svc cache file name to possibly read from/write to */
1919+  CINIT(ALTSVC, STRINGPOINT, 287),
1920+
1921   CURLOPT_LASTENTRY /* the last unused */
1922 } CURLoption;
1923
1924 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
1925                           the obsolete stuff removed! */
1926
1927 /* Backwards compatibility with older names */
1928 /* These are scheduled to disappear by 2011 */
1929@@ -1311,81 +1949,260 @@ typedef enum {
1930 #endif
1931
1932
1933   /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host
1934      name resolves addresses using more than one IP protocol version, this
1935      option might be handy to force libcurl to use a specific IP version. */
1936 #define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP
1937                                      versions that your system allows */
1938-#define CURL_IPRESOLVE_V4       1 /* resolve to ipv4 addresses */
1939-#define CURL_IPRESOLVE_V6       2 /* resolve to ipv6 addresses */
1940+#define CURL_IPRESOLVE_V4       1 /* resolve to IPv4 addresses */
1941+#define CURL_IPRESOLVE_V6       2 /* resolve to IPv6 addresses */
1942
1943   /* three convenient "aliases" that follow the name scheme better */
1944-#define CURLOPT_WRITEDATA CURLOPT_FILE
1945-#define CURLOPT_READDATA  CURLOPT_INFILE
1946-#define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER
1947+#define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER
1948
1949   /* These enums are for use with the CURLOPT_HTTP_VERSION option. */
1950 enum {
1951   CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd
1952                              like the library to choose the best possible
1953                              for us! */
1954   CURL_HTTP_VERSION_1_0,  /* please use HTTP 1.0 in the request */
1955   CURL_HTTP_VERSION_1_1,  /* please use HTTP 1.1 in the request */
1956+  CURL_HTTP_VERSION_2_0,  /* please use HTTP 2 in the request */
1957+  CURL_HTTP_VERSION_2TLS, /* use version 2 for HTTPS, version 1.1 for HTTP */
1958+  CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE,  /* please use HTTP 2 without HTTP/1.1
1959+                                           Upgrade */
1960
1961   CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */
1962 };
1963
1964+/* Convenience definition simple because the name of the version is HTTP/2 and
1965+   not 2.0. The 2_0 version of the enum name was set while the version was
1966+   still planned to be 2.0 and we stick to it for compatibility. */
1967+#define CURL_HTTP_VERSION_2 CURL_HTTP_VERSION_2_0
1968+
1969+/*
1970+ * Public API enums for RTSP requests
1971+ */
1972+enum {
1973+    CURL_RTSPREQ_NONE, /* first in list */
1974+    CURL_RTSPREQ_OPTIONS,
1975+    CURL_RTSPREQ_DESCRIBE,
1976+    CURL_RTSPREQ_ANNOUNCE,
1977+    CURL_RTSPREQ_SETUP,
1978+    CURL_RTSPREQ_PLAY,
1979+    CURL_RTSPREQ_PAUSE,
1980+    CURL_RTSPREQ_TEARDOWN,
1981+    CURL_RTSPREQ_GET_PARAMETER,
1982+    CURL_RTSPREQ_SET_PARAMETER,
1983+    CURL_RTSPREQ_RECORD,
1984+    CURL_RTSPREQ_RECEIVE,
1985+    CURL_RTSPREQ_LAST /* last in list */
1986+};
1987+
1988   /* These enums are for use with the CURLOPT_NETRC option. */
1989 enum CURL_NETRC_OPTION {
1990   CURL_NETRC_IGNORED,     /* The .netrc will never be read.
1991                            * This is the default. */
1992   CURL_NETRC_OPTIONAL,    /* A user:password in the URL will be preferred
1993                            * to one in the .netrc. */
1994   CURL_NETRC_REQUIRED,    /* A user:password in the URL will be ignored.
1995                            * Unless one is set programmatically, the .netrc
1996                            * will be queried. */
1997   CURL_NETRC_LAST
1998 };
1999
2000 enum {
2001   CURL_SSLVERSION_DEFAULT,
2002-  CURL_SSLVERSION_TLSv1,
2003+  CURL_SSLVERSION_TLSv1, /* TLS 1.x */
2004   CURL_SSLVERSION_SSLv2,
2005   CURL_SSLVERSION_SSLv3,
2006+  CURL_SSLVERSION_TLSv1_0,
2007+  CURL_SSLVERSION_TLSv1_1,
2008+  CURL_SSLVERSION_TLSv1_2,
2009+  CURL_SSLVERSION_TLSv1_3,
2010
2011   CURL_SSLVERSION_LAST /* never use, keep last */
2012 };
2013
2014+enum {
2015+  CURL_SSLVERSION_MAX_NONE =     0,
2016+  CURL_SSLVERSION_MAX_DEFAULT =  (CURL_SSLVERSION_TLSv1   << 16),
2017+  CURL_SSLVERSION_MAX_TLSv1_0 =  (CURL_SSLVERSION_TLSv1_0 << 16),
2018+  CURL_SSLVERSION_MAX_TLSv1_1 =  (CURL_SSLVERSION_TLSv1_1 << 16),
2019+  CURL_SSLVERSION_MAX_TLSv1_2 =  (CURL_SSLVERSION_TLSv1_2 << 16),
2020+  CURL_SSLVERSION_MAX_TLSv1_3 =  (CURL_SSLVERSION_TLSv1_3 << 16),
2021+
2022+  /* never use, keep last */
2023+  CURL_SSLVERSION_MAX_LAST =     (CURL_SSLVERSION_LAST    << 16)
2024+};
2025+
2026+enum CURL_TLSAUTH {
2027+  CURL_TLSAUTH_NONE,
2028+  CURL_TLSAUTH_SRP,
2029+  CURL_TLSAUTH_LAST /* never use, keep last */
2030+};
2031+
2032 /* symbols to use with CURLOPT_POSTREDIR.
2033-   CURL_REDIR_POST_301 and CURL_REDIR_POST_302 can be bitwise ORed so that
2034-   CURL_REDIR_POST_301 | CURL_REDIR_POST_302 == CURL_REDIR_POST_ALL */
2035+   CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303
2036+   can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302
2037+   | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */
2038
2039 #define CURL_REDIR_GET_ALL  0
2040 #define CURL_REDIR_POST_301 1
2041 #define CURL_REDIR_POST_302 2
2042-#define CURL_REDIR_POST_ALL (CURL_REDIR_POST_301|CURL_REDIR_POST_302)
2043+#define CURL_REDIR_POST_303 4
2044+#define CURL_REDIR_POST_ALL \
2045+    (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303)
2046
2047 typedef enum {
2048   CURL_TIMECOND_NONE,
2049
2050   CURL_TIMECOND_IFMODSINCE,
2051   CURL_TIMECOND_IFUNMODSINCE,
2052   CURL_TIMECOND_LASTMOD,
2053
2054   CURL_TIMECOND_LAST
2055 } curl_TimeCond;
2056
2057+/* Special size_t value signaling a zero-terminated string. */
2058+#define CURL_ZERO_TERMINATED ((size_t) -1)
2059
2060 /* curl_strequal() and curl_strnequal() are subject for removal in a future
2061-   libcurl, see lib/README.curlx for details */
2062-CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);
2063-CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);
2064-
2065+   release */
2066+CURL_EXTERN int curl_strequal(const char *s1, const char *s2);
2067+CURL_EXTERN int curl_strnequal(const char *s1, const char *s2, size_t n);
2068+
2069+/* Mime/form handling support. */
2070+typedef struct curl_mime_s      curl_mime;      /* Mime context. */
2071+typedef struct curl_mimepart_s  curl_mimepart;  /* Mime part context. */
2072+
2073+/*
2074+ * NAME curl_mime_init()
2075+ *
2076+ * DESCRIPTION
2077+ *
2078+ * Create a mime context and return its handle. The easy parameter is the
2079+ * target handle.
2080+ */
2081+CURL_EXTERN curl_mime *curl_mime_init(CURL *easy);
2082+
2083+/*
2084+ * NAME curl_mime_free()
2085+ *
2086+ * DESCRIPTION
2087+ *
2088+ * release a mime handle and its substructures.
2089+ */
2090+CURL_EXTERN void curl_mime_free(curl_mime *mime);
2091+
2092+/*
2093+ * NAME curl_mime_addpart()
2094+ *
2095+ * DESCRIPTION
2096+ *
2097+ * Append a new empty part to the given mime context and return a handle to
2098+ * the created part.
2099+ */
2100+CURL_EXTERN curl_mimepart *curl_mime_addpart(curl_mime *mime);
2101+
2102+/*
2103+ * NAME curl_mime_name()
2104+ *
2105+ * DESCRIPTION
2106+ *
2107+ * Set mime/form part name.
2108+ */
2109+CURL_EXTERN CURLcode curl_mime_name(curl_mimepart *part, const char *name);
2110+
2111+/*
2112+ * NAME curl_mime_filename()
2113+ *
2114+ * DESCRIPTION
2115+ *
2116+ * Set mime part remote file name.
2117+ */
2118+CURL_EXTERN CURLcode curl_mime_filename(curl_mimepart *part,
2119+                                        const char *filename);
2120+
2121+/*
2122+ * NAME curl_mime_type()
2123+ *
2124+ * DESCRIPTION
2125+ *
2126+ * Set mime part type.
2127+ */
2128+CURL_EXTERN CURLcode curl_mime_type(curl_mimepart *part, const char *mimetype);
2129+
2130+/*
2131+ * NAME curl_mime_encoder()
2132+ *
2133+ * DESCRIPTION
2134+ *
2135+ * Set mime data transfer encoder.
2136+ */
2137+CURL_EXTERN CURLcode curl_mime_encoder(curl_mimepart *part,
2138+                                       const char *encoding);
2139+
2140+/*
2141+ * NAME curl_mime_data()
2142+ *
2143+ * DESCRIPTION
2144+ *
2145+ * Set mime part data source from memory data,
2146+ */
2147+CURL_EXTERN CURLcode curl_mime_data(curl_mimepart *part,
2148+                                    const char *data, size_t datasize);
2149+
2150+/*
2151+ * NAME curl_mime_filedata()
2152+ *
2153+ * DESCRIPTION
2154+ *
2155+ * Set mime part data source from named file.
2156+ */
2157+CURL_EXTERN CURLcode curl_mime_filedata(curl_mimepart *part,
2158+                                        const char *filename);
2159+
2160+/*
2161+ * NAME curl_mime_data_cb()
2162+ *
2163+ * DESCRIPTION
2164+ *
2165+ * Set mime part data source from callback function.
2166+ */
2167+CURL_EXTERN CURLcode curl_mime_data_cb(curl_mimepart *part,
2168+                                       curl_off_t datasize,
2169+                                       curl_read_callback readfunc,
2170+                                       curl_seek_callback seekfunc,
2171+                                       curl_free_callback freefunc,
2172+                                       void *arg);
2173+
2174+/*
2175+ * NAME curl_mime_subparts()
2176+ *
2177+ * DESCRIPTION
2178+ *
2179+ * Set mime part data source from subparts.
2180+ */
2181+CURL_EXTERN CURLcode curl_mime_subparts(curl_mimepart *part,
2182+                                        curl_mime *subparts);
2183+/*
2184+ * NAME curl_mime_headers()
2185+ *
2186+ * DESCRIPTION
2187+ *
2188+ * Set mime part headers.
2189+ */
2190+CURL_EXTERN CURLcode curl_mime_headers(curl_mimepart *part,
2191+                                       struct curl_slist *headers,
2192+                                       int take_ownership);
2193+
2194+/* Old form API. */
2195 /* name is uppercase CURLFORM_<name> */
2196 #ifdef CFINIT
2197 #undef CFINIT
2198 #endif
2199
2200 #ifdef CURL_ISOCPP
2201 #define CFINIT(name) CURLFORM_ ## name
2202 #else
2203@@ -1414,16 +2231,17 @@ typedef enum {
2204
2205   CFINIT(CONTENTTYPE),
2206   CFINIT(CONTENTHEADER),
2207   CFINIT(FILENAME),
2208   CFINIT(END),
2209   CFINIT(OBSOLETE2),
2210
2211   CFINIT(STREAM),
2212+  CFINIT(CONTENTLEN), /* added in 7.46.0, provide a curl_off_t length */
2213
2214   CURLFORM_LASTENTRY /* the last unused */
2215 } CURLformoption;
2216
2217 #undef CFINIT /* done */
2218
2219 /* structure to be used as parameter for CURLFORM_ARRAY */
2220 struct curl_forms {
2221@@ -1477,17 +2295,18 @@ CURL_EXTERN CURLFORMcode curl_formadd(st
2222 /*
2223  * callback function for curl_formget()
2224  * The void *arg pointer will be the one passed as second argument to
2225  *   curl_formget().
2226  * The character buffer passed to it must not be freed.
2227  * Should return the buffer length passed to it as the argument "len" on
2228  *   success.
2229  */
2230-typedef size_t (*curl_formget_callback)(void *arg, const char *buf, size_t len);
2231+typedef size_t (*curl_formget_callback)(void *arg, const char *buf,
2232+                                        size_t len);
2233
2234 /*
2235  * NAME curl_formget()
2236  *
2237  * DESCRIPTION
2238  *
2239  * Serialize a curl_httppost struct built with curl_formadd().
2240  * Accepts a void pointer as second argument which will be passed to
2241@@ -1616,16 +2435,57 @@ CURL_EXTERN void curl_global_cleanup(voi
2242
2243 /* linked-list structure for the CURLOPT_QUOTE option (and other) */
2244 struct curl_slist {
2245   char *data;
2246   struct curl_slist *next;
2247 };
2248
2249 /*
2250+ * NAME curl_global_sslset()
2251+ *
2252+ * DESCRIPTION
2253+ *
2254+ * When built with multiple SSL backends, curl_global_sslset() allows to
2255+ * choose one. This function can only be called once, and it must be called
2256+ * *before* curl_global_init().
2257+ *
2258+ * The backend can be identified by the id (e.g. CURLSSLBACKEND_OPENSSL). The
2259+ * backend can also be specified via the name parameter (passing -1 as id).
2260+ * If both id and name are specified, the name will be ignored. If neither id
2261+ * nor name are specified, the function will fail with
2262+ * CURLSSLSET_UNKNOWN_BACKEND and set the "avail" pointer to the
2263+ * NULL-terminated list of available backends.
2264+ *
2265+ * Upon success, the function returns CURLSSLSET_OK.
2266+ *
2267+ * If the specified SSL backend is not available, the function returns
2268+ * CURLSSLSET_UNKNOWN_BACKEND and sets the "avail" pointer to a NULL-terminated
2269+ * list of available SSL backends.
2270+ *
2271+ * The SSL backend can be set only once. If it has already been set, a
2272+ * subsequent attempt to change it will result in a CURLSSLSET_TOO_LATE.
2273+ */
2274+
2275+typedef struct {
2276+  curl_sslbackend id;
2277+  const char *name;
2278+} curl_ssl_backend;
2279+
2280+typedef enum {
2281+  CURLSSLSET_OK = 0,
2282+  CURLSSLSET_UNKNOWN_BACKEND,
2283+  CURLSSLSET_TOO_LATE,
2284+  CURLSSLSET_NO_BACKENDS /* libcurl was built without any SSL support */
2285+} CURLsslset;
2286+
2287+CURL_EXTERN CURLsslset curl_global_sslset(curl_sslbackend id, const char *name,
2288+                                          const curl_ssl_backend ***avail);
2289+
2290+/*
2291  * NAME curl_slist_append()
2292  *
2293  * DESCRIPTION
2294  *
2295  * Appends a string to a linked list. If no list exists, it will be created
2296  * first. Returns the new list, after appending.
2297  */
2298 CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *,
2299@@ -1655,41 +2515,59 @@ CURL_EXTERN time_t curl_getdate(const ch
2300    for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */
2301 struct curl_certinfo {
2302   int num_of_certs;             /* number of certificates with information */
2303   struct curl_slist **certinfo; /* for each index in this array, there's a
2304                                    linked list with textual information in the
2305                                    format "name: value" */
2306 };
2307
2308+/* Information about the SSL library used and the respective internal SSL
2309+   handle, which can be used to obtain further information regarding the
2310+   connection. Asked for with CURLINFO_TLS_SSL_PTR or CURLINFO_TLS_SESSION. */
2311+struct curl_tlssessioninfo {
2312+  curl_sslbackend backend;
2313+  void *internals;
2314+};
2315+
2316 #define CURLINFO_STRING   0x100000
2317 #define CURLINFO_LONG     0x200000
2318 #define CURLINFO_DOUBLE   0x300000
2319 #define CURLINFO_SLIST    0x400000
2320+#define CURLINFO_PTR      0x400000 /* same as SLIST */
2321+#define CURLINFO_SOCKET   0x500000
2322+#define CURLINFO_OFF_T    0x600000
2323 #define CURLINFO_MASK     0x0fffff
2324 #define CURLINFO_TYPEMASK 0xf00000
2325
2326 typedef enum {
2327   CURLINFO_NONE, /* first, never use this */
2328   CURLINFO_EFFECTIVE_URL    = CURLINFO_STRING + 1,
2329   CURLINFO_RESPONSE_CODE    = CURLINFO_LONG   + 2,
2330   CURLINFO_TOTAL_TIME       = CURLINFO_DOUBLE + 3,
2331   CURLINFO_NAMELOOKUP_TIME  = CURLINFO_DOUBLE + 4,
2332   CURLINFO_CONNECT_TIME     = CURLINFO_DOUBLE + 5,
2333   CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,
2334   CURLINFO_SIZE_UPLOAD      = CURLINFO_DOUBLE + 7,
2335+  CURLINFO_SIZE_UPLOAD_T    = CURLINFO_OFF_T  + 7,
2336   CURLINFO_SIZE_DOWNLOAD    = CURLINFO_DOUBLE + 8,
2337+  CURLINFO_SIZE_DOWNLOAD_T  = CURLINFO_OFF_T  + 8,
2338   CURLINFO_SPEED_DOWNLOAD   = CURLINFO_DOUBLE + 9,
2339+  CURLINFO_SPEED_DOWNLOAD_T = CURLINFO_OFF_T  + 9,
2340   CURLINFO_SPEED_UPLOAD     = CURLINFO_DOUBLE + 10,
2341+  CURLINFO_SPEED_UPLOAD_T   = CURLINFO_OFF_T  + 10,
2342   CURLINFO_HEADER_SIZE      = CURLINFO_LONG   + 11,
2343   CURLINFO_REQUEST_SIZE     = CURLINFO_LONG   + 12,
2344   CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG   + 13,
2345   CURLINFO_FILETIME         = CURLINFO_LONG   + 14,
2346+  CURLINFO_FILETIME_T       = CURLINFO_OFF_T  + 14,
2347   CURLINFO_CONTENT_LENGTH_DOWNLOAD   = CURLINFO_DOUBLE + 15,
2348+  CURLINFO_CONTENT_LENGTH_DOWNLOAD_T = CURLINFO_OFF_T  + 15,
2349   CURLINFO_CONTENT_LENGTH_UPLOAD     = CURLINFO_DOUBLE + 16,
2350+  CURLINFO_CONTENT_LENGTH_UPLOAD_T   = CURLINFO_OFF_T  + 16,
2351   CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,
2352   CURLINFO_CONTENT_TYPE     = CURLINFO_STRING + 18,
2353   CURLINFO_REDIRECT_TIME    = CURLINFO_DOUBLE + 19,
2354   CURLINFO_REDIRECT_COUNT   = CURLINFO_LONG   + 20,
2355   CURLINFO_PRIVATE          = CURLINFO_STRING + 21,
2356   CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG   + 22,
2357   CURLINFO_HTTPAUTH_AVAIL   = CURLINFO_LONG   + 23,
2358   CURLINFO_PROXYAUTH_AVAIL  = CURLINFO_LONG   + 24,
2359@@ -1697,21 +2575,45 @@ typedef enum {
2360   CURLINFO_NUM_CONNECTS     = CURLINFO_LONG   + 26,
2361   CURLINFO_SSL_ENGINES      = CURLINFO_SLIST  + 27,
2362   CURLINFO_COOKIELIST       = CURLINFO_SLIST  + 28,
2363   CURLINFO_LASTSOCKET       = CURLINFO_LONG   + 29,
2364   CURLINFO_FTP_ENTRY_PATH   = CURLINFO_STRING + 30,
2365   CURLINFO_REDIRECT_URL     = CURLINFO_STRING + 31,
2366   CURLINFO_PRIMARY_IP       = CURLINFO_STRING + 32,
2367   CURLINFO_APPCONNECT_TIME  = CURLINFO_DOUBLE + 33,
2368-  CURLINFO_CERTINFO         = CURLINFO_SLIST  + 34,
2369+  CURLINFO_CERTINFO         = CURLINFO_PTR    + 34,
2370   CURLINFO_CONDITION_UNMET  = CURLINFO_LONG   + 35,
2371+  CURLINFO_RTSP_SESSION_ID  = CURLINFO_STRING + 36,
2372+  CURLINFO_RTSP_CLIENT_CSEQ = CURLINFO_LONG   + 37,
2373+  CURLINFO_RTSP_SERVER_CSEQ = CURLINFO_LONG   + 38,
2374+  CURLINFO_RTSP_CSEQ_RECV   = CURLINFO_LONG   + 39,
2375+  CURLINFO_PRIMARY_PORT     = CURLINFO_LONG   + 40,
2376+  CURLINFO_LOCAL_IP         = CURLINFO_STRING + 41,
2377+  CURLINFO_LOCAL_PORT       = CURLINFO_LONG   + 42,
2378+  CURLINFO_TLS_SESSION      = CURLINFO_PTR    + 43,
2379+  CURLINFO_ACTIVESOCKET     = CURLINFO_SOCKET + 44,
2380+  CURLINFO_TLS_SSL_PTR      = CURLINFO_PTR    + 45,
2381+  CURLINFO_HTTP_VERSION     = CURLINFO_LONG   + 46,
2382+  CURLINFO_PROXY_SSL_VERIFYRESULT = CURLINFO_LONG + 47,
2383+  CURLINFO_PROTOCOL         = CURLINFO_LONG   + 48,
2384+  CURLINFO_SCHEME           = CURLINFO_STRING + 49,
2385   /* Fill in new entries below here! */
2386
2387-  CURLINFO_LASTONE          = 35
2388+  /* Preferably these would be defined conditionally based on the
2389+     sizeof curl_off_t being 64-bits */
2390+  CURLINFO_TOTAL_TIME_T     = CURLINFO_OFF_T + 50,
2391+  CURLINFO_NAMELOOKUP_TIME_T = CURLINFO_OFF_T + 51,
2392+  CURLINFO_CONNECT_TIME_T   = CURLINFO_OFF_T + 52,
2393+  CURLINFO_PRETRANSFER_TIME_T = CURLINFO_OFF_T + 53,
2394+  CURLINFO_STARTTRANSFER_TIME_T = CURLINFO_OFF_T + 54,
2395+  CURLINFO_REDIRECT_TIME_T  = CURLINFO_OFF_T + 55,
2396+  CURLINFO_APPCONNECT_TIME_T = CURLINFO_OFF_T + 56,
2397+
2398+  CURLINFO_LASTONE          = 56
2399 } CURLINFO;
2400
2401 /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
2402    CURLINFO_HTTP_CODE */
2403 #define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE
2404
2405 typedef enum {
2406   CURLCLOSEPOLICY_NONE, /* first, never use this */
2407@@ -1720,21 +2622,22 @@ typedef enum {
2408   CURLCLOSEPOLICY_LEAST_RECENTLY_USED,
2409   CURLCLOSEPOLICY_LEAST_TRAFFIC,
2410   CURLCLOSEPOLICY_SLOWEST,
2411   CURLCLOSEPOLICY_CALLBACK,
2412
2413   CURLCLOSEPOLICY_LAST /* last, never use this */
2414 } curl_closepolicy;
2415
2416-#define CURL_GLOBAL_SSL (1<<0)
2417+#define CURL_GLOBAL_SSL (1<<0) /* no purpose since since 7.57.0 */
2418 #define CURL_GLOBAL_WIN32 (1<<1)
2419 #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)
2420 #define CURL_GLOBAL_NOTHING 0
2421 #define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL
2422+#define CURL_GLOBAL_ACK_EINTR (1<<2)
2423
2424
2425 /*****************************************************************************
2426  * Setup defines, protos etc for the sharing stuff.
2427  */
2428
2429 /* Different data locks for a single share */
2430 typedef enum {
2431@@ -1743,16 +2646,17 @@ typedef enum {
2432    *  the locking is just made to change the internal state of the share
2433    *  itself.
2434    */
2435   CURL_LOCK_DATA_SHARE,
2436   CURL_LOCK_DATA_COOKIE,
2437   CURL_LOCK_DATA_DNS,
2438   CURL_LOCK_DATA_SSL_SESSION,
2439   CURL_LOCK_DATA_CONNECT,
2440+  CURL_LOCK_DATA_PSL,
2441   CURL_LOCK_DATA_LAST
2442 } curl_lock_data;
2443
2444 /* Different lock access types */
2445 typedef enum {
2446   CURL_LOCK_ACCESS_NONE = 0,   /* unspecified action */
2447   CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */
2448   CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */
2449@@ -1762,25 +2666,25 @@ typedef enum {
2450 typedef void (*curl_lock_function)(CURL *handle,
2451                                    curl_lock_data data,
2452                                    curl_lock_access locktype,
2453                                    void *userptr);
2454 typedef void (*curl_unlock_function)(CURL *handle,
2455                                      curl_lock_data data,
2456                                      void *userptr);
2457
2458-typedef void CURLSH;
2459
2460 typedef enum {
2461   CURLSHE_OK,  /* all is fine */
2462   CURLSHE_BAD_OPTION, /* 1 */
2463   CURLSHE_IN_USE,     /* 2 */
2464   CURLSHE_INVALID,    /* 3 */
2465-  CURLSHE_NOMEM,      /* out of memory */
2466-  CURLSHE_LAST /* never use */
2467+  CURLSHE_NOMEM,      /* 4 out of memory */
2468+  CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */
2469+  CURLSHE_LAST        /* never use */
2470 } CURLSHcode;
2471
2472 typedef enum {
2473   CURLSHOPT_NONE,  /* don't use */
2474   CURLSHOPT_SHARE,   /* specify a data type to share */
2475   CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */
2476   CURLSHOPT_LOCKFUNC,   /* pass in a 'curl_lock_function' pointer */
2477   CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */
2478@@ -1797,25 +2701,26 @@ CURL_EXTERN CURLSHcode curl_share_cleanu
2479  * Structures for querying information about the curl library at runtime.
2480  */
2481
2482 typedef enum {
2483   CURLVERSION_FIRST,
2484   CURLVERSION_SECOND,
2485   CURLVERSION_THIRD,
2486   CURLVERSION_FOURTH,
2487+  CURLVERSION_FIFTH,
2488   CURLVERSION_LAST /* never actually use this */
2489 } CURLversion;
2490
2491 /* The 'CURLVERSION_NOW' is the symbolic name meant to be used by
2492    basically all programs ever that want to get version information. It is
2493    meant to be a built-in version number for what kind of struct the caller
2494    expects. If the struct ever changes, we redefine the NOW to another enum
2495    from above. */
2496-#define CURLVERSION_NOW CURLVERSION_FOURTH
2497+#define CURLVERSION_NOW CURLVERSION_FIFTH
2498
2499 typedef struct {
2500   CURLversion age;          /* age of the returned struct */
2501   const char *version;      /* LIBCURL_VERSION */
2502   unsigned int version_num; /* LIBCURL_VERSION_NUM */
2503   const char *host;         /* OS/host/cpu/machine when configured */
2504   int features;             /* bitmask, see defines below */
2505   const char *ssl_version;  /* human readable string */
2506@@ -1833,34 +2738,56 @@ typedef struct {
2507
2508   /* These field were added in CURLVERSION_FOURTH */
2509
2510   /* Same as '_libiconv_version' if built with HAVE_ICONV */
2511   int iconv_ver_num;
2512
2513   const char *libssh_version; /* human readable string */
2514
2515+  /* These fields were added in CURLVERSION_FIFTH */
2516+
2517+  unsigned int brotli_ver_num; /* Numeric Brotli version
2518+                                  (MAJOR << 24) | (MINOR << 12) | PATCH */
2519+  const char *brotli_version; /* human readable string. */
2520+
2521 } curl_version_info_data;
2522
2523-#define CURL_VERSION_IPV6      (1<<0)  /* IPv6-enabled */
2524-#define CURL_VERSION_KERBEROS4 (1<<1)  /* kerberos auth is supported */
2525-#define CURL_VERSION_SSL       (1<<2)  /* SSL options are present */
2526-#define CURL_VERSION_LIBZ      (1<<3)  /* libz features are present */
2527-#define CURL_VERSION_NTLM      (1<<4)  /* NTLM auth is supported */
2528-#define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth support */
2529-#define CURL_VERSION_DEBUG     (1<<6)  /* built with debug capabilities */
2530-#define CURL_VERSION_ASYNCHDNS (1<<7)  /* asynchronous dns resolves */
2531-#define CURL_VERSION_SPNEGO    (1<<8)  /* SPNEGO auth */
2532-#define CURL_VERSION_LARGEFILE (1<<9)  /* supports files bigger than 2GB */
2533-#define CURL_VERSION_IDN       (1<<10) /* International Domain Names support */
2534-#define CURL_VERSION_SSPI      (1<<11) /* SSPI is supported */
2535-#define CURL_VERSION_CONV      (1<<12) /* character conversions supported */
2536-#define CURL_VERSION_CURLDEBUG (1<<13) /* debug memory tracking supported */
2537-
2538-/*
2539+#define CURL_VERSION_IPV6         (1<<0)  /* IPv6-enabled */
2540+#define CURL_VERSION_KERBEROS4    (1<<1)  /* Kerberos V4 auth is supported
2541+                                             (deprecated) */
2542+#define CURL_VERSION_SSL          (1<<2)  /* SSL options are present */
2543+#define CURL_VERSION_LIBZ         (1<<3)  /* libz features are present */
2544+#define CURL_VERSION_NTLM         (1<<4)  /* NTLM auth is supported */
2545+#define CURL_VERSION_GSSNEGOTIATE (1<<5)  /* Negotiate auth is supported
2546+                                             (deprecated) */
2547+#define CURL_VERSION_DEBUG        (1<<6)  /* Built with debug capabilities */
2548+#define CURL_VERSION_ASYNCHDNS    (1<<7)  /* Asynchronous DNS resolves */
2549+#define CURL_VERSION_SPNEGO       (1<<8)  /* SPNEGO auth is supported */
2550+#define CURL_VERSION_LARGEFILE    (1<<9)  /* Supports files larger than 2GB */
2551+#define CURL_VERSION_IDN          (1<<10) /* Internationized Domain Names are
2552+                                             supported */
2553+#define CURL_VERSION_SSPI         (1<<11) /* Built against Windows SSPI */
2554+#define CURL_VERSION_CONV         (1<<12) /* Character conversions supported */
2555+#define CURL_VERSION_CURLDEBUG    (1<<13) /* Debug memory tracking supported */
2556+#define CURL_VERSION_TLSAUTH_SRP  (1<<14) /* TLS-SRP auth is supported */
2557+#define CURL_VERSION_NTLM_WB      (1<<15) /* NTLM delegation to winbind helper
2558+                                             is supported */
2559+#define CURL_VERSION_HTTP2        (1<<16) /* HTTP2 support built-in */
2560+#define CURL_VERSION_GSSAPI       (1<<17) /* Built against a GSS-API library */
2561+#define CURL_VERSION_KERBEROS5    (1<<18) /* Kerberos V5 auth is supported */
2562+#define CURL_VERSION_UNIX_SOCKETS (1<<19) /* Unix domain sockets support */
2563+#define CURL_VERSION_PSL          (1<<20) /* Mozilla's Public Suffix List, used
2564+                                             for cookie domain verification */
2565+#define CURL_VERSION_HTTPS_PROXY  (1<<21) /* HTTPS-proxy support built-in */
2566+#define CURL_VERSION_MULTI_SSL    (1<<22) /* Multiple SSL backends available */
2567+#define CURL_VERSION_BROTLI       (1<<23) /* Brotli features are present. */
2568+#define CURL_VERSION_ALTSVC       (1<<24) /* Alt-Svc handling built-in */
2569+
2570+ /*
2571  * NAME curl_version_info()
2572  *
2573  * DESCRIPTION
2574  *
2575  * This function returns a pointer to a static copy of the version info
2576  * struct. See above.
2577  */
2578 CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion);
2579@@ -1910,16 +2837,17 @@ CURL_EXTERN CURLcode curl_easy_pause(CUR
2580 #ifdef  __cplusplus
2581 }
2582 #endif
2583
2584 /* unfortunately, the easy.h and multi.h include files need options and info
2585   stuff before they can be included! */
2586 #include "easy.h" /* nothing in curl is fun without the easy stuff */
2587 #include "multi.h"
2588+#include "urlapi.h"
2589
2590 /* the typechecker doesn't work in C++ (yet) */
2591 #if defined(__GNUC__) && defined(__GNUC_MINOR__) && \
2592     ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \
2593     !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK)
2594 #include "typecheck-gcc.h"
2595 #else
2596 #if defined(__STDC__) && (__STDC__ >= 1)
2597diff --git a/src/third_party/curl/curlbuild.h b/src/third_party/curl/curlbuild.h
2598deleted file mode 100644
2599--- a/src/third_party/curl/curlbuild.h
2600+++ /dev/null
2601@@ -1,203 +0,0 @@
2602-/* include/curl/curlbuild.h.  Generated from curlbuild.h.in by configure.  */
2603-#ifndef __CURL_CURLBUILD_H
2604-#define __CURL_CURLBUILD_H
2605-/***************************************************************************
2606- *                                  _   _ ____  _
2607- *  Project                     ___| | | |  _ \| |
2608- *                             / __| | | | |_) | |
2609- *                            | (__| |_| |  _ <| |___
2610- *                             \___|\___/|_| \_\_____|
2611- *
2612- * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
2613- *
2614- * This software is licensed as described in the file COPYING, which
2615- * you should have received as part of this distribution. The terms
2616- * are also available at http://curl.haxx.se/docs/copyright.html.
2617- *
2618- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
2619- * copies of the Software, and permit persons to whom the Software is
2620- * furnished to do so, under the terms of the COPYING file.
2621- *
2622- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
2623- * KIND, either express or implied.
2624- *
2625- * $Id: curlbuild.h.in,v 1.8 2009-04-29 15:15:38 yangtse Exp $
2626- ***************************************************************************/
2627-
2628-/* ================================================================ */
2629-/*               NOTES FOR CONFIGURE CAPABLE SYSTEMS                */
2630-/* ================================================================ */
2631-
2632-/*
2633- * NOTE 1:
2634- * -------
2635- *
2636- * Nothing in this file is intended to be modified or adjusted by the
2637- * curl library user nor by the curl library builder.
2638- *
2639- * If you think that something actually needs to be changed, adjusted
2640- * or fixed in this file, then, report it on the libcurl development
2641- * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/
2642- *
2643- * This header file shall only export symbols which are 'curl' or 'CURL'
2644- * prefixed, otherwise public name space would be polluted.
2645- *
2646- * NOTE 2:
2647- * -------
2648- *
2649- * Right now you might be staring at file include/curl/curlbuild.h.in or
2650- * at file include/curl/curlbuild.h, this is due to the following reason:
2651- *
2652- * On systems capable of running the configure script, the configure process
2653- * will overwrite the distributed include/curl/curlbuild.h file with one that
2654- * is suitable and specific to the library being configured and built, which
2655- * is generated from the include/curl/curlbuild.h.in template file.
2656- *
2657- */
2658-
2659-/* ================================================================ */
2660-/*  DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE  */
2661-/* ================================================================ */
2662-
2663-#ifdef CURL_SIZEOF_LONG
2664-#  error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h"
2665-   Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined
2666-#endif
2667-
2668-#ifdef CURL_TYPEOF_CURL_SOCKLEN_T
2669-#  error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
2670-   Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined
2671-#endif
2672-
2673-#ifdef CURL_SIZEOF_CURL_SOCKLEN_T
2674-#  error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
2675-   Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined
2676-#endif
2677-
2678-#ifdef CURL_TYPEOF_CURL_OFF_T
2679-#  error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
2680-   Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined
2681-#endif
2682-
2683-#ifdef CURL_FORMAT_CURL_OFF_T
2684-#  error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h"
2685-   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined
2686-#endif
2687-
2688-#ifdef CURL_FORMAT_CURL_OFF_TU
2689-#  error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h"
2690-   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined
2691-#endif
2692-
2693-#ifdef CURL_FORMAT_OFF_T
2694-#  error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h"
2695-   Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined
2696-#endif
2697-
2698-#ifdef CURL_SIZEOF_CURL_OFF_T
2699-#  error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
2700-   Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined
2701-#endif
2702-
2703-#ifdef CURL_SUFFIX_CURL_OFF_T
2704-#  error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h"
2705-   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined
2706-#endif
2707-
2708-#ifdef CURL_SUFFIX_CURL_OFF_TU
2709-#  error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h"
2710-   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined
2711-#endif
2712-
2713-/* ================================================================ */
2714-/*  EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY  */
2715-/* ================================================================ */
2716-
2717-/* Configure process defines this to 1 when it finds out that system  */
2718-/* header file ws2tcpip.h must be included by the external interface. */
2719-/* #undef CURL_PULL_WS2TCPIP_H */
2720-#ifdef CURL_PULL_WS2TCPIP_H
2721-#  ifndef WIN32_LEAN_AND_MEAN
2722-#    define WIN32_LEAN_AND_MEAN
2723-#  endif
2724-#  include <windows.h>
2725-#  include <winsock2.h>
2726-#  include <ws2tcpip.h>
2727-#endif
2728-
2729-/* Configure process defines this to 1 when it finds out that system   */
2730-/* header file sys/types.h must be included by the external interface. */
2731-#define CURL_PULL_SYS_TYPES_H 1
2732-#ifdef CURL_PULL_SYS_TYPES_H
2733-#  include <sys/types.h>
2734-#endif
2735-
2736-/* Configure process defines this to 1 when it finds out that system */
2737-/* header file stdint.h must be included by the external interface.  */
2738-/* #undef CURL_PULL_STDINT_H */
2739-#ifdef CURL_PULL_STDINT_H
2740-#  include <stdint.h>
2741-#endif
2742-
2743-/* Configure process defines this to 1 when it finds out that system  */
2744-/* header file inttypes.h must be included by the external interface. */
2745-/* #undef CURL_PULL_INTTYPES_H */
2746-#ifdef CURL_PULL_INTTYPES_H
2747-#  include <inttypes.h>
2748-#endif
2749-
2750-/* Configure process defines this to 1 when it finds out that system    */
2751-/* header file sys/socket.h must be included by the external interface. */
2752-#define CURL_PULL_SYS_SOCKET_H 1
2753-#ifdef CURL_PULL_SYS_SOCKET_H
2754-#  include <sys/socket.h>
2755-#endif
2756-
2757-/* The size of `long', as computed by sizeof. */
2758-#if defined(_M_X64) || (defined(__x86_64__) && !defined(__ILP32__)) ||      \
2759-    defined(__aarch64__) || (defined(__mips__) && _MIPS_SIM == _ABI64) ||   \
2760-    defined(__powerpc64__) || defined(__s390x__) || defined(__LP64__)
2761-#define CURL_SIZEOF_LONG 8
2762-#else
2763-#define CURL_SIZEOF_LONG 4
2764-#endif
2765-
2766-/* Integral data type used for curl_socklen_t. */
2767-#define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
2768-
2769-/* The size of `curl_socklen_t', as computed by sizeof. */
2770-#define CURL_SIZEOF_CURL_SOCKLEN_T 4
2771-
2772-/* Data type definition of curl_socklen_t. */
2773-typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
2774-
2775-/* Signed integral data type used for curl_off_t. */
2776-#if defined(_M_X64) || (defined(__x86_64__) && !defined(__ILP32__)) ||      \
2777-    defined(__aarch64__)
2778-#define CURL_TYPEOF_CURL_OFF_T long
2779-#else
2780-#define CURL_TYPEOF_CURL_OFF_T int64_t
2781-#endif
2782-
2783-/* Data type definition of curl_off_t. */
2784-typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
2785-
2786-/* curl_off_t formatting string directive without "%" conversion specifier. */
2787-#define CURL_FORMAT_CURL_OFF_T "ld"
2788-
2789-/* unsigned curl_off_t formatting string without "%" conversion specifier. */
2790-#define CURL_FORMAT_CURL_OFF_TU "lu"
2791-
2792-/* curl_off_t formatting string directive with "%" conversion specifier. */
2793-#define CURL_FORMAT_OFF_T "%ld"
2794-
2795-/* The size of `curl_off_t', as computed by sizeof. */
2796-#define CURL_SIZEOF_CURL_OFF_T 8
2797-
2798-/* curl_off_t constant suffix. */
2799-#define CURL_SUFFIX_CURL_OFF_T L
2800-
2801-/* unsigned curl_off_t constant suffix. */
2802-#define CURL_SUFFIX_CURL_OFF_TU UL
2803-
2804-#endif /* __CURL_CURLBUILD_H */
2805diff --git a/src/third_party/curl/curlrules.h b/src/third_party/curl/curlrules.h
2806deleted file mode 100644
2807--- a/src/third_party/curl/curlrules.h
2808+++ /dev/null
2809@@ -1,249 +0,0 @@
2810-#ifndef __CURL_CURLRULES_H
2811-#define __CURL_CURLRULES_H
2812-/***************************************************************************
2813- *                                  _   _ ____  _
2814- *  Project                     ___| | | |  _ \| |
2815- *                             / __| | | | |_) | |
2816- *                            | (__| |_| |  _ <| |___
2817- *                             \___|\___/|_| \_\_____|
2818- *
2819- * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
2820- *
2821- * This software is licensed as described in the file COPYING, which
2822- * you should have received as part of this distribution. The terms
2823- * are also available at http://curl.haxx.se/docs/copyright.html.
2824- *
2825- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
2826- * copies of the Software, and permit persons to whom the Software is
2827- * furnished to do so, under the terms of the COPYING file.
2828- *
2829- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
2830- * KIND, either express or implied.
2831- *
2832- * $Id: curlrules.h,v 1.7 2009-10-27 16:56:20 yangtse Exp $
2833- ***************************************************************************/
2834-
2835-/* ================================================================ */
2836-/*                    COMPILE TIME SANITY CHECKS                    */
2837-/* ================================================================ */
2838-
2839-/*
2840- * NOTE 1:
2841- * -------
2842- *
2843- * All checks done in this file are intentionally placed in a public
2844- * header file which is pulled by curl/curl.h when an application is
2845- * being built using an already built libcurl library. Additionally
2846- * this file is also included and used when building the library.
2847- *
2848- * If compilation fails on this file it is certainly sure that the
2849- * problem is elsewhere. It could be a problem in the curlbuild.h
2850- * header file, or simply that you are using different compilation
2851- * settings than those used to build the library.
2852- *
2853- * Nothing in this file is intended to be modified or adjusted by the
2854- * curl library user nor by the curl library builder.
2855- *
2856- * Do not deactivate any check, these are done to make sure that the
2857- * library is properly built and used.
2858- *
2859- * You can find further help on the libcurl development mailing list:
2860- * http://cool.haxx.se/mailman/listinfo/curl-library/
2861- *
2862- * NOTE 2
2863- * ------
2864- *
2865- * Some of the following compile time checks are based on the fact
2866- * that the dimension of a constant array can not be a negative one.
2867- * In this way if the compile time verification fails, the compilation
2868- * will fail issuing an error. The error description wording is compiler
2869- * dependent but it will be quite similar to one of the following:
2870- *
2871- *   "negative subscript or subscript is too large"
2872- *   "array must have at least one element"
2873- *   "-1 is an illegal array size"
2874- *   "size of array is negative"
2875- *
2876- * If you are building an application which tries to use an already
2877- * built libcurl library and you are getting this kind of errors on
2878- * this file, it is a clear indication that there is a mismatch between
2879- * how the library was built and how you are trying to use it for your
2880- * application. Your already compiled or binary library provider is the
2881- * only one who can give you the details you need to properly use it.
2882- */
2883-
2884-/*
2885- * Verify that some macros are actually defined.
2886- */
2887-
2888-#ifndef CURL_SIZEOF_LONG
2889-#  error "CURL_SIZEOF_LONG definition is missing!"
2890-   Error Compilation_aborted_CURL_SIZEOF_LONG_is_missing
2891-#endif
2892-
2893-#ifndef CURL_TYPEOF_CURL_SOCKLEN_T
2894-#  error "CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!"
2895-   Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_is_missing
2896-#endif
2897-
2898-#ifndef CURL_SIZEOF_CURL_SOCKLEN_T
2899-#  error "CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!"
2900-   Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_is_missing
2901-#endif
2902-
2903-#ifndef CURL_TYPEOF_CURL_OFF_T
2904-#  error "CURL_TYPEOF_CURL_OFF_T definition is missing!"
2905-   Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing
2906-#endif
2907-
2908-#ifndef CURL_FORMAT_CURL_OFF_T
2909-#  error "CURL_FORMAT_CURL_OFF_T definition is missing!"
2910-   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing
2911-#endif
2912-
2913-#ifndef CURL_FORMAT_CURL_OFF_TU
2914-#  error "CURL_FORMAT_CURL_OFF_TU definition is missing!"
2915-   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing
2916-#endif
2917-
2918-#ifndef CURL_FORMAT_OFF_T
2919-#  error "CURL_FORMAT_OFF_T definition is missing!"
2920-   Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing
2921-#endif
2922-
2923-#ifndef CURL_SIZEOF_CURL_OFF_T
2924-#  error "CURL_SIZEOF_CURL_OFF_T definition is missing!"
2925-   Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing
2926-#endif
2927-
2928-#ifndef CURL_SUFFIX_CURL_OFF_T
2929-#  error "CURL_SUFFIX_CURL_OFF_T definition is missing!"
2930-   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing
2931-#endif
2932-
2933-#ifndef CURL_SUFFIX_CURL_OFF_TU
2934-#  error "CURL_SUFFIX_CURL_OFF_TU definition is missing!"
2935-   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing
2936-#endif
2937-
2938-/*
2939- * Macros private to this header file.
2940- */
2941-
2942-#define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1
2943-
2944-#define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1
2945-
2946-/*
2947- * Verify that the size previously defined and expected for long
2948- * is the same as the one reported by sizeof() at compile time.
2949- */
2950-
2951-typedef char
2952-  __curl_rule_01__
2953-    [CurlchkszEQ(long, CURL_SIZEOF_LONG)];
2954-
2955-/*
2956- * Verify that the size previously defined and expected for
2957- * curl_off_t is actually the the same as the one reported
2958- * by sizeof() at compile time.
2959- */
2960-
2961-typedef char
2962-  __curl_rule_02__
2963-    [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)];
2964-
2965-/*
2966- * Verify at compile time that the size of curl_off_t as reported
2967- * by sizeof() is greater or equal than the one reported for long
2968- * for the current compilation.
2969- */
2970-
2971-typedef char
2972-  __curl_rule_03__
2973-    [CurlchkszGE(curl_off_t, long)];
2974-
2975-/*
2976- * Verify that the size previously defined and expected for
2977- * curl_socklen_t is actually the the same as the one reported
2978- * by sizeof() at compile time.
2979- */
2980-
2981-typedef char
2982-  __curl_rule_04__
2983-    [CurlchkszEQ(curl_socklen_t, CURL_SIZEOF_CURL_SOCKLEN_T)];
2984-
2985-/*
2986- * Verify at compile time that the size of curl_socklen_t as reported
2987- * by sizeof() is greater or equal than the one reported for int for
2988- * the current compilation.
2989- */
2990-
2991-typedef char
2992-  __curl_rule_05__
2993-    [CurlchkszGE(curl_socklen_t, int)];
2994-
2995-/* ================================================================ */
2996-/*          EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS           */
2997-/* ================================================================ */
2998-
2999-/*
3000- * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
3001- * these to be visible and exported by the external libcurl interface API,
3002- * while also making them visible to the library internals, simply including
3003- * setup.h, without actually needing to include curl.h internally.
3004- * If some day this section would grow big enough, all this should be moved
3005- * to its own header file.
3006- */
3007-
3008-/*
3009- * Figure out if we can use the ## preprocessor operator, which is supported
3010- * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
3011- * or  __cplusplus so we need to carefully check for them too.
3012- */
3013-
3014-#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
3015-  defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
3016-  defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
3017-  defined(__ILEC400__)
3018-  /* This compiler is believed to have an ISO compatible preprocessor */
3019-#define CURL_ISOCPP
3020-#else
3021-  /* This compiler is believed NOT to have an ISO compatible preprocessor */
3022-#undef CURL_ISOCPP
3023-#endif
3024-
3025-/*
3026- * Macros for minimum-width signed and unsigned curl_off_t integer constants.
3027- */
3028-
3029-#ifdef CURL_ISOCPP
3030-#  define __CURL_OFF_T_C_HELPER2(Val,Suffix) Val ## Suffix
3031-#else
3032-#  define __CURL_OFF_T_C_HELPER2(Val,Suffix) Val/**/Suffix
3033-#endif
3034-#define __CURL_OFF_T_C_HELPER1(Val,Suffix) __CURL_OFF_T_C_HELPER2(Val,Suffix)
3035-#define CURL_OFF_T_C(Val)  __CURL_OFF_T_C_HELPER1(Val,CURL_SUFFIX_CURL_OFF_T)
3036-#define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HELPER1(Val,CURL_SUFFIX_CURL_OFF_TU)
3037-
3038-/*
3039- * Get rid of macros private to this header file.
3040- */
3041-
3042-#undef CurlchkszEQ
3043-#undef CurlchkszGE
3044-
3045-/*
3046- * Get rid of macros not intended to exist beyond this point.
3047- */
3048-
3049-#undef CURL_PULL_WS2TCPIP_H
3050-#undef CURL_PULL_SYS_TYPES_H
3051-#undef CURL_PULL_SYS_SOCKET_H
3052-#undef CURL_PULL_STDINT_H
3053-#undef CURL_PULL_INTTYPES_H
3054-
3055-#undef CURL_TYPEOF_CURL_SOCKLEN_T
3056-#undef CURL_TYPEOF_CURL_OFF_T
3057-
3058-#endif /* __CURL_CURLRULES_H */
3059diff --git a/src/third_party/curl/curlver.h b/src/third_party/curl/curlver.h
3060--- a/src/third_party/curl/curlver.h
3061+++ b/src/third_party/curl/curlver.h
3062@@ -2,69 +2,76 @@
3063 #define __CURL_CURLVER_H
3064 /***************************************************************************
3065  *                                  _   _ ____  _
3066  *  Project                     ___| | | |  _ \| |
3067  *                             / __| | | | |_) | |
3068  *                            | (__| |_| |  _ <| |___
3069  *                             \___|\___/|_| \_\_____|
3070  *
3071- * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
3072+ * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
3073  *
3074  * This software is licensed as described in the file COPYING, which
3075  * you should have received as part of this distribution. The terms
3076- * are also available at http://curl.haxx.se/docs/copyright.html.
3077+ * are also available at https://curl.haxx.se/docs/copyright.html.
3078  *
3079  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
3080  * copies of the Software, and permit persons to whom the Software is
3081  * furnished to do so, under the terms of the COPYING file.
3082  *
3083  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
3084  * KIND, either express or implied.
3085  *
3086- * $Id: curlver.h,v 1.48 2009-08-12 11:24:52 bagder Exp $
3087  ***************************************************************************/
3088
3089 /* This header file contains nothing but libcurl version info, generated by
3090    a script at release-time. This was made its own header file in 7.11.2 */
3091
3092 /* This is the global package copyright */
3093-#define LIBCURL_COPYRIGHT "1996 - 2009 Daniel Stenberg, <daniel@haxx.se>."
3094+#define LIBCURL_COPYRIGHT "1996 - 2019 Daniel Stenberg, <daniel@haxx.se>."
3095
3096 /* This is the version number of the libcurl package from which this header
3097    file origins: */
3098-#define LIBCURL_VERSION "7.19.7"
3099+#define LIBCURL_VERSION "7.64.1-DEV"
3100
3101 /* The numeric version number is also available "in parts" by using these
3102    defines: */
3103 #define LIBCURL_VERSION_MAJOR 7
3104-#define LIBCURL_VERSION_MINOR 19
3105-#define LIBCURL_VERSION_PATCH 7
3106+#define LIBCURL_VERSION_MINOR 64
3107+#define LIBCURL_VERSION_PATCH 1
3108
3109 /* This is the numeric version of the libcurl version number, meant for easier
3110    parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
3111    always follow this syntax:
3112
3113          0xXXYYZZ
3114
3115    Where XX, YY and ZZ are the main version, release and patch numbers in
3116    hexadecimal (using 8 bits each). All three numbers are always represented
3117    using two digits.  1.2 would appear as "0x010200" while version 9.11.7
3118    appears as "0x090b07".
3119
3120    This 6-digit (24 bits) hexadecimal number does not show pre-release number,
3121    and it is always a greater number in a more recent release. It makes
3122    comparisons with greater than and less than work.
3123+
3124+   Note: This define is the full hex number and _does not_ use the
3125+   CURL_VERSION_BITS() macro since curl's own configure script greps for it
3126+   and needs it to contain the full number.
3127 */
3128-#define LIBCURL_VERSION_NUM 0x071307
3129+#define LIBCURL_VERSION_NUM 0x074001
3130
3131 /*
3132  * This is the date and time when the full source package was created. The
3133- * timestamp is not stored in CVS, as the timestamp is properly set in the
3134+ * timestamp is not stored in git, as the timestamp is properly set in the
3135  * tarballs by the maketgz script.
3136  *
3137- * The format of the date should follow this template:
3138+ * The format of the date follows this template:
3139  *
3140- * "Mon Feb 12 11:35:33 UTC 2007"
3141+ * "2007-11-23"
3142  */
3143-#define LIBCURL_TIMESTAMP "Wed Nov  4 12:34:59 UTC 2009"
3144+#define LIBCURL_TIMESTAMP "[unreleased]"
3145+
3146+#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|z)
3147+#define CURL_AT_LEAST_VERSION(x,y,z) \
3148+  (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
3149
3150 #endif /* __CURL_CURLVER_H */
3151diff --git a/src/third_party/curl/easy.h b/src/third_party/curl/easy.h
3152--- a/src/third_party/curl/easy.h
3153+++ b/src/third_party/curl/easy.h
3154@@ -2,30 +2,29 @@
3155 #define __CURL_EASY_H
3156 /***************************************************************************
3157  *                                  _   _ ____  _
3158  *  Project                     ___| | | |  _ \| |
3159  *                             / __| | | | |_) | |
3160  *                            | (__| |_| |  _ <| |___
3161  *                             \___|\___/|_| \_\_____|
3162  *
3163- * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
3164+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
3165  *
3166  * This software is licensed as described in the file COPYING, which
3167  * you should have received as part of this distribution. The terms
3168- * are also available at http://curl.haxx.se/docs/copyright.html.
3169+ * are also available at https://curl.haxx.se/docs/copyright.html.
3170  *
3171  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
3172  * copies of the Software, and permit persons to whom the Software is
3173  * furnished to do so, under the terms of the COPYING file.
3174  *
3175  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
3176  * KIND, either express or implied.
3177  *
3178- * $Id: easy.h,v 1.14 2008-05-12 21:43:28 bagder Exp $
3179  ***************************************************************************/
3180 #ifdef  __cplusplus
3181 extern "C" {
3182 #endif
3183
3184 CURL_EXTERN CURL *curl_easy_init(void);
3185 CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
3186 CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);
3187@@ -49,22 +48,22 @@ CURL_EXTERN CURLcode curl_easy_getinfo(C
3188
3189 /*
3190  * NAME curl_easy_duphandle()
3191  *
3192  * DESCRIPTION
3193  *
3194  * Creates a new curl session handle with the same options set for the handle
3195  * passed in. Duplicating a handle could only be a matter of cloning data and
3196- * options, internal state info and things like persistant connections cannot
3197- * be transfered. It is useful in multithreaded applications when you can run
3198+ * options, internal state info and things like persistent connections cannot
3199+ * be transferred. It is useful in multithreaded applications when you can run
3200  * curl_easy_duphandle() for each new thread to avoid a series of identical
3201  * curl_easy_setopt() invokes in every thread.
3202  */
3203-CURL_EXTERN CURL* curl_easy_duphandle(CURL *curl);
3204+CURL_EXTERN CURL *curl_easy_duphandle(CURL *curl);
3205
3206 /*
3207  * NAME curl_easy_reset()
3208  *
3209  * DESCRIPTION
3210  *
3211  * Re-initializes a CURL handle to the default values. This puts back the
3212  * handle to the same state as it was in when it was just created.
3213@@ -91,13 +90,23 @@ CURL_EXTERN CURLcode curl_easy_recv(CURL
3214  * DESCRIPTION
3215  *
3216  * Sends data over the connected socket. Use after successful
3217  * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
3218  */
3219 CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer,
3220                                     size_t buflen, size_t *n);
3221
3222+
3223+/*
3224+ * NAME curl_easy_upkeep()
3225+ *
3226+ * DESCRIPTION
3227+ *
3228+ * Performs connection upkeep for the given session handle.
3229+ */
3230+CURL_EXTERN CURLcode curl_easy_upkeep(CURL *curl);
3231+
3232 #ifdef  __cplusplus
3233 }
3234 #endif
3235
3236 #endif
3237diff --git a/src/third_party/curl/mprintf.h b/src/third_party/curl/mprintf.h
3238deleted file mode 100644
3239--- a/src/third_party/curl/mprintf.h
3240+++ /dev/null
3241@@ -1,82 +0,0 @@
3242-#ifndef __CURL_MPRINTF_H
3243-#define __CURL_MPRINTF_H
3244-/***************************************************************************
3245- *                                  _   _ ____  _
3246- *  Project                     ___| | | |  _ \| |
3247- *                             / __| | | | |_) | |
3248- *                            | (__| |_| |  _ <| |___
3249- *                             \___|\___/|_| \_\_____|
3250- *
3251- * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
3252- *
3253- * This software is licensed as described in the file COPYING, which
3254- * you should have received as part of this distribution. The terms
3255- * are also available at http://curl.haxx.se/docs/copyright.html.
3256- *
3257- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
3258- * copies of the Software, and permit persons to whom the Software is
3259- * furnished to do so, under the terms of the COPYING file.
3260- *
3261- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
3262- * KIND, either express or implied.
3263- *
3264- * $Id: mprintf.h,v 1.16 2008-05-20 10:21:50 patrickm Exp $
3265- ***************************************************************************/
3266-
3267-#include <stdarg.h>
3268-#include <stdio.h> /* needed for FILE */
3269-
3270-#include "curl.h"
3271-
3272-#ifdef  __cplusplus
3273-extern "C" {
3274-#endif
3275-
3276-CURL_EXTERN int curl_mprintf(const char *format, ...);
3277-CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);
3278-CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);
3279-CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,
3280-                               const char *format, ...);
3281-CURL_EXTERN int curl_mvprintf(const char *format, va_list args);
3282-CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);
3283-CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);
3284-CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,
3285-                                const char *format, va_list args);
3286-CURL_EXTERN char *curl_maprintf(const char *format, ...);
3287-CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);
3288-
3289-#ifdef _MPRINTF_REPLACE
3290-# undef printf
3291-# undef fprintf
3292-# undef sprintf
3293-# undef vsprintf
3294-# undef snprintf
3295-# undef vprintf
3296-# undef vfprintf
3297-# undef vsnprintf
3298-# undef aprintf
3299-# undef vaprintf
3300-# define printf curl_mprintf
3301-# define fprintf curl_mfprintf
3302-#ifdef CURLDEBUG
3303-/* When built with CURLDEBUG we define away the sprintf() functions since we
3304-   don't want internal code to be using them */
3305-# define sprintf sprintf_was_used
3306-# define vsprintf vsprintf_was_used
3307-#else
3308-# define sprintf curl_msprintf
3309-# define vsprintf curl_mvsprintf
3310-#endif
3311-# define snprintf curl_msnprintf
3312-# define vprintf curl_mvprintf
3313-# define vfprintf curl_mvfprintf
3314-# define vsnprintf curl_mvsnprintf
3315-# define aprintf curl_maprintf
3316-# define vaprintf curl_mvaprintf
3317-#endif
3318-
3319-#ifdef  __cplusplus
3320-}
3321-#endif
3322-
3323-#endif /* __CURL_MPRINTF_H */
3324diff --git a/src/third_party/curl/multi.h b/src/third_party/curl/multi.h
3325--- a/src/third_party/curl/multi.h
3326+++ b/src/third_party/curl/multi.h
3327@@ -2,30 +2,29 @@
3328 #define __CURL_MULTI_H
3329 /***************************************************************************
3330  *                                  _   _ ____  _
3331  *  Project                     ___| | | |  _ \| |
3332  *                             / __| | | | |_) | |
3333  *                            | (__| |_| |  _ <| |___
3334  *                             \___|\___/|_| \_\_____|
3335  *
3336- * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
3337+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
3338  *
3339  * This software is licensed as described in the file COPYING, which
3340  * you should have received as part of this distribution. The terms
3341- * are also available at http://curl.haxx.se/docs/copyright.html.
3342+ * are also available at https://curl.haxx.se/docs/copyright.html.
3343  *
3344  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
3345  * copies of the Software, and permit persons to whom the Software is
3346  * furnished to do so, under the terms of the COPYING file.
3347  *
3348  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
3349  * KIND, either express or implied.
3350  *
3351- * $Id: multi.h,v 1.45 2008-05-20 10:21:50 patrickm Exp $
3352  ***************************************************************************/
3353 /*
3354   This is an "external" header file. Don't give away any internals here!
3355
3356   GOALS
3357
3358   o Enable a "pull" interface. The application that uses libcurl decides where
3359     and when to ask libcurl to get/send data.
3360@@ -48,36 +47,49 @@
3361  * but with this warning attached.
3362  */
3363 #include "curl.h"
3364
3365 #ifdef  __cplusplus
3366 extern "C" {
3367 #endif
3368
3369+#if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER)
3370+typedef struct Curl_multi CURLM;
3371+#else
3372 typedef void CURLM;
3373+#endif
3374
3375 typedef enum {
3376   CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or
3377                                     curl_multi_socket*() soon */
3378   CURLM_OK,
3379   CURLM_BAD_HANDLE,      /* the passed-in handle is not a valid CURLM handle */
3380   CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
3381   CURLM_OUT_OF_MEMORY,   /* if you ever get this, you're in deep sh*t */
3382   CURLM_INTERNAL_ERROR,  /* this is a libcurl bug */
3383   CURLM_BAD_SOCKET,      /* the passed in socket argument did not match */
3384   CURLM_UNKNOWN_OPTION,  /* curl_multi_setopt() with unsupported option */
3385+  CURLM_ADDED_ALREADY,   /* an easy handle already added to a multi handle was
3386+                            attempted to get added - again */
3387+  CURLM_RECURSIVE_API_CALL, /* an api function was called from inside a
3388+                               callback */
3389   CURLM_LAST
3390 } CURLMcode;
3391
3392 /* just to make code nicer when using curl_multi_socket() you can now check
3393    for CURLM_CALL_MULTI_SOCKET too in the same style it works for
3394    curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */
3395 #define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM
3396
3397+/* bitmask bits for CURLMOPT_PIPELINING */
3398+#define CURLPIPE_NOTHING   0L
3399+#define CURLPIPE_HTTP1     1L
3400+#define CURLPIPE_MULTIPLEX 2L
3401+
3402 typedef enum {
3403   CURLMSG_NONE, /* first, not used */
3404   CURLMSG_DONE, /* This easy handle has completed. 'result' contains
3405                    the CURLcode of the transfer */
3406   CURLMSG_LAST /* last, not used */
3407 } CURLMSG;
3408
3409 struct CURLMsg {
3410@@ -85,16 +97,29 @@ struct CURLMsg {
3411   CURL *easy_handle; /* the handle it concerns */
3412   union {
3413     void *whatever;    /* message-specific data */
3414     CURLcode result;   /* return code for transfer */
3415   } data;
3416 };
3417 typedef struct CURLMsg CURLMsg;
3418
3419+/* Based on poll(2) structure and values.
3420+ * We don't use pollfd and POLL* constants explicitly
3421+ * to cover platforms without poll(). */
3422+#define CURL_WAIT_POLLIN    0x0001
3423+#define CURL_WAIT_POLLPRI   0x0002
3424+#define CURL_WAIT_POLLOUT   0x0004
3425+
3426+struct curl_waitfd {
3427+  curl_socket_t fd;
3428+  short events;
3429+  short revents; /* not supported yet */
3430+};
3431+
3432 /*
3433  * Name:    curl_multi_init()
3434  *
3435  * Desc:    inititalize multi-style curl usage
3436  *
3437  * Returns: a new CURLM handle to use in all 'curl_multi' functions.
3438  */
3439 CURL_EXTERN CURLM *curl_multi_init(void);
3440@@ -129,31 +154,45 @@ CURL_EXTERN CURLMcode curl_multi_remove_
3441   * Returns: CURLMcode type, general multi error code.
3442   */
3443 CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,
3444                                        fd_set *read_fd_set,
3445                                        fd_set *write_fd_set,
3446                                        fd_set *exc_fd_set,
3447                                        int *max_fd);
3448
3449+/*
3450+ * Name:     curl_multi_wait()
3451+ *
3452+ * Desc:     Poll on all fds within a CURLM set as well as any
3453+ *           additional fds passed to the function.
3454+ *
3455+ * Returns:  CURLMcode type, general multi error code.
3456+ */
3457+CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,
3458+                                      struct curl_waitfd extra_fds[],
3459+                                      unsigned int extra_nfds,
3460+                                      int timeout_ms,
3461+                                      int *ret);
3462+
3463  /*
3464   * Name:    curl_multi_perform()
3465   *
3466   * Desc:    When the app thinks there's data available for curl it calls this
3467   *          function to read/write whatever there is right now. This returns
3468   *          as soon as the reads and writes are done. This function does not
3469   *          require that there actually is data available for reading or that
3470   *          data can be written, it can be called just in case. It returns
3471   *          the number of handles that still transfer data in the second
3472   *          argument's integer-pointer.
3473   *
3474   * Returns: CURLMcode type, general multi error code. *NOTE* that this only
3475   *          returns errors etc regarding the whole multi stack. There might
3476-  *          still have occurred problems on invidual transfers even when this
3477-  *          returns OK.
3478+  *          still have occurred problems on individual transfers even when
3479+  *          this returns OK.
3480   */
3481 CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,
3482                                          int *running_handles);
3483
3484  /*
3485   * Name:    curl_multi_cleanup()
3486   *
3487   * Desc:    Cleans up and removes a whole multi stack. It does not free or
3488@@ -176,17 +215,17 @@ CURL_EXTERN CURLMcode curl_multi_cleanup
3489  *          Repeated calls to this function will return a new struct each
3490  *          time, until a special "end of msgs" struct is returned as a signal
3491  *          that there is no more to get at this point.
3492  *
3493  *          The data the returned pointer points to will not survive calling
3494  *          curl_multi_cleanup().
3495  *
3496  *          The 'CURLMsg' struct is meant to be very simple and only contain
3497- *          very basic informations. If more involved information is wanted,
3498+ *          very basic information. If more involved information is wanted,
3499  *          we will provide the particular "transfer handle" in that struct
3500  *          and that should/could/would be used in subsequent
3501  *          curl_easy_getinfo() calls (or similar). The point being that we
3502  *          must never expose complex structs to applications, as then we'll
3503  *          undoubtably get backwards compatibility problems in the future.
3504  *
3505  * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out
3506  *          of structs. It also writes the number of messages left in the
3507@@ -307,16 +346,47 @@ typedef enum {
3508   CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4),
3509
3510   /* This is the argument passed to the timer callback */
3511   CINIT(TIMERDATA, OBJECTPOINT, 5),
3512
3513   /* maximum number of entries in the connection cache */
3514   CINIT(MAXCONNECTS, LONG, 6),
3515
3516+  /* maximum number of (pipelining) connections to one host */
3517+  CINIT(MAX_HOST_CONNECTIONS, LONG, 7),
3518+
3519+  /* maximum number of requests in a pipeline */
3520+  CINIT(MAX_PIPELINE_LENGTH, LONG, 8),
3521+
3522+  /* a connection with a content-length longer than this
3523+     will not be considered for pipelining */
3524+  CINIT(CONTENT_LENGTH_PENALTY_SIZE, OFF_T, 9),
3525+
3526+  /* a connection with a chunk length longer than this
3527+     will not be considered for pipelining */
3528+  CINIT(CHUNK_LENGTH_PENALTY_SIZE, OFF_T, 10),
3529+
3530+  /* a list of site names(+port) that are blacklisted from
3531+     pipelining */
3532+  CINIT(PIPELINING_SITE_BL, OBJECTPOINT, 11),
3533+
3534+  /* a list of server types that are blacklisted from
3535+     pipelining */
3536+  CINIT(PIPELINING_SERVER_BL, OBJECTPOINT, 12),
3537+
3538+  /* maximum number of open connections in total */
3539+  CINIT(MAX_TOTAL_CONNECTIONS, LONG, 13),
3540+
3541+   /* This is the server push callback function pointer */
3542+  CINIT(PUSHFUNCTION, FUNCTIONPOINT, 14),
3543+
3544+  /* This is the argument passed to the server push callback */
3545+  CINIT(PUSHDATA, OBJECTPOINT, 15),
3546+
3547   CURLMOPT_LASTENTRY /* the last unused */
3548 } CURLMoption;
3549
3550
3551 /*
3552  * Name:    curl_multi_setopt()
3553  *
3554  * Desc:    Sets options for the multi handle.
3555@@ -334,13 +404,38 @@ CURL_EXTERN CURLMcode curl_multi_setopt(
3556  *          given socket and a private pointer of the application. This is
3557  *          (only) useful for curl_multi_socket uses.
3558  *
3559  * Returns: CURLM error code.
3560  */
3561 CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,
3562                                         curl_socket_t sockfd, void *sockp);
3563
3564+
3565+/*
3566+ * Name: curl_push_callback
3567+ *
3568+ * Desc: This callback gets called when a new stream is being pushed by the
3569+ *       server. It approves or denies the new stream.
3570+ *
3571+ * Returns: CURL_PUSH_OK or CURL_PUSH_DENY.
3572+ */
3573+#define CURL_PUSH_OK   0
3574+#define CURL_PUSH_DENY 1
3575+
3576+struct curl_pushheaders;  /* forward declaration only */
3577+
3578+CURL_EXTERN char *curl_pushheader_bynum(struct curl_pushheaders *h,
3579+                                        size_t num);
3580+CURL_EXTERN char *curl_pushheader_byname(struct curl_pushheaders *h,
3581+                                         const char *name);
3582+
3583+typedef int (*curl_push_callback)(CURL *parent,
3584+                                  CURL *easy,
3585+                                  size_t num_headers,
3586+                                  struct curl_pushheaders *headers,
3587+                                  void *userp);
3588+
3589 #ifdef __cplusplus
3590 } /* end of extern "C" */
3591 #endif
3592
3593 #endif
3594diff --git a/src/third_party/curl/stdcheaders.h b/src/third_party/curl/stdcheaders.h
3595deleted file mode 100644
3596--- a/src/third_party/curl/stdcheaders.h
3597+++ /dev/null
3598@@ -1,34 +0,0 @@
3599-#ifndef __STDC_HEADERS_H
3600-#define __STDC_HEADERS_H
3601-/***************************************************************************
3602- *                                  _   _ ____  _
3603- *  Project                     ___| | | |  _ \| |
3604- *                             / __| | | | |_) | |
3605- *                            | (__| |_| |  _ <| |___
3606- *                             \___|\___/|_| \_\_____|
3607- *
3608- * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
3609- *
3610- * This software is licensed as described in the file COPYING, which
3611- * you should have received as part of this distribution. The terms
3612- * are also available at http://curl.haxx.se/docs/copyright.html.
3613- *
3614- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
3615- * copies of the Software, and permit persons to whom the Software is
3616- * furnished to do so, under the terms of the COPYING file.
3617- *
3618- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
3619- * KIND, either express or implied.
3620- *
3621- * $Id: stdcheaders.h,v 1.9 2009-05-18 12:25:45 yangtse Exp $
3622- ***************************************************************************/
3623-
3624-#include <sys/types.h>
3625-
3626-size_t fread (void *, size_t, size_t, FILE *);
3627-size_t fwrite (const void *, size_t, size_t, FILE *);
3628-
3629-int strcasecmp(const char *, const char *);
3630-int strncasecmp(const char *, const char *, size_t);
3631-
3632-#endif
3633diff --git a/src/third_party/curl/system.h b/src/third_party/curl/system.h
3634new file mode 100644
3635--- /dev/null
3636+++ b/src/third_party/curl/system.h
3637@@ -0,0 +1,493 @@
3638+#ifndef __CURL_SYSTEM_H
3639+#define __CURL_SYSTEM_H
3640+/***************************************************************************
3641+ *                                  _   _ ____  _
3642+ *  Project                     ___| | | |  _ \| |
3643+ *                             / __| | | | |_) | |
3644+ *                            | (__| |_| |  _ <| |___
3645+ *                             \___|\___/|_| \_\_____|
3646+ *
3647+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
3648+ *
3649+ * This software is licensed as described in the file COPYING, which
3650+ * you should have received as part of this distribution. The terms
3651+ * are also available at https://curl.haxx.se/docs/copyright.html.
3652+ *
3653+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
3654+ * copies of the Software, and permit persons to whom the Software is
3655+ * furnished to do so, under the terms of the COPYING file.
3656+ *
3657+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
3658+ * KIND, either express or implied.
3659+ *
3660+ ***************************************************************************/
3661+
3662+/*
3663+ * Try to keep one section per platform, compiler and architecture, otherwise,
3664+ * if an existing section is reused for a different one and later on the
3665+ * original is adjusted, probably the piggybacking one can be adversely
3666+ * changed.
3667+ *
3668+ * In order to differentiate between platforms/compilers/architectures use
3669+ * only compiler built in predefined preprocessor symbols.
3670+ *
3671+ * curl_off_t
3672+ * ----------
3673+ *
3674+ * For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit
3675+ * wide signed integral data type. The width of this data type must remain
3676+ * constant and independent of any possible large file support settings.
3677+ *
3678+ * As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit
3679+ * wide signed integral data type if there is no 64-bit type.
3680+ *
3681+ * As a general rule, curl_off_t shall not be mapped to off_t. This rule shall
3682+ * only be violated if off_t is the only 64-bit data type available and the
3683+ * size of off_t is independent of large file support settings. Keep your
3684+ * build on the safe side avoiding an off_t gating.  If you have a 64-bit
3685+ * off_t then take for sure that another 64-bit data type exists, dig deeper
3686+ * and you will find it.
3687+ *
3688+ */
3689+
3690+#if defined(__DJGPP__) || defined(__GO32__)
3691+#  if defined(__DJGPP__) && (__DJGPP__ > 1)
3692+#    define CURL_TYPEOF_CURL_OFF_T     long long
3693+#    define CURL_FORMAT_CURL_OFF_T     "lld"
3694+#    define CURL_FORMAT_CURL_OFF_TU    "llu"
3695+#    define CURL_SUFFIX_CURL_OFF_T     LL
3696+#    define CURL_SUFFIX_CURL_OFF_TU    ULL
3697+#  else
3698+#    define CURL_TYPEOF_CURL_OFF_T     long
3699+#    define CURL_FORMAT_CURL_OFF_T     "ld"
3700+#    define CURL_FORMAT_CURL_OFF_TU    "lu"
3701+#    define CURL_SUFFIX_CURL_OFF_T     L
3702+#    define CURL_SUFFIX_CURL_OFF_TU    UL
3703+#  endif
3704+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
3705+
3706+#elif defined(__SALFORDC__)
3707+#  define CURL_TYPEOF_CURL_OFF_T     long
3708+#  define CURL_FORMAT_CURL_OFF_T     "ld"
3709+#  define CURL_FORMAT_CURL_OFF_TU    "lu"
3710+#  define CURL_SUFFIX_CURL_OFF_T     L
3711+#  define CURL_SUFFIX_CURL_OFF_TU    UL
3712+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
3713+
3714+#elif defined(__BORLANDC__)
3715+#  if (__BORLANDC__ < 0x520)
3716+#    define CURL_TYPEOF_CURL_OFF_T     long
3717+#    define CURL_FORMAT_CURL_OFF_T     "ld"
3718+#    define CURL_FORMAT_CURL_OFF_TU    "lu"
3719+#    define CURL_SUFFIX_CURL_OFF_T     L
3720+#    define CURL_SUFFIX_CURL_OFF_TU    UL
3721+#  else
3722+#    define CURL_TYPEOF_CURL_OFF_T     __int64
3723+#    define CURL_FORMAT_CURL_OFF_T     "I64d"
3724+#    define CURL_FORMAT_CURL_OFF_TU    "I64u"
3725+#    define CURL_SUFFIX_CURL_OFF_T     i64
3726+#    define CURL_SUFFIX_CURL_OFF_TU    ui64
3727+#  endif
3728+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
3729+
3730+#elif defined(__TURBOC__)
3731+#  define CURL_TYPEOF_CURL_OFF_T     long
3732+#  define CURL_FORMAT_CURL_OFF_T     "ld"
3733+#  define CURL_FORMAT_CURL_OFF_TU    "lu"
3734+#  define CURL_SUFFIX_CURL_OFF_T     L
3735+#  define CURL_SUFFIX_CURL_OFF_TU    UL
3736+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
3737+
3738+#elif defined(__WATCOMC__)
3739+#  if defined(__386__)
3740+#    define CURL_TYPEOF_CURL_OFF_T     __int64
3741+#    define CURL_FORMAT_CURL_OFF_T     "I64d"
3742+#    define CURL_FORMAT_CURL_OFF_TU    "I64u"
3743+#    define CURL_SUFFIX_CURL_OFF_T     i64
3744+#    define CURL_SUFFIX_CURL_OFF_TU    ui64
3745+#  else
3746+#    define CURL_TYPEOF_CURL_OFF_T     long
3747+#    define CURL_FORMAT_CURL_OFF_T     "ld"
3748+#    define CURL_FORMAT_CURL_OFF_TU    "lu"
3749+#    define CURL_SUFFIX_CURL_OFF_T     L
3750+#    define CURL_SUFFIX_CURL_OFF_TU    UL
3751+#  endif
3752+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
3753+
3754+#elif defined(__POCC__)
3755+#  if (__POCC__ < 280)
3756+#    define CURL_TYPEOF_CURL_OFF_T     long
3757+#    define CURL_FORMAT_CURL_OFF_T     "ld"
3758+#    define CURL_FORMAT_CURL_OFF_TU    "lu"
3759+#    define CURL_SUFFIX_CURL_OFF_T     L
3760+#    define CURL_SUFFIX_CURL_OFF_TU    UL
3761+#  elif defined(_MSC_VER)
3762+#    define CURL_TYPEOF_CURL_OFF_T     __int64
3763+#    define CURL_FORMAT_CURL_OFF_T     "I64d"
3764+#    define CURL_FORMAT_CURL_OFF_TU    "I64u"
3765+#    define CURL_SUFFIX_CURL_OFF_T     i64
3766+#    define CURL_SUFFIX_CURL_OFF_TU    ui64
3767+#  else
3768+#    define CURL_TYPEOF_CURL_OFF_T     long long
3769+#    define CURL_FORMAT_CURL_OFF_T     "lld"
3770+#    define CURL_FORMAT_CURL_OFF_TU    "llu"
3771+#    define CURL_SUFFIX_CURL_OFF_T     LL
3772+#    define CURL_SUFFIX_CURL_OFF_TU    ULL
3773+#  endif
3774+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
3775+
3776+#elif defined(__LCC__)
3777+#  define CURL_TYPEOF_CURL_OFF_T     long
3778+#  define CURL_FORMAT_CURL_OFF_T     "ld"
3779+#  define CURL_FORMAT_CURL_OFF_TU    "lu"
3780+#  define CURL_SUFFIX_CURL_OFF_T     L
3781+#  define CURL_SUFFIX_CURL_OFF_TU    UL
3782+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
3783+
3784+#elif defined(__SYMBIAN32__)
3785+#  if defined(__EABI__)  /* Treat all ARM compilers equally */
3786+#    define CURL_TYPEOF_CURL_OFF_T     long long
3787+#    define CURL_FORMAT_CURL_OFF_T     "lld"
3788+#    define CURL_FORMAT_CURL_OFF_TU    "llu"
3789+#    define CURL_SUFFIX_CURL_OFF_T     LL
3790+#    define CURL_SUFFIX_CURL_OFF_TU    ULL
3791+#  elif defined(__CW32__)
3792+#    pragma longlong on
3793+#    define CURL_TYPEOF_CURL_OFF_T     long long
3794+#    define CURL_FORMAT_CURL_OFF_T     "lld"
3795+#    define CURL_FORMAT_CURL_OFF_TU    "llu"
3796+#    define CURL_SUFFIX_CURL_OFF_T     LL
3797+#    define CURL_SUFFIX_CURL_OFF_TU    ULL
3798+#  elif defined(__VC32__)
3799+#    define CURL_TYPEOF_CURL_OFF_T     __int64
3800+#    define CURL_FORMAT_CURL_OFF_T     "lld"
3801+#    define CURL_FORMAT_CURL_OFF_TU    "llu"
3802+#    define CURL_SUFFIX_CURL_OFF_T     LL
3803+#    define CURL_SUFFIX_CURL_OFF_TU    ULL
3804+#  endif
3805+#  define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
3806+
3807+#elif defined(__MWERKS__)
3808+#  define CURL_TYPEOF_CURL_OFF_T     long long
3809+#  define CURL_FORMAT_CURL_OFF_T     "lld"
3810+#  define CURL_FORMAT_CURL_OFF_TU    "llu"
3811+#  define CURL_SUFFIX_CURL_OFF_T     LL
3812+#  define CURL_SUFFIX_CURL_OFF_TU    ULL
3813+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
3814+
3815+#elif defined(_WIN32_WCE)
3816+#  define CURL_TYPEOF_CURL_OFF_T     __int64
3817+#  define CURL_FORMAT_CURL_OFF_T     "I64d"
3818+#  define CURL_FORMAT_CURL_OFF_TU    "I64u"
3819+#  define CURL_SUFFIX_CURL_OFF_T     i64
3820+#  define CURL_SUFFIX_CURL_OFF_TU    ui64
3821+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
3822+
3823+#elif defined(__MINGW32__)
3824+#  define CURL_TYPEOF_CURL_OFF_T     long long
3825+#  define CURL_FORMAT_CURL_OFF_T     "I64d"
3826+#  define CURL_FORMAT_CURL_OFF_TU    "I64u"
3827+#  define CURL_SUFFIX_CURL_OFF_T     LL
3828+#  define CURL_SUFFIX_CURL_OFF_TU    ULL
3829+#  define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
3830+#  define CURL_PULL_SYS_TYPES_H      1
3831+#  define CURL_PULL_WS2TCPIP_H       1
3832+
3833+#elif defined(__VMS)
3834+#  if defined(__VAX)
3835+#    define CURL_TYPEOF_CURL_OFF_T     long
3836+#    define CURL_FORMAT_CURL_OFF_T     "ld"
3837+#    define CURL_FORMAT_CURL_OFF_TU    "lu"
3838+#    define CURL_SUFFIX_CURL_OFF_T     L
3839+#    define CURL_SUFFIX_CURL_OFF_TU    UL
3840+#  else
3841+#    define CURL_TYPEOF_CURL_OFF_T     long long
3842+#    define CURL_FORMAT_CURL_OFF_T     "lld"
3843+#    define CURL_FORMAT_CURL_OFF_TU    "llu"
3844+#    define CURL_SUFFIX_CURL_OFF_T     LL
3845+#    define CURL_SUFFIX_CURL_OFF_TU    ULL
3846+#  endif
3847+#  define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
3848+
3849+#elif defined(__OS400__)
3850+#  if defined(__ILEC400__)
3851+#    define CURL_TYPEOF_CURL_OFF_T     long long
3852+#    define CURL_FORMAT_CURL_OFF_T     "lld"
3853+#    define CURL_FORMAT_CURL_OFF_TU    "llu"
3854+#    define CURL_SUFFIX_CURL_OFF_T     LL
3855+#    define CURL_SUFFIX_CURL_OFF_TU    ULL
3856+#    define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
3857+#    define CURL_PULL_SYS_TYPES_H      1
3858+#    define CURL_PULL_SYS_SOCKET_H     1
3859+#  endif
3860+
3861+#elif defined(__MVS__)
3862+#  if defined(__IBMC__) || defined(__IBMCPP__)
3863+#    if defined(_ILP32)
3864+#    elif defined(_LP64)
3865+#    endif
3866+#    if defined(_LONG_LONG)
3867+#      define CURL_TYPEOF_CURL_OFF_T     long long
3868+#      define CURL_FORMAT_CURL_OFF_T     "lld"
3869+#      define CURL_FORMAT_CURL_OFF_TU    "llu"
3870+#      define CURL_SUFFIX_CURL_OFF_T     LL
3871+#      define CURL_SUFFIX_CURL_OFF_TU    ULL
3872+#    elif defined(_LP64)
3873+#      define CURL_TYPEOF_CURL_OFF_T     long
3874+#      define CURL_FORMAT_CURL_OFF_T     "ld"
3875+#      define CURL_FORMAT_CURL_OFF_TU    "lu"
3876+#      define CURL_SUFFIX_CURL_OFF_T     L
3877+#      define CURL_SUFFIX_CURL_OFF_TU    UL
3878+#    else
3879+#      define CURL_TYPEOF_CURL_OFF_T     long
3880+#      define CURL_FORMAT_CURL_OFF_T     "ld"
3881+#      define CURL_FORMAT_CURL_OFF_TU    "lu"
3882+#      define CURL_SUFFIX_CURL_OFF_T     L
3883+#      define CURL_SUFFIX_CURL_OFF_TU    UL
3884+#    endif
3885+#    define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
3886+#    define CURL_PULL_SYS_TYPES_H      1
3887+#    define CURL_PULL_SYS_SOCKET_H     1
3888+#  endif
3889+
3890+#elif defined(__370__)
3891+#  if defined(__IBMC__) || defined(__IBMCPP__)
3892+#    if defined(_ILP32)
3893+#    elif defined(_LP64)
3894+#    endif
3895+#    if defined(_LONG_LONG)
3896+#      define CURL_TYPEOF_CURL_OFF_T     long long
3897+#      define CURL_FORMAT_CURL_OFF_T     "lld"
3898+#      define CURL_FORMAT_CURL_OFF_TU    "llu"
3899+#      define CURL_SUFFIX_CURL_OFF_T     LL
3900+#      define CURL_SUFFIX_CURL_OFF_TU    ULL
3901+#    elif defined(_LP64)
3902+#      define CURL_TYPEOF_CURL_OFF_T     long
3903+#      define CURL_FORMAT_CURL_OFF_T     "ld"
3904+#      define CURL_FORMAT_CURL_OFF_TU    "lu"
3905+#      define CURL_SUFFIX_CURL_OFF_T     L
3906+#      define CURL_SUFFIX_CURL_OFF_TU    UL
3907+#    else
3908+#      define CURL_TYPEOF_CURL_OFF_T     long
3909+#      define CURL_FORMAT_CURL_OFF_T     "ld"
3910+#      define CURL_FORMAT_CURL_OFF_TU    "lu"
3911+#      define CURL_SUFFIX_CURL_OFF_T     L
3912+#      define CURL_SUFFIX_CURL_OFF_TU    UL
3913+#    endif
3914+#    define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
3915+#    define CURL_PULL_SYS_TYPES_H      1
3916+#    define CURL_PULL_SYS_SOCKET_H     1
3917+#  endif
3918+
3919+#elif defined(TPF)
3920+#  define CURL_TYPEOF_CURL_OFF_T     long
3921+#  define CURL_FORMAT_CURL_OFF_T     "ld"
3922+#  define CURL_FORMAT_CURL_OFF_TU    "lu"
3923+#  define CURL_SUFFIX_CURL_OFF_T     L
3924+#  define CURL_SUFFIX_CURL_OFF_TU    UL
3925+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
3926+
3927+#elif defined(__TINYC__) /* also known as tcc */
3928+
3929+#  define CURL_TYPEOF_CURL_OFF_T     long long
3930+#  define CURL_FORMAT_CURL_OFF_T     "lld"
3931+#  define CURL_FORMAT_CURL_OFF_TU    "llu"
3932+#  define CURL_SUFFIX_CURL_OFF_T     LL
3933+#  define CURL_SUFFIX_CURL_OFF_TU    ULL
3934+#  define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
3935+#  define CURL_PULL_SYS_TYPES_H      1
3936+#  define CURL_PULL_SYS_SOCKET_H     1
3937+
3938+#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* Oracle Solaris Studio */
3939+#  if !defined(__LP64) && (defined(__ILP32) ||                          \
3940+                           defined(__i386) ||                           \
3941+                           defined(__sparcv8) ||                        \
3942+                           defined(__sparcv8plus))
3943+#    define CURL_TYPEOF_CURL_OFF_T     long long
3944+#    define CURL_FORMAT_CURL_OFF_T     "lld"
3945+#    define CURL_FORMAT_CURL_OFF_TU    "llu"
3946+#    define CURL_SUFFIX_CURL_OFF_T     LL
3947+#    define CURL_SUFFIX_CURL_OFF_TU    ULL
3948+#  elif defined(__LP64) || \
3949+        defined(__amd64) || defined(__sparcv9)
3950+#    define CURL_TYPEOF_CURL_OFF_T     long
3951+#    define CURL_FORMAT_CURL_OFF_T     "ld"
3952+#    define CURL_FORMAT_CURL_OFF_TU    "lu"
3953+#    define CURL_SUFFIX_CURL_OFF_T     L
3954+#    define CURL_SUFFIX_CURL_OFF_TU    UL
3955+#  endif
3956+#  define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
3957+#  define CURL_PULL_SYS_TYPES_H      1
3958+#  define CURL_PULL_SYS_SOCKET_H     1
3959+
3960+#elif defined(__xlc__) /* IBM xlc compiler */
3961+#  if !defined(_LP64)
3962+#    define CURL_TYPEOF_CURL_OFF_T     long long
3963+#    define CURL_FORMAT_CURL_OFF_T     "lld"
3964+#    define CURL_FORMAT_CURL_OFF_TU    "llu"
3965+#    define CURL_SUFFIX_CURL_OFF_T     LL
3966+#    define CURL_SUFFIX_CURL_OFF_TU    ULL
3967+#  else
3968+#    define CURL_TYPEOF_CURL_OFF_T     long
3969+#    define CURL_FORMAT_CURL_OFF_T     "ld"
3970+#    define CURL_FORMAT_CURL_OFF_TU    "lu"
3971+#    define CURL_SUFFIX_CURL_OFF_T     L
3972+#    define CURL_SUFFIX_CURL_OFF_TU    UL
3973+#  endif
3974+#  define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
3975+#  define CURL_PULL_SYS_TYPES_H      1
3976+#  define CURL_PULL_SYS_SOCKET_H     1
3977+
3978+/* ===================================== */
3979+/*    KEEP MSVC THE PENULTIMATE ENTRY    */
3980+/* ===================================== */
3981+
3982+#elif defined(_MSC_VER)
3983+#  if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)
3984+#    define CURL_TYPEOF_CURL_OFF_T     __int64
3985+#    define CURL_FORMAT_CURL_OFF_T     "I64d"
3986+#    define CURL_FORMAT_CURL_OFF_TU    "I64u"
3987+#    define CURL_SUFFIX_CURL_OFF_T     i64
3988+#    define CURL_SUFFIX_CURL_OFF_TU    ui64
3989+#  else
3990+#    define CURL_TYPEOF_CURL_OFF_T     long
3991+#    define CURL_FORMAT_CURL_OFF_T     "ld"
3992+#    define CURL_FORMAT_CURL_OFF_TU    "lu"
3993+#    define CURL_SUFFIX_CURL_OFF_T     L
3994+#    define CURL_SUFFIX_CURL_OFF_TU    UL
3995+#  endif
3996+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
3997+
3998+/* ===================================== */
3999+/*    KEEP GENERIC GCC THE LAST ENTRY    */
4000+/* ===================================== */
4001+
4002+#elif defined(__GNUC__) && !defined(_SCO_DS)
4003+#  if !defined(__LP64__) &&                                             \
4004+  (defined(__ILP32__) || defined(__i386__) || defined(__hppa__) ||      \
4005+   defined(__ppc__) || defined(__powerpc__) || defined(__arm__) ||      \
4006+   defined(__sparc__) || defined(__mips__) || defined(__sh__) ||        \
4007+   defined(__XTENSA__) ||                                               \
4008+   (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 4)  ||               \
4009+   (defined(__LONG_MAX__) && __LONG_MAX__ == 2147483647L))
4010+#    define CURL_TYPEOF_CURL_OFF_T     long long
4011+#    define CURL_FORMAT_CURL_OFF_T     "lld"
4012+#    define CURL_FORMAT_CURL_OFF_TU    "llu"
4013+#    define CURL_SUFFIX_CURL_OFF_T     LL
4014+#    define CURL_SUFFIX_CURL_OFF_TU    ULL
4015+#  elif defined(__LP64__) || \
4016+        defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \
4017+        (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) || \
4018+        (defined(__LONG_MAX__) && __LONG_MAX__ == 9223372036854775807L)
4019+#    define CURL_TYPEOF_CURL_OFF_T     long
4020+#    define CURL_FORMAT_CURL_OFF_T     "ld"
4021+#    define CURL_FORMAT_CURL_OFF_TU    "lu"
4022+#    define CURL_SUFFIX_CURL_OFF_T     L
4023+#    define CURL_SUFFIX_CURL_OFF_TU    UL
4024+#  endif
4025+#  define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
4026+#  define CURL_PULL_SYS_TYPES_H      1
4027+#  define CURL_PULL_SYS_SOCKET_H     1
4028+
4029+#else
4030+/* generic "safe guess" on old 32 bit style */
4031+# define CURL_TYPEOF_CURL_OFF_T     long
4032+# define CURL_FORMAT_CURL_OFF_T     "ld"
4033+# define CURL_FORMAT_CURL_OFF_TU    "lu"
4034+# define CURL_SUFFIX_CURL_OFF_T     L
4035+# define CURL_SUFFIX_CURL_OFF_TU    UL
4036+# define CURL_TYPEOF_CURL_SOCKLEN_T int
4037+#endif
4038+
4039+#ifdef _AIX
4040+/* AIX needs <sys/poll.h> */
4041+#define CURL_PULL_SYS_POLL_H
4042+#endif
4043+
4044+
4045+/* CURL_PULL_WS2TCPIP_H is defined above when inclusion of header file  */
4046+/* ws2tcpip.h is required here to properly make type definitions below. */
4047+#ifdef CURL_PULL_WS2TCPIP_H
4048+#  include <winsock2.h>
4049+#  include <windows.h>
4050+#  include <ws2tcpip.h>
4051+#endif
4052+
4053+/* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file  */
4054+/* sys/types.h is required here to properly make type definitions below. */
4055+#ifdef CURL_PULL_SYS_TYPES_H
4056+#  include <sys/types.h>
4057+#endif
4058+
4059+/* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file  */
4060+/* sys/socket.h is required here to properly make type definitions below. */
4061+#ifdef CURL_PULL_SYS_SOCKET_H
4062+#  include <sys/socket.h>
4063+#endif
4064+
4065+/* CURL_PULL_SYS_POLL_H is defined above when inclusion of header file    */
4066+/* sys/poll.h is required here to properly make type definitions below.   */
4067+#ifdef CURL_PULL_SYS_POLL_H
4068+#  include <sys/poll.h>
4069+#endif
4070+
4071+/* Data type definition of curl_socklen_t. */
4072+#ifdef CURL_TYPEOF_CURL_SOCKLEN_T
4073+  typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
4074+#endif
4075+
4076+/* Data type definition of curl_off_t. */
4077+
4078+#ifdef CURL_TYPEOF_CURL_OFF_T
4079+  typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
4080+#endif
4081+
4082+/*
4083+ * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
4084+ * these to be visible and exported by the external libcurl interface API,
4085+ * while also making them visible to the library internals, simply including
4086+ * curl_setup.h, without actually needing to include curl.h internally.
4087+ * If some day this section would grow big enough, all this should be moved
4088+ * to its own header file.
4089+ */
4090+
4091+/*
4092+ * Figure out if we can use the ## preprocessor operator, which is supported
4093+ * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
4094+ * or  __cplusplus so we need to carefully check for them too.
4095+ */
4096+
4097+#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
4098+  defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
4099+  defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
4100+  defined(__ILEC400__)
4101+  /* This compiler is believed to have an ISO compatible preprocessor */
4102+#define CURL_ISOCPP
4103+#else
4104+  /* This compiler is believed NOT to have an ISO compatible preprocessor */
4105+#undef CURL_ISOCPP
4106+#endif
4107+
4108+/*
4109+ * Macros for minimum-width signed and unsigned curl_off_t integer constants.
4110+ */
4111+
4112+#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)
4113+#  define __CURL_OFF_T_C_HLPR2(x) x
4114+#  define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x)
4115+#  define CURL_OFF_T_C(Val)  __CURL_OFF_T_C_HLPR1(Val) ## \
4116+                             __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)
4117+#  define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
4118+                             __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)
4119+#else
4120+#  ifdef CURL_ISOCPP
4121+#    define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix
4122+#  else
4123+#    define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix
4124+#  endif
4125+#  define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix)
4126+#  define CURL_OFF_T_C(Val)  __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)
4127+#  define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)
4128+#endif
4129+
4130+#endif /* __CURL_SYSTEM_H */
4131diff --git a/src/third_party/curl/typecheck-gcc.h b/src/third_party/curl/typecheck-gcc.h
4132--- a/src/third_party/curl/typecheck-gcc.h
4133+++ b/src/third_party/curl/typecheck-gcc.h
4134@@ -2,111 +2,151 @@
4135 #define __CURL_TYPECHECK_GCC_H
4136 /***************************************************************************
4137  *                                  _   _ ____  _
4138  *  Project                     ___| | | |  _ \| |
4139  *                             / __| | | | |_) | |
4140  *                            | (__| |_| |  _ <| |___
4141  *                             \___|\___/|_| \_\_____|
4142  *
4143- * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
4144+ * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
4145  *
4146  * This software is licensed as described in the file COPYING, which
4147  * you should have received as part of this distribution. The terms
4148- * are also available at http://curl.haxx.se/docs/copyright.html.
4149+ * are also available at https://curl.haxx.se/docs/copyright.html.
4150  *
4151  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
4152  * copies of the Software, and permit persons to whom the Software is
4153  * furnished to do so, under the terms of the COPYING file.
4154  *
4155  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
4156  * KIND, either express or implied.
4157  *
4158- * $Id: typecheck-gcc.h,v 1.9 2009-01-25 23:26:31 bagder Exp $
4159  ***************************************************************************/
4160
4161 /* wraps curl_easy_setopt() with typechecking */
4162
4163 /* To add a new kind of warning, add an
4164- *   if(_curl_is_sometype_option(_curl_opt) && ! _curl_is_sometype(value))
4165- *     _curl_easy_setopt_err_sometype();
4166+ *   if(_curl_is_sometype_option(_curl_opt))
4167+ *     if(!_curl_is_sometype(value))
4168+ *       _curl_easy_setopt_err_sometype();
4169  * block and define _curl_is_sometype_option, _curl_is_sometype and
4170  * _curl_easy_setopt_err_sometype below
4171  *
4172+ * NOTE: We use two nested 'if' statements here instead of the && operator, in
4173+ *       order to work around gcc bug #32061.  It affects only gcc 4.3.x/4.4.x
4174+ *       when compiling with -Wlogical-op.
4175+ *
4176  * To add an option that uses the same type as an existing option, you'll just
4177  * need to extend the appropriate _curl_*_option macro
4178  */
4179 #define curl_easy_setopt(handle, option, value)                               \
4180 __extension__ ({                                                              \
4181-  __typeof__ (option) _curl_opt = option;                                     \
4182-  if (__builtin_constant_p(_curl_opt)) {                                      \
4183-    if (_curl_is_long_option(_curl_opt) && !_curl_is_long(value))             \
4184-      _curl_easy_setopt_err_long();                                           \
4185-    if (_curl_is_off_t_option(_curl_opt) && !_curl_is_off_t(value))           \
4186-      _curl_easy_setopt_err_curl_off_t();                                     \
4187-    if (_curl_is_string_option(_curl_opt) && !_curl_is_string(value))         \
4188-      _curl_easy_setopt_err_string();                                         \
4189-    if (_curl_is_write_cb_option(_curl_opt) && !_curl_is_write_cb(value))     \
4190-      _curl_easy_setopt_err_write_callback();                                 \
4191-    if ((_curl_opt) == CURLOPT_READFUNCTION && !_curl_is_read_cb(value))      \
4192-      _curl_easy_setopt_err_read_cb();                                        \
4193-    if ((_curl_opt) == CURLOPT_IOCTLFUNCTION && !_curl_is_ioctl_cb(value))    \
4194-      _curl_easy_setopt_err_ioctl_cb();                                       \
4195-    if ((_curl_opt) == CURLOPT_SOCKOPTFUNCTION && !_curl_is_sockopt_cb(value))\
4196-      _curl_easy_setopt_err_sockopt_cb();                                     \
4197-    if ((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION &&                          \
4198-            !_curl_is_opensocket_cb(value))                                   \
4199-      _curl_easy_setopt_err_opensocket_cb();                                  \
4200-    if ((_curl_opt) == CURLOPT_PROGRESSFUNCTION &&                            \
4201-            !_curl_is_progress_cb(value))                                     \
4202-      _curl_easy_setopt_err_progress_cb();                                    \
4203-    if ((_curl_opt) == CURLOPT_DEBUGFUNCTION && !_curl_is_debug_cb(value))    \
4204-      _curl_easy_setopt_err_debug_cb();                                       \
4205-    if ((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION &&                            \
4206-            !_curl_is_ssl_ctx_cb(value))                                      \
4207-      _curl_easy_setopt_err_ssl_ctx_cb();                                     \
4208-    if (_curl_is_conv_cb_option(_curl_opt) && !_curl_is_conv_cb(value))       \
4209-      _curl_easy_setopt_err_conv_cb();                                        \
4210-    if ((_curl_opt) == CURLOPT_SEEKFUNCTION && !_curl_is_seek_cb(value))      \
4211-      _curl_easy_setopt_err_seek_cb();                                        \
4212-    if (_curl_is_cb_data_option(_curl_opt) && !_curl_is_cb_data(value))       \
4213-      _curl_easy_setopt_err_cb_data();                                        \
4214-    if ((_curl_opt) == CURLOPT_ERRORBUFFER && !_curl_is_error_buffer(value))  \
4215-      _curl_easy_setopt_err_error_buffer();                                   \
4216-    if ((_curl_opt) == CURLOPT_STDERR && !_curl_is_FILE(value))               \
4217-      _curl_easy_setopt_err_FILE();                                           \
4218-    if (_curl_is_postfields_option(_curl_opt) && !_curl_is_postfields(value)) \
4219-      _curl_easy_setopt_err_postfields();                                     \
4220-    if ((_curl_opt) == CURLOPT_HTTPPOST &&                                    \
4221-            !_curl_is_arr((value), struct curl_httppost))                     \
4222-      _curl_easy_setopt_err_curl_httpost();                                   \
4223-    if (_curl_is_slist_option(_curl_opt) &&                                   \
4224-            !_curl_is_arr((value), struct curl_slist))                        \
4225-      _curl_easy_setopt_err_curl_slist();                                     \
4226-    if ((_curl_opt) == CURLOPT_SHARE && !_curl_is_ptr((value), CURLSH))       \
4227-      _curl_easy_setopt_err_CURLSH();                                         \
4228+  __typeof__(option) _curl_opt = option;                                     \
4229+  if(__builtin_constant_p(_curl_opt)) {                                       \
4230+    if(_curl_is_long_option(_curl_opt))                                       \
4231+      if(!_curl_is_long(value))                                               \
4232+        _curl_easy_setopt_err_long();                                         \
4233+    if(_curl_is_off_t_option(_curl_opt))                                      \
4234+      if(!_curl_is_off_t(value))                                              \
4235+        _curl_easy_setopt_err_curl_off_t();                                   \
4236+    if(_curl_is_string_option(_curl_opt))                                     \
4237+      if(!_curl_is_string(value))                                             \
4238+        _curl_easy_setopt_err_string();                                       \
4239+    if(_curl_is_write_cb_option(_curl_opt))                                   \
4240+      if(!_curl_is_write_cb(value))                                           \
4241+        _curl_easy_setopt_err_write_callback();                               \
4242+    if((_curl_opt) == CURLOPT_RESOLVER_START_FUNCTION)                        \
4243+      if(!_curl_is_resolver_start_callback(value))                            \
4244+        _curl_easy_setopt_err_resolver_start_callback();                      \
4245+    if((_curl_opt) == CURLOPT_READFUNCTION)                                   \
4246+      if(!_curl_is_read_cb(value))                                            \
4247+        _curl_easy_setopt_err_read_cb();                                      \
4248+    if((_curl_opt) == CURLOPT_IOCTLFUNCTION)                                  \
4249+      if(!_curl_is_ioctl_cb(value))                                           \
4250+        _curl_easy_setopt_err_ioctl_cb();                                     \
4251+    if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION)                                \
4252+      if(!_curl_is_sockopt_cb(value))                                         \
4253+        _curl_easy_setopt_err_sockopt_cb();                                   \
4254+    if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION)                             \
4255+      if(!_curl_is_opensocket_cb(value))                                      \
4256+        _curl_easy_setopt_err_opensocket_cb();                                \
4257+    if((_curl_opt) == CURLOPT_PROGRESSFUNCTION)                               \
4258+      if(!_curl_is_progress_cb(value))                                        \
4259+        _curl_easy_setopt_err_progress_cb();                                  \
4260+    if((_curl_opt) == CURLOPT_DEBUGFUNCTION)                                  \
4261+      if(!_curl_is_debug_cb(value))                                           \
4262+        _curl_easy_setopt_err_debug_cb();                                     \
4263+    if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION)                               \
4264+      if(!_curl_is_ssl_ctx_cb(value))                                         \
4265+        _curl_easy_setopt_err_ssl_ctx_cb();                                   \
4266+    if(_curl_is_conv_cb_option(_curl_opt))                                    \
4267+      if(!_curl_is_conv_cb(value))                                            \
4268+        _curl_easy_setopt_err_conv_cb();                                      \
4269+    if((_curl_opt) == CURLOPT_SEEKFUNCTION)                                   \
4270+      if(!_curl_is_seek_cb(value))                                            \
4271+        _curl_easy_setopt_err_seek_cb();                                      \
4272+    if(_curl_is_cb_data_option(_curl_opt))                                    \
4273+      if(!_curl_is_cb_data(value))                                            \
4274+        _curl_easy_setopt_err_cb_data();                                      \
4275+    if((_curl_opt) == CURLOPT_ERRORBUFFER)                                    \
4276+      if(!_curl_is_error_buffer(value))                                       \
4277+        _curl_easy_setopt_err_error_buffer();                                 \
4278+    if((_curl_opt) == CURLOPT_STDERR)                                         \
4279+      if(!_curl_is_FILE(value))                                               \
4280+        _curl_easy_setopt_err_FILE();                                         \
4281+    if(_curl_is_postfields_option(_curl_opt))                                 \
4282+      if(!_curl_is_postfields(value))                                         \
4283+        _curl_easy_setopt_err_postfields();                                   \
4284+    if((_curl_opt) == CURLOPT_HTTPPOST)                                       \
4285+      if(!_curl_is_arr((value), struct curl_httppost))                        \
4286+        _curl_easy_setopt_err_curl_httpost();                                 \
4287+    if((_curl_opt) == CURLOPT_MIMEPOST)                                       \
4288+      if(!_curl_is_ptr((value), curl_mime))                                   \
4289+        _curl_easy_setopt_err_curl_mimepost();                                \
4290+    if(_curl_is_slist_option(_curl_opt))                                      \
4291+      if(!_curl_is_arr((value), struct curl_slist))                           \
4292+        _curl_easy_setopt_err_curl_slist();                                   \
4293+    if((_curl_opt) == CURLOPT_SHARE)                                          \
4294+      if(!_curl_is_ptr((value), CURLSH))                                      \
4295+        _curl_easy_setopt_err_CURLSH();                                       \
4296   }                                                                           \
4297   curl_easy_setopt(handle, _curl_opt, value);                                 \
4298 })
4299
4300 /* wraps curl_easy_getinfo() with typechecking */
4301 /* FIXME: don't allow const pointers */
4302 #define curl_easy_getinfo(handle, info, arg)                                  \
4303 __extension__ ({                                                              \
4304-  __typeof__ (info) _curl_info = info;                                        \
4305-  if (__builtin_constant_p(_curl_info)) {                                     \
4306-    if (_curl_is_string_info(_curl_info) && !_curl_is_arr((arg), char *))     \
4307-      _curl_easy_getinfo_err_string();                                        \
4308-    if (_curl_is_long_info(_curl_info) && !_curl_is_arr((arg), long))         \
4309-      _curl_easy_getinfo_err_long();                                          \
4310-    if (_curl_is_double_info(_curl_info) && !_curl_is_arr((arg), double))     \
4311-      _curl_easy_getinfo_err_double();                                        \
4312-    if (_curl_is_slist_info(_curl_info) &&                                    \
4313-           !_curl_is_arr((arg), struct curl_slist *))                         \
4314-      _curl_easy_getinfo_err_curl_slist();                                    \
4315+  __typeof__(info) _curl_info = info;                                         \
4316+  if(__builtin_constant_p(_curl_info)) {                                      \
4317+    if(_curl_is_string_info(_curl_info))                                      \
4318+      if(!_curl_is_arr((arg), char *))                                        \
4319+        _curl_easy_getinfo_err_string();                                      \
4320+    if(_curl_is_long_info(_curl_info))                                        \
4321+      if(!_curl_is_arr((arg), long))                                          \
4322+        _curl_easy_getinfo_err_long();                                        \
4323+    if(_curl_is_double_info(_curl_info))                                      \
4324+      if(!_curl_is_arr((arg), double))                                        \
4325+        _curl_easy_getinfo_err_double();                                      \
4326+    if(_curl_is_slist_info(_curl_info))                                       \
4327+      if(!_curl_is_arr((arg), struct curl_slist *))                           \
4328+        _curl_easy_getinfo_err_curl_slist();                                  \
4329+    if(_curl_is_tlssessioninfo_info(_curl_info))                              \
4330+      if(!_curl_is_arr((arg), struct curl_tlssessioninfo *))                  \
4331+        _curl_easy_getinfo_err_curl_tlssesssioninfo();                        \
4332+    if(_curl_is_certinfo_info(_curl_info))                                    \
4333+      if(!_curl_is_arr((arg), struct curl_certinfo *))                        \
4334+        _curl_easy_getinfo_err_curl_certinfo();                               \
4335+    if(_curl_is_socket_info(_curl_info))                                      \
4336+      if(!_curl_is_arr((arg), curl_socket_t))                                 \
4337+        _curl_easy_getinfo_err_curl_socket();                                 \
4338+    if(_curl_is_off_t_info(_curl_info))                                       \
4339+      if(!_curl_is_arr((arg), curl_off_t))                                    \
4340+        _curl_easy_getinfo_err_curl_off_t();                                  \
4341   }                                                                           \
4342   curl_easy_getinfo(handle, _curl_info, arg);                                 \
4343 })
4344
4345 /* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(),
4346  * for now just make sure that the functions are called with three
4347  * arguments
4348  */
4349@@ -114,70 +154,93 @@
4350 #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
4351
4352
4353 /* the actual warnings, triggered by calling the _curl_easy_setopt_err*
4354  * functions */
4355
4356 /* To define a new warning, use _CURL_WARNING(identifier, "message") */
4357 #define _CURL_WARNING(id, message)                                            \
4358-  static void __attribute__((warning(message))) __attribute__((unused))       \
4359-  __attribute__((noinline)) id(void) { __asm__(""); }
4360+  static void __attribute__((__warning__(message)))                           \
4361+  __attribute__((__unused__)) __attribute__((__noinline__))                   \
4362+  id(void) { __asm__(""); }
4363
4364 _CURL_WARNING(_curl_easy_setopt_err_long,
4365   "curl_easy_setopt expects a long argument for this option")
4366 _CURL_WARNING(_curl_easy_setopt_err_curl_off_t,
4367   "curl_easy_setopt expects a curl_off_t argument for this option")
4368 _CURL_WARNING(_curl_easy_setopt_err_string,
4369-  "curl_easy_setopt expects a string (char* or char[]) argument for this option"
4370+              "curl_easy_setopt expects a "
4371+              "string ('char *' or char[]) argument for this option"
4372   )
4373 _CURL_WARNING(_curl_easy_setopt_err_write_callback,
4374   "curl_easy_setopt expects a curl_write_callback argument for this option")
4375+_CURL_WARNING(_curl_easy_setopt_err_resolver_start_callback,
4376+              "curl_easy_setopt expects a "
4377+              "curl_resolver_start_callback argument for this option"
4378+  )
4379 _CURL_WARNING(_curl_easy_setopt_err_read_cb,
4380   "curl_easy_setopt expects a curl_read_callback argument for this option")
4381 _CURL_WARNING(_curl_easy_setopt_err_ioctl_cb,
4382   "curl_easy_setopt expects a curl_ioctl_callback argument for this option")
4383 _CURL_WARNING(_curl_easy_setopt_err_sockopt_cb,
4384   "curl_easy_setopt expects a curl_sockopt_callback argument for this option")
4385 _CURL_WARNING(_curl_easy_setopt_err_opensocket_cb,
4386-  "curl_easy_setopt expects a curl_opensocket_callback argument for this option"
4387+              "curl_easy_setopt expects a "
4388+              "curl_opensocket_callback argument for this option"
4389   )
4390 _CURL_WARNING(_curl_easy_setopt_err_progress_cb,
4391   "curl_easy_setopt expects a curl_progress_callback argument for this option")
4392 _CURL_WARNING(_curl_easy_setopt_err_debug_cb,
4393   "curl_easy_setopt expects a curl_debug_callback argument for this option")
4394 _CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb,
4395   "curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option")
4396 _CURL_WARNING(_curl_easy_setopt_err_conv_cb,
4397   "curl_easy_setopt expects a curl_conv_callback argument for this option")
4398 _CURL_WARNING(_curl_easy_setopt_err_seek_cb,
4399   "curl_easy_setopt expects a curl_seek_callback argument for this option")
4400 _CURL_WARNING(_curl_easy_setopt_err_cb_data,
4401-  "curl_easy_setopt expects a private data pointer as argument for this option")
4402+              "curl_easy_setopt expects a "
4403+              "private data pointer as argument for this option")
4404 _CURL_WARNING(_curl_easy_setopt_err_error_buffer,
4405-  "curl_easy_setopt expects a char buffer of CURL_ERROR_SIZE as argument for this option")
4406+              "curl_easy_setopt expects a "
4407+              "char buffer of CURL_ERROR_SIZE as argument for this option")
4408 _CURL_WARNING(_curl_easy_setopt_err_FILE,
4409-  "curl_easy_setopt expects a FILE* argument for this option")
4410+  "curl_easy_setopt expects a 'FILE *' argument for this option")
4411 _CURL_WARNING(_curl_easy_setopt_err_postfields,
4412-  "curl_easy_setopt expects a void* or char* argument for this option")
4413+  "curl_easy_setopt expects a 'void *' or 'char *' argument for this option")
4414 _CURL_WARNING(_curl_easy_setopt_err_curl_httpost,
4415-  "curl_easy_setopt expects a struct curl_httppost* argument for this option")
4416+              "curl_easy_setopt expects a 'struct curl_httppost *' "
4417+              "argument for this option")
4418+_CURL_WARNING(_curl_easy_setopt_err_curl_mimepost,
4419+              "curl_easy_setopt expects a 'curl_mime *' "
4420+              "argument for this option")
4421 _CURL_WARNING(_curl_easy_setopt_err_curl_slist,
4422-  "curl_easy_setopt expects a struct curl_slist* argument for this option")
4423+  "curl_easy_setopt expects a 'struct curl_slist *' argument for this option")
4424 _CURL_WARNING(_curl_easy_setopt_err_CURLSH,
4425   "curl_easy_setopt expects a CURLSH* argument for this option")
4426
4427 _CURL_WARNING(_curl_easy_getinfo_err_string,
4428-  "curl_easy_getinfo expects a pointer to char * for this info")
4429+  "curl_easy_getinfo expects a pointer to 'char *' for this info")
4430 _CURL_WARNING(_curl_easy_getinfo_err_long,
4431   "curl_easy_getinfo expects a pointer to long for this info")
4432 _CURL_WARNING(_curl_easy_getinfo_err_double,
4433   "curl_easy_getinfo expects a pointer to double for this info")
4434 _CURL_WARNING(_curl_easy_getinfo_err_curl_slist,
4435-  "curl_easy_getinfo expects a pointer to struct curl_slist * for this info")
4436+  "curl_easy_getinfo expects a pointer to 'struct curl_slist *' for this info")
4437+_CURL_WARNING(_curl_easy_getinfo_err_curl_tlssesssioninfo,
4438+              "curl_easy_getinfo expects a pointer to "
4439+              "'struct curl_tlssessioninfo *' for this info")
4440+_CURL_WARNING(_curl_easy_getinfo_err_curl_certinfo,
4441+              "curl_easy_getinfo expects a pointer to "
4442+              "'struct curl_certinfo *' for this info")
4443+_CURL_WARNING(_curl_easy_getinfo_err_curl_socket,
4444+  "curl_easy_getinfo expects a pointer to curl_socket_t for this info")
4445+_CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
4446+  "curl_easy_getinfo expects a pointer to curl_off_t for this info")
4447
4448 /* groups of curl_easy_setops options that take the same type of argument */
4449
4450 /* To add a new option to one of the groups, just add
4451  *   (option) == CURLOPT_SOMETHING
4452  * to the or-expression. If the option takes a long or curl_off_t, you don't
4453  * have to do anything
4454  */
4455@@ -186,97 +249,145 @@
4456 #define _curl_is_long_option(option)                                          \
4457   (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)
4458
4459 #define _curl_is_off_t_option(option)                                         \
4460   ((option) > CURLOPTTYPE_OFF_T)
4461
4462 /* evaluates to true if option takes a char* argument */
4463 #define _curl_is_string_option(option)                                        \
4464-  ((option) == CURLOPT_URL ||                                                 \
4465-   (option) == CURLOPT_PROXY ||                                               \
4466-   (option) == CURLOPT_INTERFACE ||                                           \
4467-   (option) == CURLOPT_NETRC_FILE ||                                          \
4468-   (option) == CURLOPT_USERPWD ||                                             \
4469-   (option) == CURLOPT_USERNAME ||                                            \
4470-   (option) == CURLOPT_PASSWORD ||                                            \
4471-   (option) == CURLOPT_PROXYUSERPWD ||                                        \
4472-   (option) == CURLOPT_PROXYUSERNAME ||                                       \
4473-   (option) == CURLOPT_PROXYPASSWORD ||                                       \
4474-   (option) == CURLOPT_NOPROXY ||                                             \
4475-   (option) == CURLOPT_ENCODING ||                                            \
4476-   (option) == CURLOPT_REFERER ||                                             \
4477-   (option) == CURLOPT_USERAGENT ||                                           \
4478+  ((option) == CURLOPT_ABSTRACT_UNIX_SOCKET ||                                \
4479+   (option) == CURLOPT_ACCEPT_ENCODING ||                                     \
4480+   (option) == CURLOPT_ALTSVC ||                                              \
4481+   (option) == CURLOPT_CAINFO ||                                              \
4482+   (option) == CURLOPT_CAPATH ||                                              \
4483    (option) == CURLOPT_COOKIE ||                                              \
4484    (option) == CURLOPT_COOKIEFILE ||                                          \
4485    (option) == CURLOPT_COOKIEJAR ||                                           \
4486    (option) == CURLOPT_COOKIELIST ||                                          \
4487+   (option) == CURLOPT_CRLFILE ||                                             \
4488+   (option) == CURLOPT_CUSTOMREQUEST ||                                       \
4489+   (option) == CURLOPT_DEFAULT_PROTOCOL ||                                    \
4490+   (option) == CURLOPT_DNS_INTERFACE ||                                       \
4491+   (option) == CURLOPT_DNS_LOCAL_IP4 ||                                       \
4492+   (option) == CURLOPT_DNS_LOCAL_IP6 ||                                       \
4493+   (option) == CURLOPT_DNS_SERVERS ||                                         \
4494+   (option) == CURLOPT_DOH_URL ||                                             \
4495+   (option) == CURLOPT_EGDSOCKET ||                                           \
4496    (option) == CURLOPT_FTPPORT ||                                             \
4497-   (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER ||                             \
4498    (option) == CURLOPT_FTP_ACCOUNT ||                                         \
4499+   (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER ||                             \
4500+   (option) == CURLOPT_INTERFACE ||                                           \
4501+   (option) == CURLOPT_ISSUERCERT ||                                          \
4502+   (option) == CURLOPT_KEYPASSWD ||                                           \
4503+   (option) == CURLOPT_KRBLEVEL ||                                            \
4504+   (option) == CURLOPT_LOGIN_OPTIONS ||                                       \
4505+   (option) == CURLOPT_MAIL_AUTH ||                                           \
4506+   (option) == CURLOPT_MAIL_FROM ||                                           \
4507+   (option) == CURLOPT_NETRC_FILE ||                                          \
4508+   (option) == CURLOPT_NOPROXY ||                                             \
4509+   (option) == CURLOPT_PASSWORD ||                                            \
4510+   (option) == CURLOPT_PINNEDPUBLICKEY ||                                     \
4511+   (option) == CURLOPT_PRE_PROXY ||                                           \
4512+   (option) == CURLOPT_PROXY ||                                               \
4513+   (option) == CURLOPT_PROXYPASSWORD ||                                       \
4514+   (option) == CURLOPT_PROXYUSERNAME ||                                       \
4515+   (option) == CURLOPT_PROXYUSERPWD ||                                        \
4516+   (option) == CURLOPT_PROXY_CAINFO ||                                        \
4517+   (option) == CURLOPT_PROXY_CAPATH ||                                        \
4518+   (option) == CURLOPT_PROXY_CRLFILE ||                                       \
4519+   (option) == CURLOPT_PROXY_KEYPASSWD ||                                     \
4520+   (option) == CURLOPT_PROXY_PINNEDPUBLICKEY ||                               \
4521+   (option) == CURLOPT_PROXY_SERVICE_NAME ||                                  \
4522+   (option) == CURLOPT_PROXY_SSLCERT ||                                       \
4523+   (option) == CURLOPT_PROXY_SSLCERTTYPE ||                                   \
4524+   (option) == CURLOPT_PROXY_SSLKEY ||                                        \
4525+   (option) == CURLOPT_PROXY_SSLKEYTYPE ||                                    \
4526+   (option) == CURLOPT_PROXY_SSL_CIPHER_LIST ||                               \
4527+   (option) == CURLOPT_PROXY_TLSAUTH_PASSWORD ||                              \
4528+   (option) == CURLOPT_PROXY_TLSAUTH_USERNAME ||                              \
4529+   (option) == CURLOPT_PROXY_TLSAUTH_TYPE ||                                  \
4530+   (option) == CURLOPT_RANDOM_FILE ||                                         \
4531    (option) == CURLOPT_RANGE ||                                               \
4532-   (option) == CURLOPT_CUSTOMREQUEST ||                                       \
4533+   (option) == CURLOPT_REFERER ||                                             \
4534+   (option) == CURLOPT_RTSP_SESSION_ID ||                                     \
4535+   (option) == CURLOPT_RTSP_STREAM_URI ||                                     \
4536+   (option) == CURLOPT_RTSP_TRANSPORT ||                                      \
4537+   (option) == CURLOPT_SERVICE_NAME ||                                        \
4538+   (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE ||                               \
4539+   (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 ||                             \
4540+   (option) == CURLOPT_SSH_KNOWNHOSTS ||                                      \
4541+   (option) == CURLOPT_SSH_PRIVATE_KEYFILE ||                                 \
4542+   (option) == CURLOPT_SSH_PUBLIC_KEYFILE ||                                  \
4543    (option) == CURLOPT_SSLCERT ||                                             \
4544    (option) == CURLOPT_SSLCERTTYPE ||                                         \
4545+   (option) == CURLOPT_SSLENGINE ||                                           \
4546    (option) == CURLOPT_SSLKEY ||                                              \
4547    (option) == CURLOPT_SSLKEYTYPE ||                                          \
4548-   (option) == CURLOPT_KEYPASSWD ||                                           \
4549-   (option) == CURLOPT_SSLENGINE ||                                           \
4550-   (option) == CURLOPT_CAINFO ||                                              \
4551-   (option) == CURLOPT_CAPATH ||                                              \
4552-   (option) == CURLOPT_RANDOM_FILE ||                                         \
4553-   (option) == CURLOPT_EGDSOCKET ||                                           \
4554    (option) == CURLOPT_SSL_CIPHER_LIST ||                                     \
4555-   (option) == CURLOPT_KRBLEVEL ||                                            \
4556-   (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 ||                             \
4557-   (option) == CURLOPT_SSH_PUBLIC_KEYFILE ||                                  \
4558-   (option) == CURLOPT_SSH_PRIVATE_KEYFILE ||                                 \
4559-   (option) == CURLOPT_CRLFILE ||                                             \
4560-   (option) == CURLOPT_ISSUERCERT ||                                          \
4561+   (option) == CURLOPT_TLSAUTH_PASSWORD ||                                    \
4562+   (option) == CURLOPT_TLSAUTH_TYPE ||                                        \
4563+   (option) == CURLOPT_TLSAUTH_USERNAME ||                                    \
4564+   (option) == CURLOPT_UNIX_SOCKET_PATH ||                                    \
4565+   (option) == CURLOPT_URL ||                                                 \
4566+   (option) == CURLOPT_USERAGENT ||                                           \
4567+   (option) == CURLOPT_USERNAME ||                                            \
4568+   (option) == CURLOPT_USERPWD ||                                             \
4569+   (option) == CURLOPT_XOAUTH2_BEARER ||                                      \
4570    0)
4571
4572 /* evaluates to true if option takes a curl_write_callback argument */
4573 #define _curl_is_write_cb_option(option)                                      \
4574   ((option) == CURLOPT_HEADERFUNCTION ||                                      \
4575    (option) == CURLOPT_WRITEFUNCTION)
4576
4577 /* evaluates to true if option takes a curl_conv_callback argument */
4578 #define _curl_is_conv_cb_option(option)                                       \
4579   ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION ||                            \
4580    (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION ||                          \
4581    (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)
4582
4583 /* evaluates to true if option takes a data argument to pass to a callback */
4584 #define _curl_is_cb_data_option(option)                                       \
4585-  ((option) == CURLOPT_WRITEDATA ||                                           \
4586-   (option) == CURLOPT_READDATA ||                                            \
4587+  ((option) == CURLOPT_CHUNK_DATA ||                                          \
4588+   (option) == CURLOPT_CLOSESOCKETDATA ||                                     \
4589+   (option) == CURLOPT_DEBUGDATA ||                                           \
4590+   (option) == CURLOPT_FNMATCH_DATA ||                                        \
4591+   (option) == CURLOPT_HEADERDATA ||                                          \
4592+   (option) == CURLOPT_INTERLEAVEDATA ||                                      \
4593    (option) == CURLOPT_IOCTLDATA ||                                           \
4594-   (option) == CURLOPT_SOCKOPTDATA ||                                         \
4595    (option) == CURLOPT_OPENSOCKETDATA ||                                      \
4596+   (option) == CURLOPT_PRIVATE ||                                             \
4597    (option) == CURLOPT_PROGRESSDATA ||                                        \
4598-   (option) == CURLOPT_WRITEHEADER ||                                         \
4599-   (option) == CURLOPT_DEBUGDATA ||                                           \
4600+   (option) == CURLOPT_READDATA ||                                            \
4601+   (option) == CURLOPT_SEEKDATA ||                                            \
4602+   (option) == CURLOPT_SOCKOPTDATA ||                                         \
4603+   (option) == CURLOPT_SSH_KEYDATA ||                                         \
4604    (option) == CURLOPT_SSL_CTX_DATA ||                                        \
4605-   (option) == CURLOPT_SEEKDATA ||                                            \
4606-   (option) == CURLOPT_PRIVATE ||                                             \
4607+   (option) == CURLOPT_WRITEDATA ||                                           \
4608+   (option) == CURLOPT_RESOLVER_START_DATA ||                                 \
4609+   (option) == CURLOPT_CURLU ||                                               \
4610    0)
4611
4612 /* evaluates to true if option takes a POST data argument (void* or char*) */
4613 #define _curl_is_postfields_option(option)                                    \
4614   ((option) == CURLOPT_POSTFIELDS ||                                          \
4615    (option) == CURLOPT_COPYPOSTFIELDS ||                                      \
4616    0)
4617
4618 /* evaluates to true if option takes a struct curl_slist * argument */
4619 #define _curl_is_slist_option(option)                                         \
4620-  ((option) == CURLOPT_HTTPHEADER ||                                          \
4621-   (option) == CURLOPT_HTTP200ALIASES ||                                      \
4622-   (option) == CURLOPT_QUOTE ||                                               \
4623+  ((option) == CURLOPT_HTTP200ALIASES ||                                      \
4624+   (option) == CURLOPT_HTTPHEADER ||                                          \
4625+   (option) == CURLOPT_MAIL_RCPT ||                                           \
4626    (option) == CURLOPT_POSTQUOTE ||                                           \
4627    (option) == CURLOPT_PREQUOTE ||                                            \
4628+   (option) == CURLOPT_PROXYHEADER ||                                         \
4629+   (option) == CURLOPT_QUOTE ||                                               \
4630+   (option) == CURLOPT_RESOLVE ||                                             \
4631    (option) == CURLOPT_TELNETOPTIONS ||                                       \
4632    0)
4633
4634 /* groups of curl_easy_getinfo infos that take the same type of argument */
4635
4636 /* evaluates to true if info expects a pointer to char * argument */
4637 #define _curl_is_string_info(info)                                            \
4638   (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG)
4639@@ -285,34 +396,49 @@
4640 #define _curl_is_long_info(info)                                              \
4641   (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)
4642
4643 /* evaluates to true if info expects a pointer to double argument */
4644 #define _curl_is_double_info(info)                                            \
4645   (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)
4646
4647 /* true if info expects a pointer to struct curl_slist * argument */
4648-#define _curl_is_slist_info(info)                                             \
4649-  (CURLINFO_SLIST < (info))
4650+#define _curl_is_slist_info(info)                                       \
4651+  (((info) == CURLINFO_SSL_ENGINES) || ((info) == CURLINFO_COOKIELIST))
4652+
4653+/* true if info expects a pointer to struct curl_tlssessioninfo * argument */
4654+#define _curl_is_tlssessioninfo_info(info)                              \
4655+  (((info) == CURLINFO_TLS_SSL_PTR) || ((info) == CURLINFO_TLS_SESSION))
4656+
4657+/* true if info expects a pointer to struct curl_certinfo * argument */
4658+#define _curl_is_certinfo_info(info) ((info) == CURLINFO_CERTINFO)
4659+
4660+/* true if info expects a pointer to struct curl_socket_t argument */
4661+#define _curl_is_socket_info(info)                                            \
4662+  (CURLINFO_SOCKET < (info) && (info) < CURLINFO_OFF_T)
4663+
4664+/* true if info expects a pointer to curl_off_t argument */
4665+#define _curl_is_off_t_info(info)                                             \
4666+  (CURLINFO_OFF_T < (info))
4667
4668
4669 /* typecheck helpers -- check whether given expression has requested type*/
4670
4671 /* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros,
4672  * otherwise define a new macro. Search for __builtin_types_compatible_p
4673  * in the GCC manual.
4674  * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is
4675  * the actual expression passed to the curl_easy_setopt macro. This
4676  * means that you can only apply the sizeof and __typeof__ operators, no
4677  * == or whatsoever.
4678  */
4679
4680-/* XXX: should evaluate to true iff expr is a pointer */
4681+/* XXX: should evaluate to true if expr is a pointer */
4682 #define _curl_is_any_ptr(expr)                                                \
4683-  (sizeof(expr) == sizeof(void*))
4684+  (sizeof(expr) == sizeof(void *))
4685
4686 /* evaluates to true if expr is NULL */
4687 /* XXX: must not evaluate expr, so this check is not accurate */
4688 #define _curl_is_NULL(expr)                                                   \
4689   (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))
4690
4691 /* evaluates to true if expr is type*, const type* or NULL */
4692 #define _curl_is_ptr(expr, type)                                              \
4693@@ -350,202 +476,225 @@
4694
4695 /* evaluates to true if expr is of type curl_off_t */
4696 #define _curl_is_off_t(expr)                                                  \
4697   (__builtin_types_compatible_p(__typeof__(expr), curl_off_t))
4698
4699 /* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */
4700 /* XXX: also check size of an char[] array? */
4701 #define _curl_is_error_buffer(expr)                                           \
4702-  (__builtin_types_compatible_p(__typeof__(expr), char *) ||                  \
4703+  (_curl_is_NULL(expr) ||                                                     \
4704+   __builtin_types_compatible_p(__typeof__(expr), char *) ||                  \
4705    __builtin_types_compatible_p(__typeof__(expr), char[]))
4706
4707 /* evaluates to true if expr is of type (const) void* or (const) FILE* */
4708 #if 0
4709 #define _curl_is_cb_data(expr)                                                \
4710   (_curl_is_ptr((expr), void) ||                                              \
4711    _curl_is_ptr((expr), FILE))
4712 #else /* be less strict */
4713 #define _curl_is_cb_data(expr)                                                \
4714   _curl_is_any_ptr(expr)
4715 #endif
4716
4717 /* evaluates to true if expr is of type FILE* */
4718-#define _curl_is_FILE(expr)                                                   \
4719-  (__builtin_types_compatible_p(__typeof__(expr), FILE *))
4720+#define _curl_is_FILE(expr)                                             \
4721+  (_curl_is_NULL(expr) ||                                              \
4722+   (__builtin_types_compatible_p(__typeof__(expr), FILE *)))
4723
4724 /* evaluates to true if expr can be passed as POST data (void* or char*) */
4725 #define _curl_is_postfields(expr)                                             \
4726   (_curl_is_ptr((expr), void) ||                                              \
4727-   _curl_is_arr((expr), char))
4728+   _curl_is_arr((expr), char) ||                                              \
4729+   _curl_is_arr((expr), unsigned char))
4730
4731 /* FIXME: the whole callback checking is messy...
4732  * The idea is to tolerate char vs. void and const vs. not const
4733  * pointers in arguments at least
4734  */
4735 /* helper: __builtin_types_compatible_p distinguishes between functions and
4736  * function pointers, hide it */
4737 #define _curl_callback_compatible(func, type)                                 \
4738   (__builtin_types_compatible_p(__typeof__(func), type) ||                    \
4739-   __builtin_types_compatible_p(__typeof__(func), type*))
4740+   __builtin_types_compatible_p(__typeof__(func) *, type))
4741+
4742+/* evaluates to true if expr is of type curl_resolver_start_callback */
4743+#define _curl_is_resolver_start_callback(expr)       \
4744+  (_curl_is_NULL(expr) || \
4745+   _curl_callback_compatible((expr), curl_resolver_start_callback))
4746
4747 /* evaluates to true if expr is of type curl_read_callback or "similar" */
4748 #define _curl_is_read_cb(expr)                                          \
4749   (_curl_is_NULL(expr) ||                                                     \
4750-   __builtin_types_compatible_p(__typeof__(expr), __typeof__(fread)) ||       \
4751-   __builtin_types_compatible_p(__typeof__(expr), curl_read_callback) ||      \
4752+   _curl_callback_compatible((expr), __typeof__(fread) *) ||                  \
4753+   _curl_callback_compatible((expr), curl_read_callback) ||                   \
4754    _curl_callback_compatible((expr), _curl_read_callback1) ||                 \
4755    _curl_callback_compatible((expr), _curl_read_callback2) ||                 \
4756    _curl_callback_compatible((expr), _curl_read_callback3) ||                 \
4757    _curl_callback_compatible((expr), _curl_read_callback4) ||                 \
4758    _curl_callback_compatible((expr), _curl_read_callback5) ||                 \
4759    _curl_callback_compatible((expr), _curl_read_callback6))
4760-typedef size_t (_curl_read_callback1)(char *, size_t, size_t, void*);
4761-typedef size_t (_curl_read_callback2)(char *, size_t, size_t, const void*);
4762-typedef size_t (_curl_read_callback3)(char *, size_t, size_t, FILE*);
4763-typedef size_t (_curl_read_callback4)(void *, size_t, size_t, void*);
4764-typedef size_t (_curl_read_callback5)(void *, size_t, size_t, const void*);
4765-typedef size_t (_curl_read_callback6)(void *, size_t, size_t, FILE*);
4766+typedef size_t (*_curl_read_callback1)(char *, size_t, size_t, void *);
4767+typedef size_t (*_curl_read_callback2)(char *, size_t, size_t, const void *);
4768+typedef size_t (*_curl_read_callback3)(char *, size_t, size_t, FILE *);
4769+typedef size_t (*_curl_read_callback4)(void *, size_t, size_t, void *);
4770+typedef size_t (*_curl_read_callback5)(void *, size_t, size_t, const void *);
4771+typedef size_t (*_curl_read_callback6)(void *, size_t, size_t, FILE *);
4772
4773 /* evaluates to true if expr is of type curl_write_callback or "similar" */
4774 #define _curl_is_write_cb(expr)                                               \
4775   (_curl_is_read_cb(expr) ||                                            \
4776-   __builtin_types_compatible_p(__typeof__(expr), __typeof__(fwrite)) ||      \
4777-   __builtin_types_compatible_p(__typeof__(expr), curl_write_callback) ||     \
4778+   _curl_callback_compatible((expr), __typeof__(fwrite) *) ||                 \
4779+   _curl_callback_compatible((expr), curl_write_callback) ||                  \
4780    _curl_callback_compatible((expr), _curl_write_callback1) ||                \
4781    _curl_callback_compatible((expr), _curl_write_callback2) ||                \
4782    _curl_callback_compatible((expr), _curl_write_callback3) ||                \
4783    _curl_callback_compatible((expr), _curl_write_callback4) ||                \
4784    _curl_callback_compatible((expr), _curl_write_callback5) ||                \
4785    _curl_callback_compatible((expr), _curl_write_callback6))
4786-typedef size_t (_curl_write_callback1)(const char *, size_t, size_t, void*);
4787-typedef size_t (_curl_write_callback2)(const char *, size_t, size_t,
4788-                                       const void*);
4789-typedef size_t (_curl_write_callback3)(const char *, size_t, size_t, FILE*);
4790-typedef size_t (_curl_write_callback4)(const void *, size_t, size_t, void*);
4791-typedef size_t (_curl_write_callback5)(const void *, size_t, size_t,
4792-                                       const void*);
4793-typedef size_t (_curl_write_callback6)(const void *, size_t, size_t, FILE*);
4794+typedef size_t (*_curl_write_callback1)(const char *, size_t, size_t, void *);
4795+typedef size_t (*_curl_write_callback2)(const char *, size_t, size_t,
4796+                                       const void *);
4797+typedef size_t (*_curl_write_callback3)(const char *, size_t, size_t, FILE *);
4798+typedef size_t (*_curl_write_callback4)(const void *, size_t, size_t, void *);
4799+typedef size_t (*_curl_write_callback5)(const void *, size_t, size_t,
4800+                                       const void *);
4801+typedef size_t (*_curl_write_callback6)(const void *, size_t, size_t, FILE *);
4802
4803 /* evaluates to true if expr is of type curl_ioctl_callback or "similar" */
4804 #define _curl_is_ioctl_cb(expr)                                         \
4805   (_curl_is_NULL(expr) ||                                                     \
4806-   __builtin_types_compatible_p(__typeof__(expr), curl_ioctl_callback) ||     \
4807+   _curl_callback_compatible((expr), curl_ioctl_callback) ||                  \
4808    _curl_callback_compatible((expr), _curl_ioctl_callback1) ||                \
4809    _curl_callback_compatible((expr), _curl_ioctl_callback2) ||                \
4810    _curl_callback_compatible((expr), _curl_ioctl_callback3) ||                \
4811    _curl_callback_compatible((expr), _curl_ioctl_callback4))
4812-typedef curlioerr (_curl_ioctl_callback1)(CURL *, int, void*);
4813-typedef curlioerr (_curl_ioctl_callback2)(CURL *, int, const void*);
4814-typedef curlioerr (_curl_ioctl_callback3)(CURL *, curliocmd, void*);
4815-typedef curlioerr (_curl_ioctl_callback4)(CURL *, curliocmd, const void*);
4816+typedef curlioerr (*_curl_ioctl_callback1)(CURL *, int, void *);
4817+typedef curlioerr (*_curl_ioctl_callback2)(CURL *, int, const void *);
4818+typedef curlioerr (*_curl_ioctl_callback3)(CURL *, curliocmd, void *);
4819+typedef curlioerr (*_curl_ioctl_callback4)(CURL *, curliocmd, const void *);
4820
4821 /* evaluates to true if expr is of type curl_sockopt_callback or "similar" */
4822 #define _curl_is_sockopt_cb(expr)                                       \
4823   (_curl_is_NULL(expr) ||                                                     \
4824-   __builtin_types_compatible_p(__typeof__(expr), curl_sockopt_callback) ||   \
4825+   _curl_callback_compatible((expr), curl_sockopt_callback) ||                \
4826    _curl_callback_compatible((expr), _curl_sockopt_callback1) ||              \
4827    _curl_callback_compatible((expr), _curl_sockopt_callback2))
4828-typedef int (_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);
4829-typedef int (_curl_sockopt_callback2)(const void *, curl_socket_t,
4830+typedef int (*_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);
4831+typedef int (*_curl_sockopt_callback2)(const void *, curl_socket_t,
4832                                       curlsocktype);
4833
4834-/* evaluates to true if expr is of type curl_opensocket_callback or "similar" */
4835+/* evaluates to true if expr is of type curl_opensocket_callback or
4836+   "similar" */
4837 #define _curl_is_opensocket_cb(expr)                                    \
4838   (_curl_is_NULL(expr) ||                                                     \
4839-   __builtin_types_compatible_p(__typeof__(expr), curl_opensocket_callback) ||\
4840+   _curl_callback_compatible((expr), curl_opensocket_callback) ||             \
4841    _curl_callback_compatible((expr), _curl_opensocket_callback1) ||           \
4842    _curl_callback_compatible((expr), _curl_opensocket_callback2) ||           \
4843    _curl_callback_compatible((expr), _curl_opensocket_callback3) ||           \
4844    _curl_callback_compatible((expr), _curl_opensocket_callback4))
4845-typedef curl_socket_t (_curl_opensocket_callback1)
4846+typedef curl_socket_t (*_curl_opensocket_callback1)
4847   (void *, curlsocktype, struct curl_sockaddr *);
4848-typedef curl_socket_t (_curl_opensocket_callback2)
4849+typedef curl_socket_t (*_curl_opensocket_callback2)
4850   (void *, curlsocktype, const struct curl_sockaddr *);
4851-typedef curl_socket_t (_curl_opensocket_callback3)
4852+typedef curl_socket_t (*_curl_opensocket_callback3)
4853   (const void *, curlsocktype, struct curl_sockaddr *);
4854-typedef curl_socket_t (_curl_opensocket_callback4)
4855+typedef curl_socket_t (*_curl_opensocket_callback4)
4856   (const void *, curlsocktype, const struct curl_sockaddr *);
4857
4858 /* evaluates to true if expr is of type curl_progress_callback or "similar" */
4859 #define _curl_is_progress_cb(expr)                                      \
4860   (_curl_is_NULL(expr) ||                                                     \
4861-   __builtin_types_compatible_p(__typeof__(expr), curl_progress_callback) ||  \
4862+   _curl_callback_compatible((expr), curl_progress_callback) ||               \
4863    _curl_callback_compatible((expr), _curl_progress_callback1) ||             \
4864    _curl_callback_compatible((expr), _curl_progress_callback2))
4865-typedef int (_curl_progress_callback1)(void *,
4866+typedef int (*_curl_progress_callback1)(void *,
4867     double, double, double, double);
4868-typedef int (_curl_progress_callback2)(const void *,
4869+typedef int (*_curl_progress_callback2)(const void *,
4870     double, double, double, double);
4871
4872 /* evaluates to true if expr is of type curl_debug_callback or "similar" */
4873 #define _curl_is_debug_cb(expr)                                         \
4874   (_curl_is_NULL(expr) ||                                                     \
4875-   __builtin_types_compatible_p(__typeof__(expr), curl_debug_callback) ||     \
4876+   _curl_callback_compatible((expr), curl_debug_callback) ||                  \
4877    _curl_callback_compatible((expr), _curl_debug_callback1) ||                \
4878    _curl_callback_compatible((expr), _curl_debug_callback2) ||                \
4879    _curl_callback_compatible((expr), _curl_debug_callback3) ||                \
4880-   _curl_callback_compatible((expr), _curl_debug_callback4))
4881-typedef int (_curl_debug_callback1) (CURL *,
4882+   _curl_callback_compatible((expr), _curl_debug_callback4) ||                \
4883+   _curl_callback_compatible((expr), _curl_debug_callback5) ||                \
4884+   _curl_callback_compatible((expr), _curl_debug_callback6) ||                \
4885+   _curl_callback_compatible((expr), _curl_debug_callback7) ||                \
4886+   _curl_callback_compatible((expr), _curl_debug_callback8))
4887+typedef int (*_curl_debug_callback1) (CURL *,
4888     curl_infotype, char *, size_t, void *);
4889-typedef int (_curl_debug_callback2) (CURL *,
4890+typedef int (*_curl_debug_callback2) (CURL *,
4891     curl_infotype, char *, size_t, const void *);
4892-typedef int (_curl_debug_callback3) (CURL *,
4893+typedef int (*_curl_debug_callback3) (CURL *,
4894     curl_infotype, const char *, size_t, void *);
4895-typedef int (_curl_debug_callback4) (CURL *,
4896+typedef int (*_curl_debug_callback4) (CURL *,
4897     curl_infotype, const char *, size_t, const void *);
4898+typedef int (*_curl_debug_callback5) (CURL *,
4899+    curl_infotype, unsigned char *, size_t, void *);
4900+typedef int (*_curl_debug_callback6) (CURL *,
4901+    curl_infotype, unsigned char *, size_t, const void *);
4902+typedef int (*_curl_debug_callback7) (CURL *,
4903+    curl_infotype, const unsigned char *, size_t, void *);
4904+typedef int (*_curl_debug_callback8) (CURL *,
4905+    curl_infotype, const unsigned char *, size_t, const void *);
4906
4907 /* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */
4908 /* this is getting even messier... */
4909 #define _curl_is_ssl_ctx_cb(expr)                                       \
4910   (_curl_is_NULL(expr) ||                                                     \
4911-   __builtin_types_compatible_p(__typeof__(expr), curl_ssl_ctx_callback) ||   \
4912+   _curl_callback_compatible((expr), curl_ssl_ctx_callback) ||                \
4913    _curl_callback_compatible((expr), _curl_ssl_ctx_callback1) ||              \
4914    _curl_callback_compatible((expr), _curl_ssl_ctx_callback2) ||              \
4915    _curl_callback_compatible((expr), _curl_ssl_ctx_callback3) ||              \
4916    _curl_callback_compatible((expr), _curl_ssl_ctx_callback4) ||              \
4917    _curl_callback_compatible((expr), _curl_ssl_ctx_callback5) ||              \
4918    _curl_callback_compatible((expr), _curl_ssl_ctx_callback6) ||              \
4919    _curl_callback_compatible((expr), _curl_ssl_ctx_callback7) ||              \
4920    _curl_callback_compatible((expr), _curl_ssl_ctx_callback8))
4921-typedef CURLcode (_curl_ssl_ctx_callback1)(CURL *, void *, void *);
4922-typedef CURLcode (_curl_ssl_ctx_callback2)(CURL *, void *, const void *);
4923-typedef CURLcode (_curl_ssl_ctx_callback3)(CURL *, const void *, void *);
4924-typedef CURLcode (_curl_ssl_ctx_callback4)(CURL *, const void *, const void *);
4925+typedef CURLcode (*_curl_ssl_ctx_callback1)(CURL *, void *, void *);
4926+typedef CURLcode (*_curl_ssl_ctx_callback2)(CURL *, void *, const void *);
4927+typedef CURLcode (*_curl_ssl_ctx_callback3)(CURL *, const void *, void *);
4928+typedef CURLcode (*_curl_ssl_ctx_callback4)(CURL *, const void *,
4929+                                            const void *);
4930 #ifdef HEADER_SSL_H
4931 /* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX
4932  * this will of course break if we're included before OpenSSL headers...
4933  */
4934-typedef CURLcode (_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *);
4935-typedef CURLcode (_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *);
4936-typedef CURLcode (_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *);
4937-typedef CURLcode (_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX, const void *);
4938+typedef CURLcode (*_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *);
4939+typedef CURLcode (*_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *);
4940+typedef CURLcode (*_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *);
4941+typedef CURLcode (*_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX,
4942+                                           const void *);
4943 #else
4944 typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;
4945 typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;
4946 typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7;
4947 typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8;
4948 #endif
4949
4950 /* evaluates to true if expr is of type curl_conv_callback or "similar" */
4951 #define _curl_is_conv_cb(expr)                                          \
4952   (_curl_is_NULL(expr) ||                                                     \
4953-   __builtin_types_compatible_p(__typeof__(expr), curl_conv_callback) ||      \
4954+   _curl_callback_compatible((expr), curl_conv_callback) ||                   \
4955    _curl_callback_compatible((expr), _curl_conv_callback1) ||                 \
4956    _curl_callback_compatible((expr), _curl_conv_callback2) ||                 \
4957    _curl_callback_compatible((expr), _curl_conv_callback3) ||                 \
4958    _curl_callback_compatible((expr), _curl_conv_callback4))
4959 typedef CURLcode (*_curl_conv_callback1)(char *, size_t length);
4960 typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);
4961 typedef CURLcode (*_curl_conv_callback3)(void *, size_t length);
4962 typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);
4963
4964 /* evaluates to true if expr is of type curl_seek_callback or "similar" */
4965 #define _curl_is_seek_cb(expr)                                          \
4966   (_curl_is_NULL(expr) ||                                                     \
4967-   __builtin_types_compatible_p(__typeof__(expr), curl_seek_callback) ||      \
4968+   _curl_callback_compatible((expr), curl_seek_callback) ||                   \
4969    _curl_callback_compatible((expr), _curl_seek_callback1) ||                 \
4970    _curl_callback_compatible((expr), _curl_seek_callback2))
4971 typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);
4972 typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);
4973
4974
4975 #endif /* __CURL_TYPECHECK_GCC_H */
4976diff --git a/src/third_party/curl/types.h b/src/third_party/curl/types.h
4977deleted file mode 100644
4978--- a/src/third_party/curl/types.h
4979+++ /dev/null
4980@@ -1,1 +0,0 @@
4981-/* not used */
4982diff --git a/src/third_party/curl/urlapi.h b/src/third_party/curl/urlapi.h
4983new file mode 100644
4984--- /dev/null
4985+++ b/src/third_party/curl/urlapi.h
4986@@ -0,0 +1,122 @@
4987+#ifndef __CURL_URLAPI_H
4988+#define __CURL_URLAPI_H
4989+/***************************************************************************
4990+ *                                  _   _ ____  _
4991+ *  Project                     ___| | | |  _ \| |
4992+ *                             / __| | | | |_) | |
4993+ *                            | (__| |_| |  _ <| |___
4994+ *                             \___|\___/|_| \_\_____|
4995+ *
4996+ * Copyright (C) 2018 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
4997+ *
4998+ * This software is licensed as described in the file COPYING, which
4999+ * you should have received as part of this distribution. The terms
5000+ * are also available at https://curl.haxx.se/docs/copyright.html.
5001+ *
5002+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
5003+ * copies of the Software, and permit persons to whom the Software is
5004+ * furnished to do so, under the terms of the COPYING file.
5005+ *
5006+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
5007+ * KIND, either express or implied.
5008+ *
5009+ ***************************************************************************/
5010+
5011+#include "curl.h"
5012+
5013+#ifdef  __cplusplus
5014+extern "C" {
5015+#endif
5016+
5017+/* the error codes for the URL API */
5018+typedef enum {
5019+  CURLUE_OK,
5020+  CURLUE_BAD_HANDLE,          /* 1 */
5021+  CURLUE_BAD_PARTPOINTER,     /* 2 */
5022+  CURLUE_MALFORMED_INPUT,     /* 3 */
5023+  CURLUE_BAD_PORT_NUMBER,     /* 4 */
5024+  CURLUE_UNSUPPORTED_SCHEME,  /* 5 */
5025+  CURLUE_URLDECODE,           /* 6 */
5026+  CURLUE_OUT_OF_MEMORY,       /* 7 */
5027+  CURLUE_USER_NOT_ALLOWED,    /* 8 */
5028+  CURLUE_UNKNOWN_PART,        /* 9 */
5029+  CURLUE_NO_SCHEME,           /* 10 */
5030+  CURLUE_NO_USER,             /* 11 */
5031+  CURLUE_NO_PASSWORD,         /* 12 */
5032+  CURLUE_NO_OPTIONS,          /* 13 */
5033+  CURLUE_NO_HOST,             /* 14 */
5034+  CURLUE_NO_PORT,             /* 15 */
5035+  CURLUE_NO_QUERY,            /* 16 */
5036+  CURLUE_NO_FRAGMENT          /* 17 */
5037+} CURLUcode;
5038+
5039+typedef enum {
5040+  CURLUPART_URL,
5041+  CURLUPART_SCHEME,
5042+  CURLUPART_USER,
5043+  CURLUPART_PASSWORD,
5044+  CURLUPART_OPTIONS,
5045+  CURLUPART_HOST,
5046+  CURLUPART_PORT,
5047+  CURLUPART_PATH,
5048+  CURLUPART_QUERY,
5049+  CURLUPART_FRAGMENT
5050+} CURLUPart;
5051+
5052+#define CURLU_DEFAULT_PORT (1<<0)       /* return default port number */
5053+#define CURLU_NO_DEFAULT_PORT (1<<1)    /* act as if no port number was set,
5054+                                           if the port number matches the
5055+                                           default for the scheme */
5056+#define CURLU_DEFAULT_SCHEME (1<<2)     /* return default scheme if
5057+                                           missing */
5058+#define CURLU_NON_SUPPORT_SCHEME (1<<3) /* allow non-supported scheme */
5059+#define CURLU_PATH_AS_IS (1<<4)         /* leave dot sequences */
5060+#define CURLU_DISALLOW_USER (1<<5)      /* no user+password allowed */
5061+#define CURLU_URLDECODE (1<<6)          /* URL decode on get */
5062+#define CURLU_URLENCODE (1<<7)          /* URL encode on set */
5063+#define CURLU_APPENDQUERY (1<<8)        /* append a form style part */
5064+#define CURLU_GUESS_SCHEME (1<<9)       /* legacy curl-style guessing */
5065+
5066+typedef struct Curl_URL CURLU;
5067+
5068+/*
5069+ * curl_url() creates a new CURLU handle and returns a pointer to it.
5070+ * Must be freed with curl_url_cleanup().
5071+ */
5072+CURL_EXTERN CURLU *curl_url(void);
5073+
5074+/*
5075+ * curl_url_cleanup() frees the CURLU handle and related resources used for
5076+ * the URL parsing. It will not free strings previously returned with the URL
5077+ * API.
5078+ */
5079+CURL_EXTERN void curl_url_cleanup(CURLU *handle);
5080+
5081+/*
5082+ * curl_url_dup() duplicates a CURLU handle and returns a new copy. The new
5083+ * handle must also be freed with curl_url_cleanup().
5084+ */
5085+CURL_EXTERN CURLU *curl_url_dup(CURLU *in);
5086+
5087+/*
5088+ * curl_url_get() extracts a specific part of the URL from a CURLU
5089+ * handle. Returns error code. The returned pointer MUST be freed with
5090+ * curl_free() afterwards.
5091+ */
5092+CURL_EXTERN CURLUcode curl_url_get(CURLU *handle, CURLUPart what,
5093+                                   char **part, unsigned int flags);
5094+
5095+/*
5096+ * curl_url_set() sets a specific part of the URL in a CURLU handle. Returns
5097+ * error code. The passed in string will be copied. Passing a NULL instead of
5098+ * a part string, clears that part.
5099+ */
5100+CURL_EXTERN CURLUcode curl_url_set(CURLU *handle, CURLUPart what,
5101+                                   const char *part, unsigned int flags);
5102+
5103+
5104+#ifdef __cplusplus
5105+} /* end of extern "C" */
5106+#endif
5107+
5108+#endif
5109diff --git a/src/third_party/musl/include/elf.h b/src/third_party/musl/include/elf.h
5110--- a/src/third_party/musl/include/elf.h
5111+++ b/src/third_party/musl/include/elf.h
5112@@ -205,23 +205,123 @@ typedef struct {
5113 #define EM_D10V		85
5114 #define EM_D30V		86
5115 #define EM_V850		87
5116 #define EM_M32R		88
5117 #define EM_MN10300	89
5118 #define EM_MN10200	90
5119 #define EM_PJ		91
5120 #define EM_OR1K		92
5121+#define EM_OPENRISC	92
5122 #define EM_ARC_A5	93
5123+#define EM_ARC_COMPACT	93
5124 #define EM_XTENSA	94
5125+#define EM_VIDEOCORE	95
5126+#define EM_TMM_GPP	96
5127+#define EM_NS32K	97
5128+#define EM_TPC		98
5129+#define EM_SNP1K	99
5130+#define EM_ST200	100
5131+#define EM_IP2K		101
5132+#define EM_MAX		102
5133+#define EM_CR		103
5134+#define EM_F2MC16	104
5135+#define EM_MSP430	105
5136+#define EM_BLACKFIN	106
5137+#define EM_SE_C33	107
5138+#define EM_SEP		108
5139+#define EM_ARCA		109
5140+#define EM_UNICORE	110
5141+#define EM_EXCESS	111
5142+#define EM_DXP		112
5143+#define EM_ALTERA_NIOS2 113
5144+#define EM_CRX		114
5145+#define EM_XGATE	115
5146+#define EM_C166		116
5147+#define EM_M16C		117
5148+#define EM_DSPIC30F	118
5149+#define EM_CE		119
5150+#define EM_M32C		120
5151+#define EM_TSK3000	131
5152+#define EM_RS08		132
5153+#define EM_SHARC	133
5154+#define EM_ECOG2	134
5155+#define EM_SCORE7	135
5156+#define EM_DSP24	136
5157+#define EM_VIDEOCORE3	137
5158+#define EM_LATTICEMICO32 138
5159+#define EM_SE_C17	139
5160+#define EM_TI_C6000	140
5161+#define EM_TI_C2000	141
5162+#define EM_TI_C5500	142
5163+#define EM_TI_ARP32	143
5164+#define EM_TI_PRU	144
5165+#define EM_MMDSP_PLUS	160
5166+#define EM_CYPRESS_M8C	161
5167+#define EM_R32C		162
5168+#define EM_TRIMEDIA	163
5169+#define EM_QDSP6	164
5170+#define EM_8051		165
5171+#define EM_STXP7X	166
5172+#define EM_NDS32	167
5173+#define EM_ECOG1X	168
5174+#define EM_MAXQ30	169
5175+#define EM_XIMO16	170
5176+#define EM_MANIK	171
5177+#define EM_CRAYNV2	172
5178+#define EM_RX		173
5179+#define EM_METAG	174
5180+#define EM_MCST_ELBRUS	175
5181+#define EM_ECOG16	176
5182+#define EM_CR16		177
5183+#define EM_ETPU		178
5184+#define EM_SLE9X	179
5185+#define EM_L10M		180
5186+#define EM_K10M		181
5187 #define EM_AARCH64	183
5188+#define EM_AVR32	185
5189+#define EM_STM8		186
5190+#define EM_TILE64	187
5191 #define EM_TILEPRO	188
5192 #define EM_MICROBLAZE	189
5193+#define EM_CUDA		190
5194 #define EM_TILEGX	191
5195-#define EM_NUM		192
5196+#define EM_CLOUDSHIELD	192
5197+#define EM_COREA_1ST	193
5198+#define EM_COREA_2ND	194
5199+#define EM_ARC_COMPACT2	195
5200+#define EM_OPEN8	196
5201+#define EM_RL78		197
5202+#define EM_VIDEOCORE5	198
5203+#define EM_78KOR	199
5204+#define EM_56800EX	200
5205+#define EM_BA1		201
5206+#define EM_BA2		202
5207+#define EM_XCORE	203
5208+#define EM_MCHP_PIC	204
5209+#define EM_KM32		210
5210+#define EM_KMX32	211
5211+#define EM_EMX16	212
5212+#define EM_EMX8		213
5213+#define EM_KVARC	214
5214+#define EM_CDP		215
5215+#define EM_COGE		216
5216+#define EM_COOL		217
5217+#define EM_NORC		218
5218+#define EM_CSR_KALIMBA	219
5219+#define EM_Z80		220
5220+#define EM_VISIUM	221
5221+#define EM_FT32		222
5222+#define EM_MOXIE	223
5223+#define EM_AMDGPU	224
5224+#define EM_RISCV	243
5225+#define EM_BPF		247
5226+#define EM_CSKY		252
5227+#define EM_NUM		253
5228+
5229 #define EM_ALPHA	0x9026
5230
5231 #define EV_NONE		0
5232 #define EV_CURRENT	1
5233 #define EV_NUM		2
5234
5235 typedef struct {
5236   Elf32_Word	sh_name;
5237@@ -311,21 +411,42 @@ typedef struct {
5238 #define SHF_MERGE	     (1 << 4)
5239 #define SHF_STRINGS	     (1 << 5)
5240 #define SHF_INFO_LINK	     (1 << 6)
5241 #define SHF_LINK_ORDER	     (1 << 7)
5242 #define SHF_OS_NONCONFORMING (1 << 8)
5243
5244 #define SHF_GROUP	     (1 << 9)
5245 #define SHF_TLS		     (1 << 10)
5246+#define SHF_COMPRESSED	     (1 << 11)
5247 #define SHF_MASKOS	     0x0ff00000
5248 #define SHF_MASKPROC	     0xf0000000
5249 #define SHF_ORDERED	     (1 << 30)
5250 #define SHF_EXCLUDE	     (1U << 31)
5251
5252+typedef struct {
5253+  Elf32_Word	ch_type;
5254+  Elf32_Word	ch_size;
5255+  Elf32_Word	ch_addralign;
5256+} Elf32_Chdr;
5257+
5258+typedef struct {
5259+  Elf64_Word	ch_type;
5260+  Elf64_Word	ch_reserved;
5261+  Elf64_Xword	ch_size;
5262+  Elf64_Xword	ch_addralign;
5263+} Elf64_Chdr;
5264+
5265+#define ELFCOMPRESS_ZLIB	1
5266+#define ELFCOMPRESS_LOOS	0x60000000
5267+#define ELFCOMPRESS_HIOS	0x6fffffff
5268+#define ELFCOMPRESS_LOPROC	0x70000000
5269+#define ELFCOMPRESS_HIPROC	0x7fffffff
5270+
5271+
5272 #define GRP_COMDAT	0x1
5273
5274 typedef struct {
5275   Elf32_Word	st_name;
5276   Elf32_Addr	st_value;
5277   Elf32_Word	st_size;
5278   unsigned char	st_info;
5279   unsigned char	st_other;
5280@@ -404,18 +525,17 @@ typedef struct {
5281 #define STV_DEFAULT	0
5282 #define STV_INTERNAL	1
5283 #define STV_HIDDEN	2
5284 #define STV_PROTECTED	3
5285
5286
5287
5288
5289-typedef struct
5290-{
5291+typedef struct {
5292   Elf32_Addr	r_offset;
5293   Elf32_Word	r_info;
5294 } Elf32_Rel;
5295
5296 typedef struct {
5297   Elf64_Addr	r_offset;
5298   Elf64_Xword	r_info;
5299 } Elf64_Rel;
5300@@ -499,16 +619,17 @@ typedef struct {
5301 #define PF_W		(1 << 1)
5302 #define PF_R		(1 << 2)
5303 #define PF_MASKOS	0x0ff00000
5304 #define PF_MASKPROC	0xf0000000
5305
5306
5307
5308 #define NT_PRSTATUS	1
5309+#define NT_PRFPREG	2
5310 #define NT_FPREGSET	2
5311 #define NT_PRPSINFO	3
5312 #define NT_PRXREG	4
5313 #define NT_TASKSTRUCT	4
5314 #define NT_PLATFORM	5
5315 #define NT_AUXV		6
5316 #define NT_GWINDOWS	7
5317 #define NT_ASRS		8
5318@@ -520,35 +641,61 @@ typedef struct {
5319 #define NT_LWPSINFO	17
5320 #define NT_PRFPXREG	20
5321 #define NT_SIGINFO	0x53494749
5322 #define NT_FILE		0x46494c45
5323 #define NT_PRXFPREG	0x46e62b7f
5324 #define NT_PPC_VMX	0x100
5325 #define NT_PPC_SPE	0x101
5326 #define NT_PPC_VSX	0x102
5327+#define NT_PPC_TAR	0x103
5328+#define NT_PPC_PPR	0x104
5329+#define NT_PPC_DSCR	0x105
5330+#define NT_PPC_EBB	0x106
5331+#define NT_PPC_PMU	0x107
5332+#define NT_PPC_TM_CGPR	0x108
5333+#define NT_PPC_TM_CFPR	0x109
5334+#define NT_PPC_TM_CVMX	0x10a
5335+#define NT_PPC_TM_CVSX	0x10b
5336+#define NT_PPC_TM_SPR	0x10c
5337+#define NT_PPC_TM_CTAR	0x10d
5338+#define NT_PPC_TM_CPPR	0x10e
5339+#define NT_PPC_TM_CDSCR	0x10f
5340 #define NT_386_TLS	0x200
5341 #define NT_386_IOPERM	0x201
5342 #define NT_X86_XSTATE	0x202
5343 #define NT_S390_HIGH_GPRS	0x300
5344 #define NT_S390_TIMER	0x301
5345 #define NT_S390_TODCMP	0x302
5346 #define NT_S390_TODPREG	0x303
5347 #define NT_S390_CTRS	0x304
5348 #define NT_S390_PREFIX	0x305
5349 #define NT_S390_LAST_BREAK	0x306
5350 #define NT_S390_SYSTEM_CALL	0x307
5351 #define NT_S390_TDB	0x308
5352+#define NT_S390_VXRS_LOW	0x309
5353+#define NT_S390_VXRS_HIGH	0x30a
5354+#define NT_S390_GS_CB	0x30b
5355+#define NT_S390_GS_BC	0x30c
5356+#define NT_S390_RI_CB	0x30d
5357 #define NT_ARM_VFP	0x400
5358 #define NT_ARM_TLS	0x401
5359 #define NT_ARM_HW_BREAK	0x402
5360 #define NT_ARM_HW_WATCH	0x403
5361+#define NT_ARM_SYSTEM_CALL	0x404
5362+#define NT_ARM_SVE	0x405
5363+#define NT_ARM_PAC_MASK	0x406
5364 #define NT_METAG_CBUF	0x500
5365 #define NT_METAG_RPIPE	0x501
5366 #define NT_METAG_TLS	0x502
5367+#define NT_ARC_V2	0x600
5368+#define NT_VMCOREDD	0x700
5369+#define NT_MIPS_DSP	0x800
5370+#define NT_MIPS_FP_MODE	0x801
5371+#define NT_MIPS_MSA	0x802
5372 #define NT_VERSION	1
5373
5374
5375
5376
5377 typedef struct {
5378   Elf32_Sword d_tag;
5379   union {
5380@@ -596,17 +743,18 @@ typedef struct {
5381 #define	DT_FINI_ARRAY	26
5382 #define	DT_INIT_ARRAYSZ	27
5383 #define	DT_FINI_ARRAYSZ	28
5384 #define DT_RUNPATH	29
5385 #define DT_FLAGS	30
5386 #define DT_ENCODING	32
5387 #define DT_PREINIT_ARRAY 32
5388 #define DT_PREINIT_ARRAYSZ 33
5389-#define	DT_NUM		34
5390+#define DT_SYMTAB_SHNDX	34
5391+#define	DT_NUM		35
5392 #define DT_LOOS		0x6000000d
5393 #define DT_HIOS		0x6ffff000
5394 #define DT_LOPROC	0x70000000
5395 #define DT_HIPROC	0x7fffffff
5396 #define	DT_PROCNUM	DT_MIPS_NUM
5397
5398 #define DT_VALRNGLO	0x6ffffd00
5399 #define DT_GNU_PRELINKED 0x6ffffdf5
5400@@ -696,16 +844,18 @@ typedef struct {
5401 #define	DF_1_IGNMULDEF	0x00040000
5402 #define	DF_1_NOKSYMS	0x00080000
5403 #define	DF_1_NOHDR	0x00100000
5404 #define	DF_1_EDITED	0x00200000
5405 #define	DF_1_NORELOC	0x00400000
5406 #define	DF_1_SYMINTPOSE	0x00800000
5407 #define	DF_1_GLOBAUDIT	0x01000000
5408 #define	DF_1_SINGLETON	0x02000000
5409+#define	DF_1_STUB	0x04000000
5410+#define	DF_1_PIE	0x08000000
5411
5412 #define DTF_1_PARINIT	0x00000001
5413 #define DTF_1_CONFEXP	0x00000002
5414
5415
5416 #define DF_P1_LAZYLOAD	0x00000001
5417 #define DF_P1_GROUPPERM	0x00000002
5418
5419@@ -877,17 +1027,26 @@ typedef struct {
5420
5421
5422
5423 #define AT_L1I_CACHESHAPE	34
5424 #define AT_L1D_CACHESHAPE	35
5425 #define AT_L2_CACHESHAPE	36
5426 #define AT_L3_CACHESHAPE	37
5427
5428-
5429+#define AT_L1I_CACHESIZE	40
5430+#define AT_L1I_CACHEGEOMETRY	41
5431+#define AT_L1D_CACHESIZE	42
5432+#define AT_L1D_CACHEGEOMETRY	43
5433+#define AT_L2_CACHESIZE		44
5434+#define AT_L2_CACHEGEOMETRY	45
5435+#define AT_L3_CACHESIZE		46
5436+#define AT_L3_CACHEGEOMETRY	47
5437+
5438+#define AT_MINSIGSTKSZ		51
5439
5440
5441 typedef struct {
5442   Elf32_Word n_namesz;
5443   Elf32_Word n_descsz;
5444   Elf32_Word n_type;
5445 } Elf32_Nhdr;
5446
5447@@ -972,17 +1131,35 @@ typedef struct {
5448 #define R_68K_PLT8	15
5449 #define R_68K_PLT32O	16
5450 #define R_68K_PLT16O	17
5451 #define R_68K_PLT8O	18
5452 #define R_68K_COPY	19
5453 #define R_68K_GLOB_DAT	20
5454 #define R_68K_JMP_SLOT	21
5455 #define R_68K_RELATIVE	22
5456-#define R_68K_NUM	23
5457+#define R_68K_TLS_GD32	25
5458+#define R_68K_TLS_GD16	26
5459+#define R_68K_TLS_GD8	27
5460+#define R_68K_TLS_LDM32	28
5461+#define R_68K_TLS_LDM16	29
5462+#define R_68K_TLS_LDM8	30
5463+#define R_68K_TLS_LDO32	31
5464+#define R_68K_TLS_LDO16	32
5465+#define R_68K_TLS_LDO8	33
5466+#define R_68K_TLS_IE32	34
5467+#define R_68K_TLS_IE16	35
5468+#define R_68K_TLS_IE8	36
5469+#define R_68K_TLS_LE32	37
5470+#define R_68K_TLS_LE16	38
5471+#define R_68K_TLS_LE8	39
5472+#define R_68K_TLS_DTPMOD32	40
5473+#define R_68K_TLS_DTPREL32	41
5474+#define R_68K_TLS_TPREL32	42
5475+#define R_68K_NUM	43
5476
5477 #define R_386_NONE	   0
5478 #define R_386_32	   1
5479 #define R_386_PC32	   2
5480 #define R_386_GOT32	   3
5481 #define R_386_PLT32	   4
5482 #define R_386_COPY	   5
5483 #define R_386_GLOB_DAT	   6
5484@@ -1015,17 +1192,18 @@ typedef struct {
5485 #define R_386_TLS_DTPMOD32 35
5486 #define R_386_TLS_DTPOFF32 36
5487 #define R_386_TLS_TPOFF32  37
5488 #define R_386_SIZE32       38
5489 #define R_386_TLS_GOTDESC  39
5490 #define R_386_TLS_DESC_CALL 40
5491 #define R_386_TLS_DESC     41
5492 #define R_386_IRELATIVE	   42
5493-#define R_386_NUM	   43
5494+#define R_386_GOT32X	   43
5495+#define R_386_NUM	   44
5496
5497
5498
5499
5500
5501 #define STT_SPARC_REGISTER	13
5502
5503
5504@@ -1148,16 +1326,17 @@ typedef struct {
5505
5506 #define EF_MIPS_NOREORDER   1
5507 #define EF_MIPS_PIC	    2
5508 #define EF_MIPS_CPIC	    4
5509 #define EF_MIPS_XGOT	    8
5510 #define EF_MIPS_64BIT_WHIRL 16
5511 #define EF_MIPS_ABI2	    32
5512 #define EF_MIPS_ABI_ON32    64
5513+#define EF_MIPS_FP64	    512
5514 #define EF_MIPS_NAN2008     1024
5515 #define EF_MIPS_ARCH	    0xf0000000
5516
5517
5518
5519 #define EF_MIPS_ARCH_1	    0x00000000
5520 #define EF_MIPS_ARCH_2	    0x10000000
5521 #define EF_MIPS_ARCH_3	    0x20000000
5522@@ -1392,16 +1571,17 @@ typedef struct {
5523
5524 #define R_MIPS_NUM		128
5525
5526
5527
5528 #define PT_MIPS_REGINFO	0x70000000
5529 #define PT_MIPS_RTPROC  0x70000001
5530 #define PT_MIPS_OPTIONS 0x70000002
5531+#define PT_MIPS_ABIFLAGS 0x70000003
5532
5533
5534
5535 #define PF_MIPS_LOCAL	0x10000000
5536
5537
5538
5539 #define DT_MIPS_RLD_VERSION  0x70000001
5540@@ -1455,17 +1635,18 @@ typedef struct {
5541
5542 #define DT_MIPS_COMPACT_SIZE 0x7000002f
5543 #define DT_MIPS_GP_VALUE     0x70000030
5544 #define DT_MIPS_AUX_DYNAMIC  0x70000031
5545
5546 #define DT_MIPS_PLTGOT	     0x70000032
5547
5548 #define DT_MIPS_RWPLT        0x70000034
5549-#define DT_MIPS_NUM	     0x35
5550+#define DT_MIPS_RLD_MAP_REL  0x70000035
5551+#define DT_MIPS_NUM	     0x36
5552
5553
5554
5555 #define RHF_NONE		   0
5556 #define RHF_QUICKSTART		   (1 << 0)
5557 #define RHF_NOTPOT		   (1 << 1)
5558 #define RHF_NO_LIBRARY_REPLACEMENT (1 << 2)
5559 #define RHF_NO_MOVE		   (1 << 3)
5560@@ -1478,27 +1659,25 @@ typedef struct {
5561 #define RHF_REQUICKSTART	   (1 << 10)
5562 #define RHF_REQUICKSTARTED	   (1 << 11)
5563 #define RHF_CORD		   (1 << 12)
5564 #define RHF_NO_UNRES_UNDEF	   (1 << 13)
5565 #define RHF_RLD_ORDER_SAFE	   (1 << 14)
5566
5567
5568
5569-typedef struct
5570-{
5571+typedef struct {
5572   Elf32_Word l_name;
5573   Elf32_Word l_time_stamp;
5574   Elf32_Word l_checksum;
5575   Elf32_Word l_version;
5576   Elf32_Word l_flags;
5577 } Elf32_Lib;
5578
5579-typedef struct
5580-{
5581+typedef struct {
5582   Elf64_Word l_name;
5583   Elf64_Word l_time_stamp;
5584   Elf64_Word l_checksum;
5585   Elf64_Word l_version;
5586   Elf64_Word l_flags;
5587 } Elf64_Lib;
5588
5589
5590@@ -1511,17 +1690,83 @@ typedef struct
5591 #define LL_EXPORTS	  (1 << 3)
5592 #define LL_DELAY_LOAD	  (1 << 4)
5593 #define LL_DELTA	  (1 << 5)
5594
5595
5596
5597 typedef Elf32_Addr Elf32_Conflict;
5598
5599-
5600+typedef struct {
5601+  Elf32_Half version;
5602+  unsigned char isa_level;
5603+  unsigned char isa_rev;
5604+  unsigned char gpr_size;
5605+  unsigned char cpr1_size;
5606+  unsigned char cpr2_size;
5607+  unsigned char fp_abi;
5608+  Elf32_Word isa_ext;
5609+  Elf32_Word ases;
5610+  Elf32_Word flags1;
5611+  Elf32_Word flags2;
5612+} Elf_MIPS_ABIFlags_v0;
5613+
5614+#define MIPS_AFL_REG_NONE	0x00
5615+#define MIPS_AFL_REG_32		0x01
5616+#define MIPS_AFL_REG_64		0x02
5617+#define MIPS_AFL_REG_128	0x03
5618+
5619+#define MIPS_AFL_ASE_DSP	0x00000001
5620+#define MIPS_AFL_ASE_DSPR2	0x00000002
5621+#define MIPS_AFL_ASE_EVA	0x00000004
5622+#define MIPS_AFL_ASE_MCU	0x00000008
5623+#define MIPS_AFL_ASE_MDMX	0x00000010
5624+#define MIPS_AFL_ASE_MIPS3D	0x00000020
5625+#define MIPS_AFL_ASE_MT		0x00000040
5626+#define MIPS_AFL_ASE_SMARTMIPS	0x00000080
5627+#define MIPS_AFL_ASE_VIRT	0x00000100
5628+#define MIPS_AFL_ASE_MSA	0x00000200
5629+#define MIPS_AFL_ASE_MIPS16	0x00000400
5630+#define MIPS_AFL_ASE_MICROMIPS	0x00000800
5631+#define MIPS_AFL_ASE_XPA	0x00001000
5632+#define MIPS_AFL_ASE_MASK	0x00001fff
5633+
5634+#define MIPS_AFL_EXT_XLR	  1
5635+#define MIPS_AFL_EXT_OCTEON2	  2
5636+#define MIPS_AFL_EXT_OCTEONP	  3
5637+#define MIPS_AFL_EXT_LOONGSON_3A  4
5638+#define MIPS_AFL_EXT_OCTEON	  5
5639+#define MIPS_AFL_EXT_5900	  6
5640+#define MIPS_AFL_EXT_4650	  7
5641+#define MIPS_AFL_EXT_4010	  8
5642+#define MIPS_AFL_EXT_4100	  9
5643+#define MIPS_AFL_EXT_3900	  10
5644+#define MIPS_AFL_EXT_10000	  11
5645+#define MIPS_AFL_EXT_SB1	  12
5646+#define MIPS_AFL_EXT_4111	  13
5647+#define MIPS_AFL_EXT_4120	  14
5648+#define MIPS_AFL_EXT_5400	  15
5649+#define MIPS_AFL_EXT_5500	  16
5650+#define MIPS_AFL_EXT_LOONGSON_2E  17
5651+#define MIPS_AFL_EXT_LOONGSON_2F  18
5652+
5653+#define MIPS_AFL_FLAGS1_ODDSPREG  1
5654+
5655+enum
5656+{
5657+  Val_GNU_MIPS_ABI_FP_ANY = 0,
5658+  Val_GNU_MIPS_ABI_FP_DOUBLE = 1,
5659+  Val_GNU_MIPS_ABI_FP_SINGLE = 2,
5660+  Val_GNU_MIPS_ABI_FP_SOFT = 3,
5661+  Val_GNU_MIPS_ABI_FP_OLD_64 = 4,
5662+  Val_GNU_MIPS_ABI_FP_XX = 5,
5663+  Val_GNU_MIPS_ABI_FP_64 = 6,
5664+  Val_GNU_MIPS_ABI_FP_64A = 7,
5665+  Val_GNU_MIPS_ABI_FP_MAX = 7
5666+};
5667
5668
5669
5670
5671 #define EF_PARISC_TRAPNIL	0x00010000
5672 #define EF_PARISC_EXT		0x00020000
5673 #define EF_PARISC_LSB		0x00040000
5674 #define EF_PARISC_WIDE		0x00080000
5675@@ -1852,17 +2097,18 @@ typedef Elf32_Addr Elf32_Conflict;
5676 #define R_PPC_GOT_TPREL16	87
5677 #define R_PPC_GOT_TPREL16_LO	88
5678 #define R_PPC_GOT_TPREL16_HI	89
5679 #define R_PPC_GOT_TPREL16_HA	90
5680 #define R_PPC_GOT_DTPREL16	91
5681 #define R_PPC_GOT_DTPREL16_LO	92
5682 #define R_PPC_GOT_DTPREL16_HI	93
5683 #define R_PPC_GOT_DTPREL16_HA	94
5684-
5685+#define R_PPC_TLSGD		95
5686+#define R_PPC_TLSLD		96
5687
5688
5689 #define R_PPC_EMB_NADDR32	101
5690 #define R_PPC_EMB_NADDR16	102
5691 #define R_PPC_EMB_NADDR16_LO	103
5692 #define R_PPC_EMB_NADDR16_HI	104
5693 #define R_PPC_EMB_NADDR16_HA	105
5694 #define R_PPC_EMB_SDAI16	106
5695@@ -1895,17 +2141,20 @@ typedef Elf32_Addr Elf32_Conflict;
5696 #define R_PPC_REL16_HA		252
5697
5698
5699
5700 #define R_PPC_TOC16		255
5701
5702
5703 #define DT_PPC_GOT		(DT_LOPROC + 0)
5704-#define DT_PPC_NUM		1
5705+#define DT_PPC_OPT		(DT_LOPROC + 1)
5706+#define DT_PPC_NUM		2
5707+
5708+#define PPC_OPT_TLS		1
5709
5710
5711 #define R_PPC64_NONE		R_PPC_NONE
5712 #define R_PPC64_ADDR32		R_PPC_ADDR32
5713 #define R_PPC64_ADDR24		R_PPC_ADDR24
5714 #define R_PPC64_ADDR16		R_PPC_ADDR16
5715 #define R_PPC64_ADDR16_LO	R_PPC_ADDR16_LO
5716 #define R_PPC64_ADDR16_HI	R_PPC_ADDR16_HI
5717@@ -2008,33 +2257,49 @@ typedef Elf32_Addr Elf32_Conflict;
5718 #define R_PPC64_TPREL16_HIGHEST	99
5719 #define R_PPC64_TPREL16_HIGHESTA 100
5720 #define R_PPC64_DTPREL16_DS	101
5721 #define R_PPC64_DTPREL16_LO_DS	102
5722 #define R_PPC64_DTPREL16_HIGHER	103
5723 #define R_PPC64_DTPREL16_HIGHERA 104
5724 #define R_PPC64_DTPREL16_HIGHEST 105
5725 #define R_PPC64_DTPREL16_HIGHESTA 106
5726+#define R_PPC64_TLSGD		107
5727+#define R_PPC64_TLSLD		108
5728+#define R_PPC64_TOCSAVE		109
5729+#define R_PPC64_ADDR16_HIGH	110
5730+#define R_PPC64_ADDR16_HIGHA	111
5731+#define R_PPC64_TPREL16_HIGH	112
5732+#define R_PPC64_TPREL16_HIGHA	113
5733+#define R_PPC64_DTPREL16_HIGH	114
5734+#define R_PPC64_DTPREL16_HIGHA	115
5735
5736
5737 #define R_PPC64_JMP_IREL	247
5738 #define R_PPC64_IRELATIVE	248
5739 #define R_PPC64_REL16		249
5740 #define R_PPC64_REL16_LO	250
5741 #define R_PPC64_REL16_HI	251
5742 #define R_PPC64_REL16_HA	252
5743
5744+#define EF_PPC64_ABI	3
5745
5746 #define DT_PPC64_GLINK  (DT_LOPROC + 0)
5747 #define DT_PPC64_OPD	(DT_LOPROC + 1)
5748 #define DT_PPC64_OPDSZ	(DT_LOPROC + 2)
5749-#define DT_PPC64_NUM    3
5750-
5751-
5752-
5753+#define DT_PPC64_OPT	(DT_LOPROC + 3)
5754+#define DT_PPC64_NUM	4
5755+
5756+#define PPC64_OPT_TLS		1
5757+#define PPC64_OPT_MULTI_TOC	2
5758+#define PPC64_OPT_LOCALENTRY	4
5759+
5760+#define STO_PPC64_LOCAL_BIT	5
5761+#define STO_PPC64_LOCAL_MASK	0xe0
5762+#define PPC64_LOCAL_ENTRY_OFFSET(x) (1 << (((x)&0xe0)>>5) & 0xfc)
5763
5764
5765 #define EF_ARM_RELEXEC		0x01
5766 #define EF_ARM_HASENTRY		0x02
5767 #define EF_ARM_INTERWORK	0x04
5768 #define EF_ARM_APCS_26		0x08
5769 #define EF_ARM_APCS_FLOAT	0x10
5770 #define EF_ARM_PIC		0x20
5771@@ -2084,18 +2349,27 @@ typedef Elf32_Addr Elf32_Conflict;
5772
5773 #define PT_ARM_EXIDX		(PT_LOPROC + 1)
5774
5775
5776 #define SHT_ARM_EXIDX		(SHT_LOPROC + 1)
5777 #define SHT_ARM_PREEMPTMAP	(SHT_LOPROC + 2)
5778 #define SHT_ARM_ATTRIBUTES	(SHT_LOPROC + 3)
5779
5780-
5781 #define R_AARCH64_NONE            0
5782+#define R_AARCH64_P32_ABS32	1
5783+#define R_AARCH64_P32_COPY	180
5784+#define R_AARCH64_P32_GLOB_DAT	181
5785+#define R_AARCH64_P32_JUMP_SLOT	182
5786+#define R_AARCH64_P32_RELATIVE	183
5787+#define R_AARCH64_P32_TLS_DTPMOD 184
5788+#define R_AARCH64_P32_TLS_DTPREL 185
5789+#define R_AARCH64_P32_TLS_TPREL	186
5790+#define R_AARCH64_P32_TLSDESC	187
5791+#define R_AARCH64_P32_IRELATIVE	188
5792 #define R_AARCH64_ABS64         257
5793 #define R_AARCH64_ABS32         258
5794 #define R_AARCH64_ABS16		259
5795 #define R_AARCH64_PREL64	260
5796 #define R_AARCH64_PREL32	261
5797 #define R_AARCH64_PREL16	262
5798 #define R_AARCH64_MOVW_UABS_G0	263
5799 #define R_AARCH64_MOVW_UABS_G0_NC 264
5800@@ -2203,18 +2477,21 @@ typedef Elf32_Addr Elf32_Conflict;
5801 #define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570
5802 #define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571
5803 #define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572
5804 #define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573
5805 #define R_AARCH64_COPY         1024
5806 #define R_AARCH64_GLOB_DAT     1025
5807 #define R_AARCH64_JUMP_SLOT    1026
5808 #define R_AARCH64_RELATIVE     1027
5809+#define R_AARCH64_TLS_DTPMOD   1028
5810 #define R_AARCH64_TLS_DTPMOD64 1028
5811+#define R_AARCH64_TLS_DTPREL   1029
5812 #define R_AARCH64_TLS_DTPREL64 1029
5813+#define R_AARCH64_TLS_TPREL    1030
5814 #define R_AARCH64_TLS_TPREL64  1030
5815 #define R_AARCH64_TLSDESC      1031
5816
5817
5818 #define R_ARM_NONE		0
5819 #define R_ARM_PC24		1
5820 #define R_ARM_ABS32		2
5821 #define R_ARM_REL32		3
5822@@ -2342,16 +2619,71 @@ typedef Elf32_Addr Elf32_Conflict;
5823 #define R_ARM_RREL32		252
5824 #define R_ARM_RABS22		253
5825 #define R_ARM_RPC24		254
5826 #define R_ARM_RBASE		255
5827
5828 #define R_ARM_NUM		256
5829
5830
5831+#define R_CKCORE_NONE               0
5832+#define R_CKCORE_ADDR32             1
5833+#define R_CKCORE_PCRELIMM8BY4       2
5834+#define R_CKCORE_PCRELIMM11BY2      3
5835+#define R_CKCORE_PCREL32            5
5836+#define R_CKCORE_PCRELJSR_IMM11BY2  6
5837+#define R_CKCORE_RELATIVE           9
5838+#define R_CKCORE_COPY               10
5839+#define R_CKCORE_GLOB_DAT           11
5840+#define R_CKCORE_JUMP_SLOT          12
5841+#define R_CKCORE_GOTOFF             13
5842+#define R_CKCORE_GOTPC              14
5843+#define R_CKCORE_GOT32              15
5844+#define R_CKCORE_PLT32              16
5845+#define R_CKCORE_ADDRGOT            17
5846+#define R_CKCORE_ADDRPLT            18
5847+#define R_CKCORE_PCREL_IMM26BY2     19
5848+#define R_CKCORE_PCREL_IMM16BY2     20
5849+#define R_CKCORE_PCREL_IMM16BY4     21
5850+#define R_CKCORE_PCREL_IMM10BY2     22
5851+#define R_CKCORE_PCREL_IMM10BY4     23
5852+#define R_CKCORE_ADDR_HI16          24
5853+#define R_CKCORE_ADDR_LO16          25
5854+#define R_CKCORE_GOTPC_HI16         26
5855+#define R_CKCORE_GOTPC_LO16         27
5856+#define R_CKCORE_GOTOFF_HI16        28
5857+#define R_CKCORE_GOTOFF_LO16        29
5858+#define R_CKCORE_GOT12              30
5859+#define R_CKCORE_GOT_HI16           31
5860+#define R_CKCORE_GOT_LO16           32
5861+#define R_CKCORE_PLT12              33
5862+#define R_CKCORE_PLT_HI16           34
5863+#define R_CKCORE_PLT_LO16           35
5864+#define R_CKCORE_ADDRGOT_HI16       36
5865+#define R_CKCORE_ADDRGOT_LO16       37
5866+#define R_CKCORE_ADDRPLT_HI16       38
5867+#define R_CKCORE_ADDRPLT_LO16       39
5868+#define R_CKCORE_PCREL_JSR_IMM26BY2 40
5869+#define R_CKCORE_TOFFSET_LO16       41
5870+#define R_CKCORE_DOFFSET_LO16       42
5871+#define R_CKCORE_PCREL_IMM18BY2     43
5872+#define R_CKCORE_DOFFSET_IMM18      44
5873+#define R_CKCORE_DOFFSET_IMM18BY2   45
5874+#define R_CKCORE_DOFFSET_IMM18BY4   46
5875+#define R_CKCORE_GOT_IMM18BY4       48
5876+#define R_CKCORE_PLT_IMM18BY4       49
5877+#define R_CKCORE_PCREL_IMM7BY4      50
5878+#define R_CKCORE_TLS_LE32           51
5879+#define R_CKCORE_TLS_IE32           52
5880+#define R_CKCORE_TLS_GD32           53
5881+#define R_CKCORE_TLS_LDM32          54
5882+#define R_CKCORE_TLS_LDO32          55
5883+#define R_CKCORE_TLS_DTPMOD32       56
5884+#define R_CKCORE_TLS_DTPOFF32       57
5885+#define R_CKCORE_TLS_TPOFF32        58
5886
5887
5888 #define EF_IA_64_MASKOS		0x0000000f
5889 #define EF_IA_64_ABI64		0x00000010
5890 #define EF_IA_64_ARCH		0xff000000
5891
5892
5893 #define PT_IA_64_ARCHEXT	(PT_LOPROC + 0)
5894@@ -2454,17 +2786,38 @@ typedef Elf32_Addr Elf32_Conflict;
5895 #define R_IA64_DTPREL64I	0xb3
5896 #define R_IA64_DTPREL32MSB	0xb4
5897 #define R_IA64_DTPREL32LSB	0xb5
5898 #define R_IA64_DTPREL64MSB	0xb6
5899 #define R_IA64_DTPREL64LSB	0xb7
5900 #define R_IA64_LTOFF_DTPREL22	0xba
5901
5902
5903-
5904+#define EF_SH_MACH_MASK		0x1f
5905+#define EF_SH_UNKNOWN		0x0
5906+#define EF_SH1			0x1
5907+#define EF_SH2			0x2
5908+#define EF_SH3			0x3
5909+#define EF_SH_DSP		0x4
5910+#define EF_SH3_DSP		0x5
5911+#define EF_SH4AL_DSP		0x6
5912+#define EF_SH3E			0x8
5913+#define EF_SH4			0x9
5914+#define EF_SH2E			0xb
5915+#define EF_SH4A			0xc
5916+#define EF_SH2A			0xd
5917+#define EF_SH4_NOFPU		0x10
5918+#define EF_SH4A_NOFPU		0x11
5919+#define EF_SH4_NOMMU_NOFPU	0x12
5920+#define EF_SH2A_NOFPU		0x13
5921+#define EF_SH3_NOMMU		0x14
5922+#define EF_SH2A_SH4_NOFPU	0x15
5923+#define EF_SH2A_SH3_NOFPU	0x16
5924+#define EF_SH2A_SH4		0x17
5925+#define EF_SH2A_SH3E		0x18
5926
5927 #define	R_SH_NONE		0
5928 #define	R_SH_DIR32		1
5929 #define	R_SH_REL32		2
5930 #define	R_SH_DIR8WPN		3
5931 #define	R_SH_IND12W		4
5932 #define	R_SH_DIR8WPL		5
5933 #define	R_SH_DIR8WPZ		6
5934@@ -2660,17 +3013,19 @@ typedef Elf32_Addr Elf32_Conflict;
5935 #define R_X86_64_SIZE64		33
5936
5937 #define R_X86_64_GOTPC32_TLSDESC 34
5938 #define R_X86_64_TLSDESC_CALL   35
5939
5940 #define R_X86_64_TLSDESC        36
5941 #define R_X86_64_IRELATIVE	37
5942 #define R_X86_64_RELATIVE64	38
5943-#define R_X86_64_NUM		39
5944+#define R_X86_64_GOTPCRELX	41
5945+#define R_X86_64_REX_GOTPCRELX	42
5946+#define R_X86_64_NUM		43
5947
5948
5949
5950 #define R_MN10300_NONE		0
5951 #define R_MN10300_32		1
5952 #define R_MN10300_16		2
5953 #define R_MN10300_8		3
5954 #define R_MN10300_PCREL32	4
5955@@ -2778,16 +3133,65 @@ typedef Elf32_Addr Elf32_Conflict;
5956 #define R_MICROBLAZE_TLSGD 23
5957 #define R_MICROBLAZE_TLSLD 24
5958 #define R_MICROBLAZE_TLSDTPMOD32 25
5959 #define R_MICROBLAZE_TLSDTPREL32 26
5960 #define R_MICROBLAZE_TLSDTPREL64 27
5961 #define R_MICROBLAZE_TLSGOTTPREL32 28
5962 #define R_MICROBLAZE_TLSTPREL32	 29
5963
5964+#define DT_NIOS2_GP             0x70000002
5965+
5966+#define R_NIOS2_NONE		0
5967+#define R_NIOS2_S16		1
5968+#define R_NIOS2_U16		2
5969+#define R_NIOS2_PCREL16		3
5970+#define R_NIOS2_CALL26		4
5971+#define R_NIOS2_IMM5		5
5972+#define R_NIOS2_CACHE_OPX	6
5973+#define R_NIOS2_IMM6		7
5974+#define R_NIOS2_IMM8		8
5975+#define R_NIOS2_HI16		9
5976+#define R_NIOS2_LO16		10
5977+#define R_NIOS2_HIADJ16		11
5978+#define R_NIOS2_BFD_RELOC_32	12
5979+#define R_NIOS2_BFD_RELOC_16	13
5980+#define R_NIOS2_BFD_RELOC_8	14
5981+#define R_NIOS2_GPREL		15
5982+#define R_NIOS2_GNU_VTINHERIT	16
5983+#define R_NIOS2_GNU_VTENTRY	17
5984+#define R_NIOS2_UJMP		18
5985+#define R_NIOS2_CJMP		19
5986+#define R_NIOS2_CALLR		20
5987+#define R_NIOS2_ALIGN		21
5988+#define R_NIOS2_GOT16		22
5989+#define R_NIOS2_CALL16		23
5990+#define R_NIOS2_GOTOFF_LO	24
5991+#define R_NIOS2_GOTOFF_HA	25
5992+#define R_NIOS2_PCREL_LO	26
5993+#define R_NIOS2_PCREL_HA	27
5994+#define R_NIOS2_TLS_GD16	28
5995+#define R_NIOS2_TLS_LDM16	29
5996+#define R_NIOS2_TLS_LDO16	30
5997+#define R_NIOS2_TLS_IE16	31
5998+#define R_NIOS2_TLS_LE16	32
5999+#define R_NIOS2_TLS_DTPMOD	33
6000+#define R_NIOS2_TLS_DTPREL	34
6001+#define R_NIOS2_TLS_TPREL	35
6002+#define R_NIOS2_COPY		36
6003+#define R_NIOS2_GLOB_DAT	37
6004+#define R_NIOS2_JUMP_SLOT	38
6005+#define R_NIOS2_RELATIVE	39
6006+#define R_NIOS2_GOTOFF		40
6007+#define R_NIOS2_CALL26_NOAT	41
6008+#define R_NIOS2_GOT_LO		42
6009+#define R_NIOS2_GOT_HA		43
6010+#define R_NIOS2_CALL_LO		44
6011+#define R_NIOS2_CALL_HA		45
6012+
6013 #define R_OR1K_NONE		0
6014 #define R_OR1K_32		1
6015 #define R_OR1K_16		2
6016 #define R_OR1K_8		3
6017 #define R_OR1K_LO_16_IN_INSN	4
6018 #define R_OR1K_HI_16_IN_INSN	5
6019 #define R_OR1K_INSN_REL_26	6
6020 #define R_OR1K_GNU_VTENTRY	7
6021@@ -2814,14 +3218,17 @@ typedef Elf32_Addr Elf32_Conflict;
6022 #define R_OR1K_TLS_IE_HI16	28
6023 #define R_OR1K_TLS_IE_LO16	29
6024 #define R_OR1K_TLS_LE_HI16	30
6025 #define R_OR1K_TLS_LE_LO16	31
6026 #define R_OR1K_TLS_TPOFF	32
6027 #define R_OR1K_TLS_DTPOFF	33
6028 #define R_OR1K_TLS_DTPMOD	34
6029
6030+#define R_BPF_NONE		0
6031+#define R_BPF_MAP_FD		1
6032+
6033 #ifdef __cplusplus
6034 }
6035 #endif
6036
6037
6038 #endif
6039
6040