mirror of
				https://github.com/KartKrewDev/RingRacers.git
				synced 2025-10-30 08:01:28 +00:00 
			
		
		
		
	Support for http downloads
This commit is contained in:
		
							parent
							
								
									564fa58c77
								
							
						
					
					
						commit
						5e0eca9fe9
					
				
					 26 changed files with 2798 additions and 876 deletions
				
			
		
							
								
								
									
										19
									
								
								.travis.yml
									
										
									
									
									
								
							
							
						
						
									
										19
									
								
								.travis.yml
									
										
									
									
									
								
							|  | @ -23,6 +23,7 @@ matrix: | |||
|               - libpng-dev | ||||
|               - libgl1-mesa-dev | ||||
|               - libgme-dev | ||||
|               - libcurl4-openssl-dev | ||||
|               - p7zip-full | ||||
|               - gcc-4.4 | ||||
|           compiler: gcc-4.4 | ||||
|  | @ -37,6 +38,7 @@ matrix: | |||
|               - libpng-dev | ||||
|               - libgl1-mesa-dev | ||||
|               - libgme-dev | ||||
|               - libcurl4-openssl-dev | ||||
|               - p7zip-full | ||||
|               - gcc-4.6 | ||||
|           compiler: gcc-4.6 | ||||
|  | @ -51,6 +53,7 @@ matrix: | |||
|               - libpng-dev | ||||
|               - libgl1-mesa-dev | ||||
|               - libgme-dev | ||||
|               - libcurl4-openssl-dev | ||||
|               - p7zip-full | ||||
|               - gcc-4.7 | ||||
|           compiler: gcc-4.7 | ||||
|  | @ -72,6 +75,7 @@ matrix: | |||
|               - libpng-dev | ||||
|               - libgl1-mesa-dev | ||||
|               - libgme-dev | ||||
|               - libcurl4-openssl-dev | ||||
|               - p7zip-full | ||||
|               - gcc-4.8 | ||||
|           compiler: gcc-4.8 | ||||
|  | @ -88,6 +92,7 @@ matrix: | |||
|               - libpng-dev | ||||
|               - libgl1-mesa-dev | ||||
|               - libgme-dev | ||||
|               - libcurl4-openssl-dev | ||||
|               - p7zip-full | ||||
|               - gcc-7 | ||||
|           compiler: gcc-7 | ||||
|  | @ -104,6 +109,7 @@ matrix: | |||
|               - libpng-dev | ||||
|               - libgl1-mesa-dev | ||||
|               - libgme-dev | ||||
|               - libcurl4-openssl-dev | ||||
|               - p7zip-full | ||||
|               - gcc-8 | ||||
|           compiler: gcc-8 | ||||
|  | @ -124,6 +130,7 @@ matrix: | |||
|               - libpng-dev | ||||
|               - libgl1-mesa-dev | ||||
|               - libgme-dev | ||||
|               - libcurl4-openssl-dev | ||||
|               - p7zip-full | ||||
|               - clang-3.5 | ||||
|           compiler: clang-3.5 | ||||
|  | @ -140,6 +147,7 @@ matrix: | |||
|               - libpng-dev | ||||
|               - libgl1-mesa-dev | ||||
|               - libgme-dev | ||||
|               - libcurl4-openssl-dev | ||||
|               - p7zip-full | ||||
|               - clang-3.6 | ||||
|           compiler: clang-3.6 | ||||
|  | @ -156,6 +164,7 @@ matrix: | |||
|               - libpng-dev | ||||
|               - libgl1-mesa-dev | ||||
|               - libgme-dev | ||||
|               - libcurl4-openssl-dev | ||||
|               - p7zip-full | ||||
|               - clang-3.7 | ||||
|           compiler: clang-3.7 | ||||
|  | @ -172,6 +181,7 @@ matrix: | |||
|               - libpng-dev | ||||
|               - libgl1-mesa-dev | ||||
|               - libgme-dev | ||||
|               - libcurl4-openssl-dev | ||||
|               - p7zip-full | ||||
|               - clang-3.8 | ||||
|           compiler: clang-3.8 | ||||
|  | @ -188,6 +198,7 @@ matrix: | |||
|               - libpng-dev | ||||
|               - libgl1-mesa-dev | ||||
|               - libgme-dev | ||||
|               - libcurl4-openssl-dev | ||||
|               - p7zip-full | ||||
|               - clang-3.9 | ||||
|           compiler: clang-3.9 | ||||
|  | @ -294,6 +305,7 @@ matrix: | |||
|               - libpng-dev | ||||
|               - libgl1-mesa-dev | ||||
|               - libgme-dev | ||||
|               - libcurl4-openssl-dev | ||||
|               - p7zip-full | ||||
|               - gcc-4.8 | ||||
|           compiler: gcc-4.8 | ||||
|  | @ -435,6 +447,7 @@ matrix: | |||
|               - libpng-dev | ||||
|               - libgl1-mesa-dev | ||||
|               - libgme-dev | ||||
|               - libcurl4-openssl-dev | ||||
|               - p7zip-full | ||||
|               - gcc-4.8 | ||||
|           compiler: gcc-4.8 | ||||
|  | @ -458,6 +471,7 @@ matrix: | |||
|               - libpng-dev | ||||
|               - libgl1-mesa-dev | ||||
|               - libgme-dev | ||||
|               - libcurl4-openssl-dev | ||||
|               - p7zip-full | ||||
|               - gcc-4.8 | ||||
|           compiler: gcc-4.8 | ||||
|  | @ -481,6 +495,7 @@ matrix: | |||
|               - libpng-dev | ||||
|               - libgl1-mesa-dev | ||||
|               - libgme-dev | ||||
|               - libcurl4-openssl-dev | ||||
|               - p7zip-full | ||||
|               - gcc-4.8 | ||||
|           compiler: gcc-4.8 | ||||
|  | @ -504,6 +519,7 @@ matrix: | |||
|               - libpng-dev | ||||
|               - libgl1-mesa-dev | ||||
|               - libgme-dev | ||||
|               - libcurl4-openssl-dev | ||||
|               - p7zip-full | ||||
|               - gcc-4.8 | ||||
|           compiler: gcc-4.8 | ||||
|  | @ -527,6 +543,7 @@ matrix: | |||
|               - libpng-dev | ||||
|               - libgl1-mesa-dev | ||||
|               - libgme-dev | ||||
|               - libcurl4-openssl-dev | ||||
|               - p7zip-full | ||||
|               - gcc-4.8 | ||||
|           compiler: gcc-4.8 | ||||
|  | @ -567,6 +584,7 @@ addons: | |||
|     - libgl1-mesa-dev | ||||
|     - libgme-dev | ||||
|     - zlib1g-dev | ||||
|     - libcurl4-openssl-dev | ||||
|     - p7zip-full | ||||
|   homebrew: | ||||
|     taps: | ||||
|  | @ -576,6 +594,7 @@ addons: | |||
|     - game-music-emu | ||||
|     - p7zip | ||||
|     - cmake | ||||
|     - curl | ||||
|     update: true | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ Build-Depends: debhelper (>= 7.0.50~), | |||
|  libpng-dev | libpng16-dev | libpng12-dev (>= 1.2.7), | ||||
|  zlib1g-dev, | ||||
|  libgme-dev, | ||||
|  libcurl4-openssl-dev, | ||||
|  libglu1-dev | libglu-dev, | ||||
|  libosmesa6-dev | libgl-dev, | ||||
|  nasm [i386] | ||||
|  |  | |||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							|  | @ -1,5 +1,5 @@ | |||
| #ifndef __CURL_CURLVER_H | ||||
| #define __CURL_CURLVER_H | ||||
| #ifndef CURLINC_CURLVER_H | ||||
| #define CURLINC_CURLVER_H | ||||
| /***************************************************************************
 | ||||
|  *                                  _   _ ____  _ | ||||
|  *  Project                     ___| | | |  _ \| | | ||||
|  | @ -7,11 +7,11 @@ | |||
|  *                            | (__| |_| |  _ <| |___ | ||||
|  *                             \___|\___/|_| \_\_____| | ||||
|  * | ||||
|  * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. | ||||
|  * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. | ||||
|  * | ||||
|  * This software is licensed as described in the file COPYING, which | ||||
|  * you should have received as part of this distribution. The terms | ||||
|  * are also available at http://curl.haxx.se/docs/copyright.html.
 | ||||
|  * are also available at https://curl.haxx.se/docs/copyright.html.
 | ||||
|  * | ||||
|  * You may opt to use, copy, modify, merge, publish, distribute and/or sell | ||||
|  * copies of the Software, and permit persons to whom the Software is | ||||
|  | @ -26,17 +26,17 @@ | |||
|    a script at release-time. This was made its own header file in 7.11.2 */ | ||||
| 
 | ||||
| /* This is the global package copyright */ | ||||
| #define LIBCURL_COPYRIGHT "1996 - 2011 Daniel Stenberg, <daniel@haxx.se>." | ||||
| #define LIBCURL_COPYRIGHT "1996 - 2020 Daniel Stenberg, <daniel@haxx.se>." | ||||
| 
 | ||||
| /* This is the version number of the libcurl package from which this header
 | ||||
|    file origins: */ | ||||
| #define LIBCURL_VERSION "7.21.6" | ||||
| #define LIBCURL_VERSION "7.69.0" | ||||
| 
 | ||||
| /* The numeric version number is also available "in parts" by using these
 | ||||
|    defines: */ | ||||
| #define LIBCURL_VERSION_MAJOR 7 | ||||
| #define LIBCURL_VERSION_MINOR 21 | ||||
| #define LIBCURL_VERSION_PATCH 6 | ||||
| #define LIBCURL_VERSION_MINOR 69 | ||||
| #define LIBCURL_VERSION_PATCH 0 | ||||
| 
 | ||||
| /* This is the numeric version of the libcurl version number, meant for easier
 | ||||
|    parsing and comparions by programs. The LIBCURL_VERSION_NUM define will | ||||
|  | @ -52,18 +52,26 @@ | |||
|    This 6-digit (24 bits) hexadecimal number does not show pre-release number, | ||||
|    and it is always a greater number in a more recent release. It makes | ||||
|    comparisons with greater than and less than work. | ||||
| 
 | ||||
|    Note: This define is the full hex number and _does not_ use the | ||||
|    CURL_VERSION_BITS() macro since curl's own configure script greps for it | ||||
|    and needs it to contain the full number. | ||||
| */ | ||||
| #define LIBCURL_VERSION_NUM 0x071506 | ||||
| #define LIBCURL_VERSION_NUM 0x074500 | ||||
| 
 | ||||
| /*
 | ||||
|  * This is the date and time when the full source package was created. The | ||||
|  * timestamp is not stored in git, as the timestamp is properly set in the | ||||
|  * tarballs by the maketgz script. | ||||
|  * | ||||
|  * The format of the date should follow this template: | ||||
|  * The format of the date follows this template: | ||||
|  * | ||||
|  * "Mon Feb 12 11:35:33 UTC 2007" | ||||
|  * "2007-11-23" | ||||
|  */ | ||||
| #define LIBCURL_TIMESTAMP "Fri Apr 22 17:18:50 UTC 2011" | ||||
| #define LIBCURL_TIMESTAMP "2020-03-04" | ||||
| 
 | ||||
| #endif /* __CURL_CURLVER_H */ | ||||
| #define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z)) | ||||
| #define CURL_AT_LEAST_VERSION(x,y,z) \ | ||||
|   (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z)) | ||||
| 
 | ||||
| #endif /* CURLINC_CURLVER_H */ | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| #ifndef __CURL_EASY_H | ||||
| #define __CURL_EASY_H | ||||
| #ifndef CURLINC_EASY_H | ||||
| #define CURLINC_EASY_H | ||||
| /***************************************************************************
 | ||||
|  *                                  _   _ ____  _ | ||||
|  *  Project                     ___| | | |  _ \| | | ||||
|  | @ -7,11 +7,11 @@ | |||
|  *                            | (__| |_| |  _ <| |___ | ||||
|  *                             \___|\___/|_| \_\_____| | ||||
|  * | ||||
|  * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. | ||||
|  * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. | ||||
|  * | ||||
|  * This software is licensed as described in the file COPYING, which | ||||
|  * you should have received as part of this distribution. The terms | ||||
|  * are also available at http://curl.haxx.se/docs/copyright.html.
 | ||||
|  * are also available at https://curl.haxx.se/docs/copyright.html.
 | ||||
|  * | ||||
|  * You may opt to use, copy, modify, merge, publish, distribute and/or sell | ||||
|  * copies of the Software, and permit persons to whom the Software is | ||||
|  | @ -58,7 +58,7 @@ CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); | |||
|  * curl_easy_duphandle() for each new thread to avoid a series of identical | ||||
|  * curl_easy_setopt() invokes in every thread. | ||||
|  */ | ||||
| CURL_EXTERN CURL* curl_easy_duphandle(CURL *curl); | ||||
| CURL_EXTERN CURL *curl_easy_duphandle(CURL *curl); | ||||
| 
 | ||||
| /*
 | ||||
|  * NAME curl_easy_reset() | ||||
|  | @ -95,6 +95,16 @@ CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, | |||
| CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer, | ||||
|                                     size_t buflen, size_t *n); | ||||
| 
 | ||||
| 
 | ||||
| /*
 | ||||
|  * NAME curl_easy_upkeep() | ||||
|  * | ||||
|  * DESCRIPTION | ||||
|  * | ||||
|  * Performs connection upkeep for the given session handle. | ||||
|  */ | ||||
| CURL_EXTERN CURLcode curl_easy_upkeep(CURL *curl); | ||||
| 
 | ||||
| #ifdef  __cplusplus | ||||
| } | ||||
| #endif | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| #ifndef __CURL_MPRINTF_H | ||||
| #define __CURL_MPRINTF_H | ||||
| #ifndef CURLINC_MPRINTF_H | ||||
| #define CURLINC_MPRINTF_H | ||||
| /***************************************************************************
 | ||||
|  *                                  _   _ ____  _ | ||||
|  *  Project                     ___| | | |  _ \| | | ||||
|  | @ -7,11 +7,11 @@ | |||
|  *                            | (__| |_| |  _ <| |___ | ||||
|  *                             \___|\___/|_| \_\_____| | ||||
|  * | ||||
|  * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al. | ||||
|  * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. | ||||
|  * | ||||
|  * This software is licensed as described in the file COPYING, which | ||||
|  * you should have received as part of this distribution. The terms | ||||
|  * are also available at http://curl.haxx.se/docs/copyright.html.
 | ||||
|  * are also available at https://curl.haxx.se/docs/copyright.html.
 | ||||
|  * | ||||
|  * You may opt to use, copy, modify, merge, publish, distribute and/or sell | ||||
|  * copies of the Software, and permit persons to whom the Software is | ||||
|  | @ -24,8 +24,7 @@ | |||
| 
 | ||||
| #include <stdarg.h> | ||||
| #include <stdio.h> /* needed for FILE */ | ||||
| 
 | ||||
| #include "curl.h" | ||||
| #include "curl.h"  /* for CURL_EXTERN */ | ||||
| 
 | ||||
| #ifdef  __cplusplus | ||||
| extern "C" { | ||||
|  | @ -44,38 +43,8 @@ CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength, | |||
| CURL_EXTERN char *curl_maprintf(const char *format, ...); | ||||
| CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args); | ||||
| 
 | ||||
| #ifdef _MPRINTF_REPLACE | ||||
| # undef printf | ||||
| # undef fprintf | ||||
| # undef sprintf | ||||
| # undef vsprintf | ||||
| # undef snprintf | ||||
| # undef vprintf | ||||
| # undef vfprintf | ||||
| # undef vsnprintf | ||||
| # undef aprintf | ||||
| # undef vaprintf | ||||
| # define printf curl_mprintf | ||||
| # define fprintf curl_mfprintf | ||||
| #ifdef CURLDEBUG | ||||
| /* When built with CURLDEBUG we define away the sprintf() functions since we
 | ||||
|    don't want internal code to be using them */ | ||||
| # define sprintf sprintf_was_used | ||||
| # define vsprintf vsprintf_was_used | ||||
| #else | ||||
| # define sprintf curl_msprintf | ||||
| # define vsprintf curl_mvsprintf | ||||
| #endif | ||||
| # define snprintf curl_msnprintf | ||||
| # define vprintf curl_mvprintf | ||||
| # define vfprintf curl_mvfprintf | ||||
| # define vsnprintf curl_mvsnprintf | ||||
| # define aprintf curl_maprintf | ||||
| # define vaprintf curl_mvaprintf | ||||
| #endif | ||||
| 
 | ||||
| #ifdef  __cplusplus | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
| #endif /* __CURL_MPRINTF_H */ | ||||
| #endif /* CURLINC_MPRINTF_H */ | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| #ifndef __CURL_MULTI_H | ||||
| #define __CURL_MULTI_H | ||||
| #ifndef CURLINC_MULTI_H | ||||
| #define CURLINC_MULTI_H | ||||
| /***************************************************************************
 | ||||
|  *                                  _   _ ____  _ | ||||
|  *  Project                     ___| | | |  _ \| | | ||||
|  | @ -7,11 +7,11 @@ | |||
|  *                            | (__| |_| |  _ <| |___ | ||||
|  *                             \___|\___/|_| \_\_____| | ||||
|  * | ||||
|  * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al. | ||||
|  * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. | ||||
|  * | ||||
|  * This software is licensed as described in the file COPYING, which | ||||
|  * you should have received as part of this distribution. The terms | ||||
|  * are also available at http://curl.haxx.se/docs/copyright.html.
 | ||||
|  * are also available at https://curl.haxx.se/docs/copyright.html.
 | ||||
|  * | ||||
|  * You may opt to use, copy, modify, merge, publish, distribute and/or sell | ||||
|  * copies of the Software, and permit persons to whom the Software is | ||||
|  | @ -52,7 +52,11 @@ | |||
| extern "C" { | ||||
| #endif | ||||
| 
 | ||||
| #if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER) | ||||
| typedef struct Curl_multi CURLM; | ||||
| #else | ||||
| typedef void CURLM; | ||||
| #endif | ||||
| 
 | ||||
| typedef enum { | ||||
|   CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or
 | ||||
|  | @ -64,6 +68,12 @@ typedef enum { | |||
|   CURLM_INTERNAL_ERROR,  /* this is a libcurl bug */ | ||||
|   CURLM_BAD_SOCKET,      /* the passed in socket argument did not match */ | ||||
|   CURLM_UNKNOWN_OPTION,  /* curl_multi_setopt() with unsupported option */ | ||||
|   CURLM_ADDED_ALREADY,   /* an easy handle already added to a multi handle was
 | ||||
|                             attempted to get added - again */ | ||||
|   CURLM_RECURSIVE_API_CALL, /* an api function was called from inside a
 | ||||
|                                callback */ | ||||
|   CURLM_WAKEUP_FAILURE,  /* wakeup is unavailable or failed */ | ||||
|   CURLM_BAD_FUNCTION_ARGUMENT,  /* function called with a bad parameter */ | ||||
|   CURLM_LAST | ||||
| } CURLMcode; | ||||
| 
 | ||||
|  | @ -72,6 +82,11 @@ typedef enum { | |||
|    curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */ | ||||
| #define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM | ||||
| 
 | ||||
| /* bitmask bits for CURLMOPT_PIPELINING */ | ||||
| #define CURLPIPE_NOTHING   0L | ||||
| #define CURLPIPE_HTTP1     1L | ||||
| #define CURLPIPE_MULTIPLEX 2L | ||||
| 
 | ||||
| typedef enum { | ||||
|   CURLMSG_NONE, /* first, not used */ | ||||
|   CURLMSG_DONE, /* This easy handle has completed. 'result' contains
 | ||||
|  | @ -89,6 +104,19 @@ struct CURLMsg { | |||
| }; | ||||
| typedef struct CURLMsg CURLMsg; | ||||
| 
 | ||||
| /* Based on poll(2) structure and values.
 | ||||
|  * We don't use pollfd and POLL* constants explicitly | ||||
|  * to cover platforms without poll(). */ | ||||
| #define CURL_WAIT_POLLIN    0x0001 | ||||
| #define CURL_WAIT_POLLPRI   0x0002 | ||||
| #define CURL_WAIT_POLLOUT   0x0004 | ||||
| 
 | ||||
| struct curl_waitfd { | ||||
|   curl_socket_t fd; | ||||
|   short events; | ||||
|   short revents; /* not supported yet */ | ||||
| }; | ||||
| 
 | ||||
| /*
 | ||||
|  * Name:    curl_multi_init() | ||||
|  * | ||||
|  | @ -133,6 +161,43 @@ CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle, | |||
|                                        fd_set *exc_fd_set, | ||||
|                                        int *max_fd); | ||||
| 
 | ||||
| /*
 | ||||
|  * Name:     curl_multi_wait() | ||||
|  * | ||||
|  * Desc:     Poll on all fds within a CURLM set as well as any | ||||
|  *           additional fds passed to the function. | ||||
|  * | ||||
|  * Returns:  CURLMcode type, general multi error code. | ||||
|  */ | ||||
| CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle, | ||||
|                                       struct curl_waitfd extra_fds[], | ||||
|                                       unsigned int extra_nfds, | ||||
|                                       int timeout_ms, | ||||
|                                       int *ret); | ||||
| 
 | ||||
| /*
 | ||||
|  * Name:     curl_multi_poll() | ||||
|  * | ||||
|  * Desc:     Poll on all fds within a CURLM set as well as any | ||||
|  *           additional fds passed to the function. | ||||
|  * | ||||
|  * Returns:  CURLMcode type, general multi error code. | ||||
|  */ | ||||
| CURL_EXTERN CURLMcode curl_multi_poll(CURLM *multi_handle, | ||||
|                                       struct curl_waitfd extra_fds[], | ||||
|                                       unsigned int extra_nfds, | ||||
|                                       int timeout_ms, | ||||
|                                       int *ret); | ||||
| 
 | ||||
| /*
 | ||||
|  * Name:     curl_multi_wakeup() | ||||
|  * | ||||
|  * Desc:     wakes up a sleeping curl_multi_poll call. | ||||
|  * | ||||
|  * Returns:  CURLMcode type, general multi error code. | ||||
|  */ | ||||
| CURL_EXTERN CURLMcode curl_multi_wakeup(CURLM *multi_handle); | ||||
| 
 | ||||
|  /*
 | ||||
|   * Name:    curl_multi_perform() | ||||
|   * | ||||
|  | @ -146,8 +211,8 @@ CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle, | |||
|   * | ||||
|   * Returns: CURLMcode type, general multi error code. *NOTE* that this only | ||||
|   *          returns errors etc regarding the whole multi stack. There might | ||||
|   *          still have occurred problems on invidual transfers even when this | ||||
|   *          returns OK. | ||||
|   *          still have occurred problems on individual transfers even when | ||||
|   *          this returns OK. | ||||
|   */ | ||||
| CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle, | ||||
|                                          int *running_handles); | ||||
|  | @ -180,7 +245,7 @@ CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle); | |||
|  *          curl_multi_cleanup(). | ||||
|  * | ||||
|  *          The 'CURLMsg' struct is meant to be very simple and only contain | ||||
|  *          very basic informations. If more involved information is wanted, | ||||
|  *          very basic information. If more involved information is wanted, | ||||
|  *          we will provide the particular "transfer handle" in that struct | ||||
|  *          and that should/could/would be used in subsequent | ||||
|  *          curl_easy_getinfo() calls (or similar). The point being that we | ||||
|  | @ -279,37 +344,58 @@ CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle, | |||
| CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle, | ||||
|                                          long *milliseconds); | ||||
| 
 | ||||
| #undef CINIT /* re-using the same name as in curl.h */ | ||||
| 
 | ||||
| #ifdef CURL_ISOCPP | ||||
| #define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num | ||||
| #else | ||||
| /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ | ||||
| #define LONG          CURLOPTTYPE_LONG | ||||
| #define OBJECTPOINT   CURLOPTTYPE_OBJECTPOINT | ||||
| #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT | ||||
| #define OFF_T         CURLOPTTYPE_OFF_T | ||||
| #define CINIT(name,type,number) CURLMOPT_/**/name = type + number | ||||
| #endif | ||||
| 
 | ||||
| typedef enum { | ||||
|   /* This is the socket callback function pointer */ | ||||
|   CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1), | ||||
|   CURLOPT(CURLMOPT_SOCKETFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 1), | ||||
| 
 | ||||
|   /* This is the argument passed to the socket callback */ | ||||
|   CINIT(SOCKETDATA, OBJECTPOINT, 2), | ||||
|   CURLOPT(CURLMOPT_SOCKETDATA, CURLOPTTYPE_OBJECTPOINT, 2), | ||||
| 
 | ||||
|     /* set to 1 to enable pipelining for this multi handle */ | ||||
|   CINIT(PIPELINING, LONG, 3), | ||||
|   CURLOPT(CURLMOPT_PIPELINING, CURLOPTTYPE_LONG, 3), | ||||
| 
 | ||||
|    /* This is the timer callback function pointer */ | ||||
|   CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4), | ||||
|   CURLOPT(CURLMOPT_TIMERFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 4), | ||||
| 
 | ||||
|   /* This is the argument passed to the timer callback */ | ||||
|   CINIT(TIMERDATA, OBJECTPOINT, 5), | ||||
|   CURLOPT(CURLMOPT_TIMERDATA, CURLOPTTYPE_OBJECTPOINT, 5), | ||||
| 
 | ||||
|   /* maximum number of entries in the connection cache */ | ||||
|   CINIT(MAXCONNECTS, LONG, 6), | ||||
|   CURLOPT(CURLMOPT_MAXCONNECTS, CURLOPTTYPE_LONG, 6), | ||||
| 
 | ||||
|   /* maximum number of (pipelining) connections to one host */ | ||||
|   CURLOPT(CURLMOPT_MAX_HOST_CONNECTIONS, CURLOPTTYPE_LONG, 7), | ||||
| 
 | ||||
|   /* maximum number of requests in a pipeline */ | ||||
|   CURLOPT(CURLMOPT_MAX_PIPELINE_LENGTH, CURLOPTTYPE_LONG, 8), | ||||
| 
 | ||||
|   /* a connection with a content-length longer than this
 | ||||
|      will not be considered for pipelining */ | ||||
|   CURLOPT(CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 9), | ||||
| 
 | ||||
|   /* a connection with a chunk length longer than this
 | ||||
|      will not be considered for pipelining */ | ||||
|   CURLOPT(CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 10), | ||||
| 
 | ||||
|   /* a list of site names(+port) that are blacklisted from
 | ||||
|      pipelining */ | ||||
|   CURLOPT(CURLMOPT_PIPELINING_SITE_BL, CURLOPTTYPE_OBJECTPOINT, 11), | ||||
| 
 | ||||
|   /* a list of server types that are blacklisted from
 | ||||
|      pipelining */ | ||||
|   CURLOPT(CURLMOPT_PIPELINING_SERVER_BL, CURLOPTTYPE_OBJECTPOINT, 12), | ||||
| 
 | ||||
|   /* maximum number of open connections in total */ | ||||
|   CURLOPT(CURLMOPT_MAX_TOTAL_CONNECTIONS, CURLOPTTYPE_LONG, 13), | ||||
| 
 | ||||
|    /* This is the server push callback function pointer */ | ||||
|   CURLOPT(CURLMOPT_PUSHFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 14), | ||||
| 
 | ||||
|   /* This is the argument passed to the server push callback */ | ||||
|   CURLOPT(CURLMOPT_PUSHDATA, CURLOPTTYPE_OBJECTPOINT, 15), | ||||
| 
 | ||||
|   /* maximum number of concurrent streams to support on a connection */ | ||||
|   CURLOPT(CURLMOPT_MAX_CONCURRENT_STREAMS, CURLOPTTYPE_LONG, 16), | ||||
| 
 | ||||
|   CURLMOPT_LASTENTRY /* the last unused */ | ||||
| } CURLMoption; | ||||
|  | @ -338,6 +424,31 @@ CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle, | |||
| CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle, | ||||
|                                         curl_socket_t sockfd, void *sockp); | ||||
| 
 | ||||
| 
 | ||||
| /*
 | ||||
|  * Name: curl_push_callback | ||||
|  * | ||||
|  * Desc: This callback gets called when a new stream is being pushed by the | ||||
|  *       server. It approves or denies the new stream. | ||||
|  * | ||||
|  * Returns: CURL_PUSH_OK or CURL_PUSH_DENY. | ||||
|  */ | ||||
| #define CURL_PUSH_OK   0 | ||||
| #define CURL_PUSH_DENY 1 | ||||
| 
 | ||||
| struct curl_pushheaders;  /* forward declaration only */ | ||||
| 
 | ||||
| CURL_EXTERN char *curl_pushheader_bynum(struct curl_pushheaders *h, | ||||
|                                         size_t num); | ||||
| CURL_EXTERN char *curl_pushheader_byname(struct curl_pushheaders *h, | ||||
|                                          const char *name); | ||||
| 
 | ||||
| typedef int (*curl_push_callback)(CURL *parent, | ||||
|                                   CURL *easy, | ||||
|                                   size_t num_headers, | ||||
|                                   struct curl_pushheaders *headers, | ||||
|                                   void *userp); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } /* end of extern "C" */ | ||||
| #endif | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| #ifndef __STDC_HEADERS_H | ||||
| #define __STDC_HEADERS_H | ||||
| #ifndef CURLINC_STDCHEADERS_H | ||||
| #define CURLINC_STDCHEADERS_H | ||||
| /***************************************************************************
 | ||||
|  *                                  _   _ ____  _ | ||||
|  *  Project                     ___| | | |  _ \| | | ||||
|  | @ -7,11 +7,11 @@ | |||
|  *                            | (__| |_| |  _ <| |___ | ||||
|  *                             \___|\___/|_| \_\_____| | ||||
|  * | ||||
|  * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. | ||||
|  * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. | ||||
|  * | ||||
|  * This software is licensed as described in the file COPYING, which | ||||
|  * you should have received as part of this distribution. The terms | ||||
|  * are also available at http://curl.haxx.se/docs/copyright.html.
 | ||||
|  * are also available at https://curl.haxx.se/docs/copyright.html.
 | ||||
|  * | ||||
|  * You may opt to use, copy, modify, merge, publish, distribute and/or sell | ||||
|  * copies of the Software, and permit persons to whom the Software is | ||||
|  | @ -24,10 +24,10 @@ | |||
| 
 | ||||
| #include <sys/types.h> | ||||
| 
 | ||||
| size_t fread (void *, size_t, size_t, FILE *); | ||||
| size_t fwrite (const void *, size_t, size_t, FILE *); | ||||
| size_t fread(void *, size_t, size_t, FILE *); | ||||
| size_t fwrite(const void *, size_t, size_t, FILE *); | ||||
| 
 | ||||
| int strcasecmp(const char *, const char *); | ||||
| int strncasecmp(const char *, const char *, size_t); | ||||
| 
 | ||||
| #endif /* __STDC_HEADERS_H */ | ||||
| #endif /* CURLINC_STDCHEADERS_H */ | ||||
|  |  | |||
							
								
								
									
										504
									
								
								libs/curl/include/curl/system.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										504
									
								
								libs/curl/include/curl/system.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,504 @@ | |||
| #ifndef CURLINC_SYSTEM_H | ||||
| #define CURLINC_SYSTEM_H | ||||
| /***************************************************************************
 | ||||
|  *                                  _   _ ____  _ | ||||
|  *  Project                     ___| | | |  _ \| | | ||||
|  *                             / __| | | | |_) | | | ||||
|  *                            | (__| |_| |  _ <| |___ | ||||
|  *                             \___|\___/|_| \_\_____| | ||||
|  * | ||||
|  * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. | ||||
|  * | ||||
|  * This software is licensed as described in the file COPYING, which | ||||
|  * you should have received as part of this distribution. The terms | ||||
|  * are also available at https://curl.haxx.se/docs/copyright.html.
 | ||||
|  * | ||||
|  * You may opt to use, copy, modify, merge, publish, distribute and/or sell | ||||
|  * copies of the Software, and permit persons to whom the Software is | ||||
|  * furnished to do so, under the terms of the COPYING file. | ||||
|  * | ||||
|  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||||
|  * KIND, either express or implied. | ||||
|  * | ||||
|  ***************************************************************************/ | ||||
| 
 | ||||
| /*
 | ||||
|  * Try to keep one section per platform, compiler and architecture, otherwise, | ||||
|  * if an existing section is reused for a different one and later on the | ||||
|  * original is adjusted, probably the piggybacking one can be adversely | ||||
|  * changed. | ||||
|  * | ||||
|  * In order to differentiate between platforms/compilers/architectures use | ||||
|  * only compiler built in predefined preprocessor symbols. | ||||
|  * | ||||
|  * curl_off_t | ||||
|  * ---------- | ||||
|  * | ||||
|  * For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit | ||||
|  * wide signed integral data type. The width of this data type must remain | ||||
|  * constant and independent of any possible large file support settings. | ||||
|  * | ||||
|  * As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit | ||||
|  * wide signed integral data type if there is no 64-bit type. | ||||
|  * | ||||
|  * As a general rule, curl_off_t shall not be mapped to off_t. This rule shall | ||||
|  * only be violated if off_t is the only 64-bit data type available and the | ||||
|  * size of off_t is independent of large file support settings. Keep your | ||||
|  * build on the safe side avoiding an off_t gating.  If you have a 64-bit | ||||
|  * off_t then take for sure that another 64-bit data type exists, dig deeper | ||||
|  * and you will find it. | ||||
|  * | ||||
|  */ | ||||
| 
 | ||||
| #if defined(__DJGPP__) || defined(__GO32__) | ||||
| #  if defined(__DJGPP__) && (__DJGPP__ > 1) | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     long long | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "lld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "llu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     LL | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    ULL | ||||
| #  else | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     long | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "ld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "lu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     L | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    UL | ||||
| #  endif | ||||
| #  define CURL_TYPEOF_CURL_SOCKLEN_T int | ||||
| 
 | ||||
| #elif defined(__SALFORDC__) | ||||
| #  define CURL_TYPEOF_CURL_OFF_T     long | ||||
| #  define CURL_FORMAT_CURL_OFF_T     "ld" | ||||
| #  define CURL_FORMAT_CURL_OFF_TU    "lu" | ||||
| #  define CURL_SUFFIX_CURL_OFF_T     L | ||||
| #  define CURL_SUFFIX_CURL_OFF_TU    UL | ||||
| #  define CURL_TYPEOF_CURL_SOCKLEN_T int | ||||
| 
 | ||||
| #elif defined(__BORLANDC__) | ||||
| #  if (__BORLANDC__ < 0x520) | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     long | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "ld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "lu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     L | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    UL | ||||
| #  else | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     __int64 | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "I64d" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "I64u" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     i64 | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    ui64 | ||||
| #  endif | ||||
| #  define CURL_TYPEOF_CURL_SOCKLEN_T int | ||||
| 
 | ||||
| #elif defined(__TURBOC__) | ||||
| #  define CURL_TYPEOF_CURL_OFF_T     long | ||||
| #  define CURL_FORMAT_CURL_OFF_T     "ld" | ||||
| #  define CURL_FORMAT_CURL_OFF_TU    "lu" | ||||
| #  define CURL_SUFFIX_CURL_OFF_T     L | ||||
| #  define CURL_SUFFIX_CURL_OFF_TU    UL | ||||
| #  define CURL_TYPEOF_CURL_SOCKLEN_T int | ||||
| 
 | ||||
| #elif defined(__WATCOMC__) | ||||
| #  if defined(__386__) | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     __int64 | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "I64d" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "I64u" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     i64 | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    ui64 | ||||
| #  else | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     long | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "ld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "lu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     L | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    UL | ||||
| #  endif | ||||
| #  define CURL_TYPEOF_CURL_SOCKLEN_T int | ||||
| 
 | ||||
| #elif defined(__POCC__) | ||||
| #  if (__POCC__ < 280) | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     long | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "ld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "lu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     L | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    UL | ||||
| #  elif defined(_MSC_VER) | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     __int64 | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "I64d" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "I64u" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     i64 | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    ui64 | ||||
| #  else | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     long long | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "lld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "llu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     LL | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    ULL | ||||
| #  endif | ||||
| #  define CURL_TYPEOF_CURL_SOCKLEN_T int | ||||
| 
 | ||||
| #elif defined(__LCC__) | ||||
| #  if defined(__e2k__) /* MCST eLbrus C Compiler */ | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     long | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "ld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "lu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     L | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    UL | ||||
| #    define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t | ||||
| #    define CURL_PULL_SYS_TYPES_H      1 | ||||
| #    define CURL_PULL_SYS_SOCKET_H     1 | ||||
| #  else                /* Local (or Little) C Compiler */ | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     long | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "ld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "lu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     L | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    UL | ||||
| #    define CURL_TYPEOF_CURL_SOCKLEN_T int | ||||
| #  endif | ||||
| 
 | ||||
| #elif defined(__SYMBIAN32__) | ||||
| #  if defined(__EABI__) /* Treat all ARM compilers equally */ | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     long long | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "lld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "llu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     LL | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    ULL | ||||
| #  elif defined(__CW32__) | ||||
| #    pragma longlong on | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     long long | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "lld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "llu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     LL | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    ULL | ||||
| #  elif defined(__VC32__) | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     __int64 | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "lld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "llu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     LL | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    ULL | ||||
| #  endif | ||||
| #  define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int | ||||
| 
 | ||||
| #elif defined(__MWERKS__) | ||||
| #  define CURL_TYPEOF_CURL_OFF_T     long long | ||||
| #  define CURL_FORMAT_CURL_OFF_T     "lld" | ||||
| #  define CURL_FORMAT_CURL_OFF_TU    "llu" | ||||
| #  define CURL_SUFFIX_CURL_OFF_T     LL | ||||
| #  define CURL_SUFFIX_CURL_OFF_TU    ULL | ||||
| #  define CURL_TYPEOF_CURL_SOCKLEN_T int | ||||
| 
 | ||||
| #elif defined(_WIN32_WCE) | ||||
| #  define CURL_TYPEOF_CURL_OFF_T     __int64 | ||||
| #  define CURL_FORMAT_CURL_OFF_T     "I64d" | ||||
| #  define CURL_FORMAT_CURL_OFF_TU    "I64u" | ||||
| #  define CURL_SUFFIX_CURL_OFF_T     i64 | ||||
| #  define CURL_SUFFIX_CURL_OFF_TU    ui64 | ||||
| #  define CURL_TYPEOF_CURL_SOCKLEN_T int | ||||
| 
 | ||||
| #elif defined(__MINGW32__) | ||||
| #  define CURL_TYPEOF_CURL_OFF_T     long long | ||||
| #  define CURL_FORMAT_CURL_OFF_T     "I64d" | ||||
| #  define CURL_FORMAT_CURL_OFF_TU    "I64u" | ||||
| #  define CURL_SUFFIX_CURL_OFF_T     LL | ||||
| #  define CURL_SUFFIX_CURL_OFF_TU    ULL | ||||
| #  define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t | ||||
| #  define CURL_PULL_SYS_TYPES_H      1 | ||||
| #  define CURL_PULL_WS2TCPIP_H       1 | ||||
| 
 | ||||
| #elif defined(__VMS) | ||||
| #  if defined(__VAX) | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     long | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "ld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "lu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     L | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    UL | ||||
| #  else | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     long long | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "lld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "llu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     LL | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    ULL | ||||
| #  endif | ||||
| #  define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int | ||||
| 
 | ||||
| #elif defined(__OS400__) | ||||
| #  if defined(__ILEC400__) | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     long long | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "lld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "llu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     LL | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    ULL | ||||
| #    define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t | ||||
| #    define CURL_PULL_SYS_TYPES_H      1 | ||||
| #    define CURL_PULL_SYS_SOCKET_H     1 | ||||
| #  endif | ||||
| 
 | ||||
| #elif defined(__MVS__) | ||||
| #  if defined(__IBMC__) || defined(__IBMCPP__) | ||||
| #    if defined(_ILP32) | ||||
| #    elif defined(_LP64) | ||||
| #    endif | ||||
| #    if defined(_LONG_LONG) | ||||
| #      define CURL_TYPEOF_CURL_OFF_T     long long | ||||
| #      define CURL_FORMAT_CURL_OFF_T     "lld" | ||||
| #      define CURL_FORMAT_CURL_OFF_TU    "llu" | ||||
| #      define CURL_SUFFIX_CURL_OFF_T     LL | ||||
| #      define CURL_SUFFIX_CURL_OFF_TU    ULL | ||||
| #    elif defined(_LP64) | ||||
| #      define CURL_TYPEOF_CURL_OFF_T     long | ||||
| #      define CURL_FORMAT_CURL_OFF_T     "ld" | ||||
| #      define CURL_FORMAT_CURL_OFF_TU    "lu" | ||||
| #      define CURL_SUFFIX_CURL_OFF_T     L | ||||
| #      define CURL_SUFFIX_CURL_OFF_TU    UL | ||||
| #    else | ||||
| #      define CURL_TYPEOF_CURL_OFF_T     long | ||||
| #      define CURL_FORMAT_CURL_OFF_T     "ld" | ||||
| #      define CURL_FORMAT_CURL_OFF_TU    "lu" | ||||
| #      define CURL_SUFFIX_CURL_OFF_T     L | ||||
| #      define CURL_SUFFIX_CURL_OFF_TU    UL | ||||
| #    endif | ||||
| #    define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t | ||||
| #    define CURL_PULL_SYS_TYPES_H      1 | ||||
| #    define CURL_PULL_SYS_SOCKET_H     1 | ||||
| #  endif | ||||
| 
 | ||||
| #elif defined(__370__) | ||||
| #  if defined(__IBMC__) || defined(__IBMCPP__) | ||||
| #    if defined(_ILP32) | ||||
| #    elif defined(_LP64) | ||||
| #    endif | ||||
| #    if defined(_LONG_LONG) | ||||
| #      define CURL_TYPEOF_CURL_OFF_T     long long | ||||
| #      define CURL_FORMAT_CURL_OFF_T     "lld" | ||||
| #      define CURL_FORMAT_CURL_OFF_TU    "llu" | ||||
| #      define CURL_SUFFIX_CURL_OFF_T     LL | ||||
| #      define CURL_SUFFIX_CURL_OFF_TU    ULL | ||||
| #    elif defined(_LP64) | ||||
| #      define CURL_TYPEOF_CURL_OFF_T     long | ||||
| #      define CURL_FORMAT_CURL_OFF_T     "ld" | ||||
| #      define CURL_FORMAT_CURL_OFF_TU    "lu" | ||||
| #      define CURL_SUFFIX_CURL_OFF_T     L | ||||
| #      define CURL_SUFFIX_CURL_OFF_TU    UL | ||||
| #    else | ||||
| #      define CURL_TYPEOF_CURL_OFF_T     long | ||||
| #      define CURL_FORMAT_CURL_OFF_T     "ld" | ||||
| #      define CURL_FORMAT_CURL_OFF_TU    "lu" | ||||
| #      define CURL_SUFFIX_CURL_OFF_T     L | ||||
| #      define CURL_SUFFIX_CURL_OFF_TU    UL | ||||
| #    endif | ||||
| #    define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t | ||||
| #    define CURL_PULL_SYS_TYPES_H      1 | ||||
| #    define CURL_PULL_SYS_SOCKET_H     1 | ||||
| #  endif | ||||
| 
 | ||||
| #elif defined(TPF) | ||||
| #  define CURL_TYPEOF_CURL_OFF_T     long | ||||
| #  define CURL_FORMAT_CURL_OFF_T     "ld" | ||||
| #  define CURL_FORMAT_CURL_OFF_TU    "lu" | ||||
| #  define CURL_SUFFIX_CURL_OFF_T     L | ||||
| #  define CURL_SUFFIX_CURL_OFF_TU    UL | ||||
| #  define CURL_TYPEOF_CURL_SOCKLEN_T int | ||||
| 
 | ||||
| #elif defined(__TINYC__) /* also known as tcc */ | ||||
| #  define CURL_TYPEOF_CURL_OFF_T     long long | ||||
| #  define CURL_FORMAT_CURL_OFF_T     "lld" | ||||
| #  define CURL_FORMAT_CURL_OFF_TU    "llu" | ||||
| #  define CURL_SUFFIX_CURL_OFF_T     LL | ||||
| #  define CURL_SUFFIX_CURL_OFF_TU    ULL | ||||
| #  define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t | ||||
| #  define CURL_PULL_SYS_TYPES_H      1 | ||||
| #  define CURL_PULL_SYS_SOCKET_H     1 | ||||
| 
 | ||||
| #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* Oracle Solaris Studio */ | ||||
| #  if !defined(__LP64) && (defined(__ILP32) ||                          \ | ||||
|                            defined(__i386) ||                           \ | ||||
|                            defined(__sparcv8) ||                        \ | ||||
|                            defined(__sparcv8plus)) | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     long long | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "lld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "llu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     LL | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    ULL | ||||
| #  elif defined(__LP64) || \ | ||||
|         defined(__amd64) || defined(__sparcv9) | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     long | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "ld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "lu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     L | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    UL | ||||
| #  endif | ||||
| #  define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t | ||||
| #  define CURL_PULL_SYS_TYPES_H      1 | ||||
| #  define CURL_PULL_SYS_SOCKET_H     1 | ||||
| 
 | ||||
| #elif defined(__xlc__) /* IBM xlc compiler */ | ||||
| #  if !defined(_LP64) | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     long long | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "lld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "llu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     LL | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    ULL | ||||
| #  else | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     long | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "ld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "lu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     L | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    UL | ||||
| #  endif | ||||
| #  define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t | ||||
| #  define CURL_PULL_SYS_TYPES_H      1 | ||||
| #  define CURL_PULL_SYS_SOCKET_H     1 | ||||
| 
 | ||||
| /* ===================================== */ | ||||
| /*    KEEP MSVC THE PENULTIMATE ENTRY    */ | ||||
| /* ===================================== */ | ||||
| 
 | ||||
| #elif defined(_MSC_VER) | ||||
| #  if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64) | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     __int64 | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "I64d" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "I64u" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     i64 | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    ui64 | ||||
| #  else | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     long | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "ld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "lu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     L | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    UL | ||||
| #  endif | ||||
| #  define CURL_TYPEOF_CURL_SOCKLEN_T int | ||||
| 
 | ||||
| /* ===================================== */ | ||||
| /*    KEEP GENERIC GCC THE LAST ENTRY    */ | ||||
| /* ===================================== */ | ||||
| 
 | ||||
| #elif defined(__GNUC__) && !defined(_SCO_DS) | ||||
| #  if !defined(__LP64__) &&                                             \ | ||||
|   (defined(__ILP32__) || defined(__i386__) || defined(__hppa__) ||      \ | ||||
|    defined(__ppc__) || defined(__powerpc__) || defined(__arm__) ||      \ | ||||
|    defined(__sparc__) || defined(__mips__) || defined(__sh__) ||        \ | ||||
|    defined(__XTENSA__) ||                                               \ | ||||
|    (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 4)  ||               \ | ||||
|    (defined(__LONG_MAX__) && __LONG_MAX__ == 2147483647L)) | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     long long | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "lld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "llu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     LL | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    ULL | ||||
| #  elif defined(__LP64__) || \ | ||||
|         defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \ | ||||
|         defined(__e2k__) || \ | ||||
|         (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) || \ | ||||
|         (defined(__LONG_MAX__) && __LONG_MAX__ == 9223372036854775807L) | ||||
| #    define CURL_TYPEOF_CURL_OFF_T     long | ||||
| #    define CURL_FORMAT_CURL_OFF_T     "ld" | ||||
| #    define CURL_FORMAT_CURL_OFF_TU    "lu" | ||||
| #    define CURL_SUFFIX_CURL_OFF_T     L | ||||
| #    define CURL_SUFFIX_CURL_OFF_TU    UL | ||||
| #  endif | ||||
| #  define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t | ||||
| #  define CURL_PULL_SYS_TYPES_H      1 | ||||
| #  define CURL_PULL_SYS_SOCKET_H     1 | ||||
| 
 | ||||
| #else | ||||
| /* generic "safe guess" on old 32 bit style */ | ||||
| # define CURL_TYPEOF_CURL_OFF_T     long | ||||
| # define CURL_FORMAT_CURL_OFF_T     "ld" | ||||
| # define CURL_FORMAT_CURL_OFF_TU    "lu" | ||||
| # define CURL_SUFFIX_CURL_OFF_T     L | ||||
| # define CURL_SUFFIX_CURL_OFF_TU    UL | ||||
| # define CURL_TYPEOF_CURL_SOCKLEN_T int | ||||
| #endif | ||||
| 
 | ||||
| #ifdef _AIX | ||||
| /* AIX needs <sys/poll.h> */ | ||||
| #define CURL_PULL_SYS_POLL_H | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
| /* CURL_PULL_WS2TCPIP_H is defined above when inclusion of header file  */ | ||||
| /* ws2tcpip.h is required here to properly make type definitions below. */ | ||||
| #ifdef CURL_PULL_WS2TCPIP_H | ||||
| #  include <winsock2.h> | ||||
| #  include <windows.h> | ||||
| #  include <ws2tcpip.h> | ||||
| #endif | ||||
| 
 | ||||
| /* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file  */ | ||||
| /* sys/types.h is required here to properly make type definitions below. */ | ||||
| #ifdef CURL_PULL_SYS_TYPES_H | ||||
| #  include <sys/types.h> | ||||
| #endif | ||||
| 
 | ||||
| /* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file  */ | ||||
| /* sys/socket.h is required here to properly make type definitions below. */ | ||||
| #ifdef CURL_PULL_SYS_SOCKET_H | ||||
| #  include <sys/socket.h> | ||||
| #endif | ||||
| 
 | ||||
| /* CURL_PULL_SYS_POLL_H is defined above when inclusion of header file    */ | ||||
| /* sys/poll.h is required here to properly make type definitions below.   */ | ||||
| #ifdef CURL_PULL_SYS_POLL_H | ||||
| #  include <sys/poll.h> | ||||
| #endif | ||||
| 
 | ||||
| /* Data type definition of curl_socklen_t. */ | ||||
| #ifdef CURL_TYPEOF_CURL_SOCKLEN_T | ||||
|   typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t; | ||||
| #endif | ||||
| 
 | ||||
| /* Data type definition of curl_off_t. */ | ||||
| 
 | ||||
| #ifdef CURL_TYPEOF_CURL_OFF_T | ||||
|   typedef CURL_TYPEOF_CURL_OFF_T curl_off_t; | ||||
| #endif | ||||
| 
 | ||||
| /*
 | ||||
|  * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow | ||||
|  * these to be visible and exported by the external libcurl interface API, | ||||
|  * while also making them visible to the library internals, simply including | ||||
|  * curl_setup.h, without actually needing to include curl.h internally. | ||||
|  * If some day this section would grow big enough, all this should be moved | ||||
|  * to its own header file. | ||||
|  */ | ||||
| 
 | ||||
| /*
 | ||||
|  * Figure out if we can use the ## preprocessor operator, which is supported | ||||
|  * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__ | ||||
|  * or  __cplusplus so we need to carefully check for them too. | ||||
|  */ | ||||
| 
 | ||||
| #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \ | ||||
|   defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \ | ||||
|   defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \ | ||||
|   defined(__ILEC400__) | ||||
|   /* This compiler is believed to have an ISO compatible preprocessor */ | ||||
| #define CURL_ISOCPP | ||||
| #else | ||||
|   /* This compiler is believed NOT to have an ISO compatible preprocessor */ | ||||
| #undef CURL_ISOCPP | ||||
| #endif | ||||
| 
 | ||||
| /*
 | ||||
|  * Macros for minimum-width signed and unsigned curl_off_t integer constants. | ||||
|  */ | ||||
| 
 | ||||
| #if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551) | ||||
| #  define CURLINC_OFF_T_C_HLPR2(x) x | ||||
| #  define CURLINC_OFF_T_C_HLPR1(x) CURLINC_OFF_T_C_HLPR2(x) | ||||
| #  define CURL_OFF_T_C(Val)  CURLINC_OFF_T_C_HLPR1(Val) ## \ | ||||
|                              CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T) | ||||
| #  define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val) ## \ | ||||
|                              CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU) | ||||
| #else | ||||
| #  ifdef CURL_ISOCPP | ||||
| #    define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix | ||||
| #  else | ||||
| #    define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix | ||||
| #  endif | ||||
| #  define CURLINC_OFF_T_C_HLPR1(Val,Suffix) CURLINC_OFF_T_C_HLPR2(Val,Suffix) | ||||
| #  define CURL_OFF_T_C(Val)  CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T) | ||||
| #  define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU) | ||||
| #endif | ||||
| 
 | ||||
| #endif /* CURLINC_SYSTEM_H */ | ||||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										125
									
								
								libs/curl/include/curl/urlapi.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										125
									
								
								libs/curl/include/curl/urlapi.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,125 @@ | |||
| #ifndef CURLINC_URLAPI_H | ||||
| #define CURLINC_URLAPI_H | ||||
| /***************************************************************************
 | ||||
|  *                                  _   _ ____  _ | ||||
|  *  Project                     ___| | | |  _ \| | | ||||
|  *                             / __| | | | |_) | | | ||||
|  *                            | (__| |_| |  _ <| |___ | ||||
|  *                             \___|\___/|_| \_\_____| | ||||
|  * | ||||
|  * Copyright (C) 2018 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. | ||||
|  * | ||||
|  * This software is licensed as described in the file COPYING, which | ||||
|  * you should have received as part of this distribution. The terms | ||||
|  * are also available at https://curl.haxx.se/docs/copyright.html.
 | ||||
|  * | ||||
|  * You may opt to use, copy, modify, merge, publish, distribute and/or sell | ||||
|  * copies of the Software, and permit persons to whom the Software is | ||||
|  * furnished to do so, under the terms of the COPYING file. | ||||
|  * | ||||
|  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||||
|  * KIND, either express or implied. | ||||
|  * | ||||
|  ***************************************************************************/ | ||||
| 
 | ||||
| #include "curl.h" | ||||
| 
 | ||||
| #ifdef  __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
| 
 | ||||
| /* the error codes for the URL API */ | ||||
| typedef enum { | ||||
|   CURLUE_OK, | ||||
|   CURLUE_BAD_HANDLE,          /* 1 */ | ||||
|   CURLUE_BAD_PARTPOINTER,     /* 2 */ | ||||
|   CURLUE_MALFORMED_INPUT,     /* 3 */ | ||||
|   CURLUE_BAD_PORT_NUMBER,     /* 4 */ | ||||
|   CURLUE_UNSUPPORTED_SCHEME,  /* 5 */ | ||||
|   CURLUE_URLDECODE,           /* 6 */ | ||||
|   CURLUE_OUT_OF_MEMORY,       /* 7 */ | ||||
|   CURLUE_USER_NOT_ALLOWED,    /* 8 */ | ||||
|   CURLUE_UNKNOWN_PART,        /* 9 */ | ||||
|   CURLUE_NO_SCHEME,           /* 10 */ | ||||
|   CURLUE_NO_USER,             /* 11 */ | ||||
|   CURLUE_NO_PASSWORD,         /* 12 */ | ||||
|   CURLUE_NO_OPTIONS,          /* 13 */ | ||||
|   CURLUE_NO_HOST,             /* 14 */ | ||||
|   CURLUE_NO_PORT,             /* 15 */ | ||||
|   CURLUE_NO_QUERY,            /* 16 */ | ||||
|   CURLUE_NO_FRAGMENT          /* 17 */ | ||||
| } CURLUcode; | ||||
| 
 | ||||
| typedef enum { | ||||
|   CURLUPART_URL, | ||||
|   CURLUPART_SCHEME, | ||||
|   CURLUPART_USER, | ||||
|   CURLUPART_PASSWORD, | ||||
|   CURLUPART_OPTIONS, | ||||
|   CURLUPART_HOST, | ||||
|   CURLUPART_PORT, | ||||
|   CURLUPART_PATH, | ||||
|   CURLUPART_QUERY, | ||||
|   CURLUPART_FRAGMENT, | ||||
|   CURLUPART_ZONEID /* added in 7.65.0 */ | ||||
| } CURLUPart; | ||||
| 
 | ||||
| #define CURLU_DEFAULT_PORT (1<<0)       /* return default port number */ | ||||
| #define CURLU_NO_DEFAULT_PORT (1<<1)    /* act as if no port number was set, | ||||
|                                            if the port number matches the | ||||
|                                            default for the scheme */ | ||||
| #define CURLU_DEFAULT_SCHEME (1<<2)     /* return default scheme if | ||||
|                                            missing */ | ||||
| #define CURLU_NON_SUPPORT_SCHEME (1<<3) /* allow non-supported scheme */ | ||||
| #define CURLU_PATH_AS_IS (1<<4)         /* leave dot sequences */ | ||||
| #define CURLU_DISALLOW_USER (1<<5)      /* no user+password allowed */ | ||||
| #define CURLU_URLDECODE (1<<6)          /* URL decode on get */ | ||||
| #define CURLU_URLENCODE (1<<7)          /* URL encode on set */ | ||||
| #define CURLU_APPENDQUERY (1<<8)        /* append a form style part */ | ||||
| #define CURLU_GUESS_SCHEME (1<<9)       /* legacy curl-style guessing */ | ||||
| #define CURLU_NO_AUTHORITY (1<<10)      /* Allow empty authority when the | ||||
|                                            scheme is unknown. */ | ||||
| 
 | ||||
| typedef struct Curl_URL CURLU; | ||||
| 
 | ||||
| /*
 | ||||
|  * curl_url() creates a new CURLU handle and returns a pointer to it. | ||||
|  * Must be freed with curl_url_cleanup(). | ||||
|  */ | ||||
| CURL_EXTERN CURLU *curl_url(void); | ||||
| 
 | ||||
| /*
 | ||||
|  * curl_url_cleanup() frees the CURLU handle and related resources used for | ||||
|  * the URL parsing. It will not free strings previously returned with the URL | ||||
|  * API. | ||||
|  */ | ||||
| CURL_EXTERN void curl_url_cleanup(CURLU *handle); | ||||
| 
 | ||||
| /*
 | ||||
|  * curl_url_dup() duplicates a CURLU handle and returns a new copy. The new | ||||
|  * handle must also be freed with curl_url_cleanup(). | ||||
|  */ | ||||
| CURL_EXTERN CURLU *curl_url_dup(CURLU *in); | ||||
| 
 | ||||
| /*
 | ||||
|  * curl_url_get() extracts a specific part of the URL from a CURLU | ||||
|  * handle. Returns error code. The returned pointer MUST be freed with | ||||
|  * curl_free() afterwards. | ||||
|  */ | ||||
| CURL_EXTERN CURLUcode curl_url_get(CURLU *handle, CURLUPart what, | ||||
|                                    char **part, unsigned int flags); | ||||
| 
 | ||||
| /*
 | ||||
|  * curl_url_set() sets a specific part of the URL in a CURLU handle. Returns | ||||
|  * error code. The passed in string will be copied. Passing a NULL instead of | ||||
|  * a part string, clears that part. | ||||
|  */ | ||||
| CURL_EXTERN CURLUcode curl_url_set(CURLU *handle, CURLUPart what, | ||||
|                                    const char *part, unsigned int flags); | ||||
| 
 | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } /* end of extern "C" */ | ||||
| #endif | ||||
| 
 | ||||
| #endif /* CURLINC_URLAPI_H */ | ||||
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								libs/curl/lib32/libcurl.dll
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								libs/curl/lib32/libcurl.dll
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								libs/curl/lib32/libcurl.dll.a
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								libs/curl/lib32/libcurl.dll.a
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								libs/curl/lib64/libcurl-x64.dll
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								libs/curl/lib64/libcurl-x64.dll
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								libs/curl/lib64/libcurl.dll.a
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								libs/curl/lib64/libcurl.dll.a
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -220,6 +220,8 @@ set(SRB2_CONFIG_HAVE_ZLIB ON CACHE BOOL | |||
| 	"Enable zlib support.") | ||||
| set(SRB2_CONFIG_HAVE_GME ON CACHE BOOL | ||||
| 	"Enable GME support.") | ||||
| set(SRB2_CONFIG_HAVE_GME ON CACHE BOOL | ||||
| 	"Enable curl support, used for downloading files via HTTP.") | ||||
| set(SRB2_CONFIG_HWRENDER ON CACHE BOOL | ||||
| 	"Enable hardware rendering through OpenGL.") | ||||
| set(SRB2_CONFIG_USEASM OFF CACHE BOOL | ||||
|  | @ -391,6 +393,26 @@ if(${SRB2_CONFIG_HAVE_PNG} AND ${SRB2_CONFIG_HAVE_ZLIB}) | |||
| 	endif() | ||||
| endif() | ||||
| 
 | ||||
| if(${SRB2_CONFIG_HAVE_CURL}) | ||||
| 	if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES}) | ||||
| 		set(CURL_FOUND ON) | ||||
| 		set(CURL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/curl) | ||||
| 		if(${SRB2_SYSTEM_BITS} EQUAL 64) | ||||
| 			set(CURL_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/curl/lib32 -lcurl") | ||||
| 		else() # 32-bit | ||||
| 			set(CURL_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/curl/lib64 -lcurl") | ||||
| 		endif() | ||||
| 	else() | ||||
| 		find_package(CURL) | ||||
| 	endif() | ||||
| 	if(${CURL_FOUND}) | ||||
| 		set(SRB2_HAVE_CURL ON) | ||||
| 		add_definitions(-DHAVE_CURL) | ||||
| 	else() | ||||
| 		message(WARNING "You have specified that CURL is available but it was not found. SRB2Kart may not compile correctly.") | ||||
| 	endif() | ||||
| endif() | ||||
| 
 | ||||
| if(${SRB2_CONFIG_HWRENDER}) | ||||
| 	add_definitions(-DHWRENDER) | ||||
| 	set(SRB2_HWRENDER_SOURCES | ||||
|  |  | |||
							
								
								
									
										11
									
								
								src/Makefile
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								src/Makefile
									
										
									
									
									
								
							|  | @ -267,6 +267,7 @@ endif | |||
| 
 | ||||
| ifdef NONET | ||||
| 	OPTS+=-DNONET | ||||
| 	NOCURL=1 | ||||
| else | ||||
| ifdef NO_IPV6 | ||||
| 	OPTS+=-DNO_IPV6 | ||||
|  | @ -369,6 +370,16 @@ else | |||
| NOPNG=1 | ||||
| endif | ||||
| 
 | ||||
| ifndef NOCURL | ||||
| OPTS+=-DHAVE_CURL | ||||
| CURLCONFIG?=curl-config | ||||
| CURL_CFLAGS?=$(shell $(CURLCONFIG) --cflags) | ||||
| CURL_LDFLAGS?=$(shell $(CURLCONFIG) --libs) | ||||
| 
 | ||||
| LIBS+=$(CURL_LDFLAGS) | ||||
| CFLAGS+=$(CURL_CFLAGS) | ||||
| endif | ||||
| 
 | ||||
| ifdef STATIC | ||||
| LIBS:=-static $(LIBS) | ||||
| endif | ||||
|  |  | |||
							
								
								
									
										132
									
								
								src/d_clisrv.c
									
										
									
									
									
								
							
							
						
						
									
										132
									
								
								src/d_clisrv.c
									
										
									
									
									
								
							|  | @ -172,6 +172,10 @@ consvar_t cv_showjoinaddress = {"showjoinaddress", "On", CV_SAVE, CV_OnOff, NULL | |||
| static CV_PossibleValue_t playbackspeed_cons_t[] = {{1, "MIN"}, {10, "MAX"}, {0, NULL}}; | ||||
| consvar_t cv_playbackspeed = {"playbackspeed", "1", 0, playbackspeed_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; | ||||
| 
 | ||||
| #ifdef HAVE_CURL | ||||
| consvar_t cv_httpsource = {"http_source", "", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; | ||||
| #endif | ||||
| 
 | ||||
| static inline void *G_DcpyTiccmd(void* dest, const ticcmd_t* src, const size_t n) | ||||
| { | ||||
| 	const size_t d = n / sizeof(ticcmd_t); | ||||
|  | @ -1104,6 +1108,10 @@ typedef enum | |||
| 	CL_ASKFULLFILELIST, | ||||
| 	CL_ASKDOWNLOADFILES, | ||||
| 	CL_WAITDOWNLOADFILESRESPONSE, | ||||
| #ifdef HAVE_CURL | ||||
| 	CL_PREPAREHTTPFILES, | ||||
| 	CL_DOWNLOADHTTPFILES, | ||||
| #endif | ||||
| 	CL_CHALLENGE | ||||
| } cl_mode_t; | ||||
| 
 | ||||
|  | @ -1119,6 +1127,10 @@ static char cl_challengepassword[65]; | |||
| static UINT8 cl_challengeanswer[MD5_LEN+1]; | ||||
| static UINT8 cl_challengeattempted = 0; | ||||
| 
 | ||||
| #ifdef HAVE_CURL | ||||
| char http_source[MAX_MIRROR_LENGTH]; | ||||
| #endif | ||||
| 
 | ||||
| // Player name send/load
 | ||||
| 
 | ||||
| static void CV_SavePlayerNames(UINT8 **p) | ||||
|  | @ -1172,7 +1184,11 @@ static inline void CL_DrawConnectionStatus(void) | |||
| 	M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-24-8, 32, 1); | ||||
| 	V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP, "Press ESC to abort"); | ||||
| 
 | ||||
| 	if (cl_mode != CL_DOWNLOADFILES) | ||||
| 	if (cl_mode != CL_DOWNLOADFILES | ||||
| #ifdef HAVE_CURL | ||||
| 	&& cl_mode != CL_DOWNLOADHTTPFILES | ||||
| #endif | ||||
| 	) | ||||
| 	{ | ||||
| 		INT32 i, animtime = ((ccstime / 4) & 15) + 16; | ||||
| 		UINT8 palstart = (cl_mode == CL_SEARCHING) ? 128 : 160; | ||||
|  | @ -1239,6 +1255,7 @@ static inline void CL_DrawConnectionStatus(void) | |||
| 				break; | ||||
| 			case CL_ASKDOWNLOADFILES: | ||||
| 			case CL_WAITDOWNLOADFILESRESPONSE: | ||||
| 			case CL_PREPAREHTTPFILES: | ||||
| 				cltext = M_GetText("Waiting to download files..."); | ||||
| 			default: | ||||
| 				cltext = M_GetText("Connecting to server..."); | ||||
|  | @ -1335,6 +1352,7 @@ static boolean CL_SendJoin(void) | |||
| static void SV_SendServerInfo(INT32 node, tic_t servertime) | ||||
| { | ||||
| 	UINT8 *p; | ||||
| 	size_t mirror_length; | ||||
| 
 | ||||
| 	netbuffer->packettype = PT_SERVERINFO; | ||||
| 	netbuffer->u.serverinfo.version = VERSION; | ||||
|  | @ -1367,6 +1385,7 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime) | |||
| 		netbuffer->u.serverinfo.iszone = 0; | ||||
| 
 | ||||
| 	memset(netbuffer->u.serverinfo.maptitle, 0, 33); | ||||
| 	memset(netbuffer->u.serverinfo.httpsource, 0, MAX_MIRROR_LENGTH); | ||||
| 
 | ||||
| 	if (!(mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU) && mapheaderinfo[gamemap-1]->lvlttl[0]) | ||||
| 	{ | ||||
|  | @ -1418,6 +1437,16 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime) | |||
| 
 | ||||
| 	netbuffer->u.serverinfo.actnum = 0; //mapheaderinfo[gamemap-1]->actnum
 | ||||
| 
 | ||||
| 	mirror_length = strlen(cv_httpsource.string); | ||||
| 	if (mirror_length > MAX_MIRROR_LENGTH) | ||||
| 		mirror_length = MAX_MIRROR_LENGTH; | ||||
| 
 | ||||
| 	if (snprintf(netbuffer->u.serverinfo.httpsource, MAX_MIRROR_LENGTH, "%s", cv_httpsource.string) < 0) | ||||
| 		// If there's an encoding error, send nothing, we accept that the above may be truncated
 | ||||
| 		strncpy(netbuffer->u.serverinfo.httpsource, "", MAX_MIRROR_LENGTH); | ||||
| 
 | ||||
| 	netbuffer->u.serverinfo.httpsource[MAX_MIRROR_LENGTH-1] = 0; | ||||
| 
 | ||||
| 	p = PutFileNeeded(0); | ||||
| 
 | ||||
| 	HSendPacket(node, false, 0, p - ((UINT8 *)&netbuffer->u)); | ||||
|  | @ -1934,23 +1963,36 @@ static boolean CL_FinishedFileList(void) | |||
| 	{ | ||||
| 		// must download something
 | ||||
| 		// can we, though?
 | ||||
| 		if (!CL_CheckDownloadable()) // nope!
 | ||||
| #ifdef HAVE_CURL | ||||
| 		if (http_source[0] == '\0' || curl_failedwebdownload) | ||||
| #endif | ||||
| 		{ | ||||
| 			D_QuitNetGame(); | ||||
| 			CL_Reset(); | ||||
| 			D_StartTitle(); | ||||
| 			M_StartMessage(M_GetText( | ||||
| 				"You cannot connect to this server\n" | ||||
| 				"because you cannot download the files\n" | ||||
| 				"that you are missing from the server.\n\n" | ||||
| 				"See the console or log file for\n" | ||||
| 				"more details.\n\n" | ||||
| 				"Press ESC\n" | ||||
| 			), NULL, MM_NOTHING); | ||||
| 			return false; | ||||
| 		} | ||||
| 			if (!CL_CheckDownloadable()) // nope!
 | ||||
| 			{ | ||||
| 				D_QuitNetGame(); | ||||
| 				CL_Reset(); | ||||
| 				D_StartTitle(); | ||||
| 				M_StartMessage(M_GetText( | ||||
| 					"You cannot connect to this server\n" | ||||
| 					"because you cannot download the files\n" | ||||
| 					"that you are missing from the server.\n\n" | ||||
| 					"See the console or log file for\n" | ||||
| 					"more details.\n\n" | ||||
| 					"Press ESC\n" | ||||
| 				), NULL, MM_NOTHING); | ||||
| 				return false; | ||||
| 			} | ||||
| 
 | ||||
| 		cl_mode = CL_ASKDOWNLOADFILES; | ||||
| 			cl_mode = CL_ASKDOWNLOADFILES; | ||||
| 			return true; | ||||
| 		} | ||||
| #ifdef HAVE_CURL | ||||
| 		else | ||||
| 		{ | ||||
| 			cl_mode = CL_PREPAREHTTPFILES; | ||||
| 			return true; | ||||
| 		} | ||||
| #endif | ||||
| 	} | ||||
| 	return true; | ||||
| } | ||||
|  | @ -1998,6 +2040,13 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent) | |||
| 
 | ||||
| 		if (client) | ||||
| 		{ | ||||
| #ifdef HAVE_CURL | ||||
| 			if (serverlist[i].info.httpsource[0]) | ||||
| 				strncpy(http_source, serverlist[i].info.httpsource, MAX_MIRROR_LENGTH); | ||||
| 			else | ||||
| 				http_source[0] = '\0'; | ||||
| #endif | ||||
| 
 | ||||
| 			D_ParseFileneeded(serverlist[i].info.fileneedednum, serverlist[i].info.fileneeded, 0); | ||||
| 			if (serverlist[i].info.kartvars & SV_LOTSOFADDONS) | ||||
| 			{ | ||||
|  | @ -2074,6 +2123,47 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic | |||
| 			} | ||||
| 			break; | ||||
| 
 | ||||
| #ifdef HAVE_CURL | ||||
| 		case CL_PREPAREHTTPFILES: | ||||
| 			if (http_source[0]) | ||||
| 			{ | ||||
| 				for (i = 0; i < fileneedednum; i++) | ||||
| 					if (fileneeded[i].status == FS_NOTFOUND) | ||||
| 						curl_transfers++; | ||||
| 
 | ||||
| 				cl_mode = CL_DOWNLOADHTTPFILES; | ||||
| 			} | ||||
| 			break; | ||||
| 
 | ||||
| 		case CL_DOWNLOADHTTPFILES: | ||||
| 			waitmore = false; | ||||
| 			for (i = 0; i < fileneedednum; i++) | ||||
| 				if (fileneeded[i].status == FS_NOTFOUND) | ||||
| 				{ | ||||
| 					if (!curl_running) | ||||
| 						CURLPrepareFile(http_source, i); | ||||
| 					waitmore = true; | ||||
| 					break; | ||||
| 				} | ||||
| 
 | ||||
| 			if (curl_running) | ||||
| 				CURLGetFile(); | ||||
| 
 | ||||
| 			if (waitmore) | ||||
| 				break; // exit the case
 | ||||
| 
 | ||||
| 			if (curl_failedwebdownload && !curl_transfers) | ||||
| 			{ | ||||
| 				CONS_Printf("One or more files failed to download, falling back to internal downloader\n"); | ||||
| 				cl_mode = CL_ASKDOWNLOADFILES; | ||||
| 				break; | ||||
| 			} | ||||
| 
 | ||||
| 			if (!curl_transfers) | ||||
| 				cl_mode = CL_ASKJOIN; // don't break case continue to cljoin request now
 | ||||
| 
 | ||||
| 			break; | ||||
| #endif | ||||
| 		case CL_DOWNLOADFILES: | ||||
| 			waitmore = false; | ||||
| 			for (i = 0; i < fileneedednum; i++) | ||||
|  | @ -2752,6 +2842,13 @@ void CL_Reset(void) | |||
| 	fileneedednum = 0; | ||||
| 	memset(fileneeded, 0, sizeof(fileneeded)); | ||||
| 
 | ||||
| #ifdef HAVE_CURL | ||||
| 	curl_failedwebdownload = false; | ||||
| 	curl_transfers = 0; | ||||
| 	curl_running = false; | ||||
| 	http_source[0] = '\0'; | ||||
| #endif | ||||
| 
 | ||||
| 	// D_StartTitle should get done now, but the calling function will handle it
 | ||||
| } | ||||
| 
 | ||||
|  | @ -3875,6 +3972,9 @@ static void HandleServerInfo(SINT8 node) | |||
| 	netbuffer->u.serverinfo.time = (tic_t)LONG(ticdiff); | ||||
| 	netbuffer->u.serverinfo.servername[MAXSERVERNAME-1] = 0; | ||||
| 	netbuffer->u.serverinfo.gametype = (UINT8)((netbuffer->u.serverinfo.gametype == VANILLA_GT_MATCH) ? GT_MATCH : GT_RACE); | ||||
| #ifdef HAVE_CURL | ||||
| 	netbuffer->u.serverinfo.httpsource[MAX_MIRROR_LENGTH-1] = 0; | ||||
| #endif | ||||
| 
 | ||||
| 	SL_InsertServer(&netbuffer->u.serverinfo, node); | ||||
| } | ||||
|  |  | |||
|  | @ -367,6 +367,9 @@ typedef struct | |||
| 
 | ||||
| #define MAXSERVERNAME 32 | ||||
| #define MAXFILENEEDED 915 | ||||
| #ifdef HAVE_CURL | ||||
| #define MAX_MIRROR_LENGTH 256 | ||||
| #endif | ||||
| // This packet is too large
 | ||||
| typedef struct | ||||
| { | ||||
|  | @ -388,6 +391,9 @@ typedef struct | |||
| 	unsigned char mapmd5[16]; | ||||
| 	UINT8 actnum; | ||||
| 	UINT8 iszone; | ||||
| #ifdef HAVE_CURL | ||||
| 	char httpsource[MAX_MIRROR_LENGTH]; | ||||
| #endif | ||||
| 	UINT8 fileneeded[MAXFILENEEDED]; // is filled with writexxx (byteptr.h)
 | ||||
| } ATTRPACK serverinfo_pak; | ||||
| 
 | ||||
|  | @ -496,6 +502,10 @@ extern INT32 mapchangepending; | |||
| // Points inside doomcom
 | ||||
| extern doomdata_t *netbuffer; | ||||
| 
 | ||||
| #ifdef HAVE_CURL | ||||
| extern consvar_t cv_httpsource; | ||||
| #endif | ||||
| 
 | ||||
| extern consvar_t cv_showjoinaddress; | ||||
| extern consvar_t cv_playbackspeed; | ||||
| 
 | ||||
|  |  | |||
|  | @ -686,6 +686,9 @@ void D_RegisterServerCommands(void) | |||
| 	CV_RegisterVar(&cv_maxsend); | ||||
| 	CV_RegisterVar(&cv_noticedownload); | ||||
| 	CV_RegisterVar(&cv_downloadspeed); | ||||
| #ifdef HAVE_CURL | ||||
| 	CV_RegisterVar(&cv_httpsource); | ||||
| #endif | ||||
| #ifndef NONET | ||||
| 	CV_RegisterVar(&cv_allownewplayer); | ||||
| #ifdef VANILLAJOINNEXTROUND | ||||
|  |  | |||
							
								
								
									
										175
									
								
								src/d_netfil.c
									
										
									
									
									
								
							
							
						
						
									
										175
									
								
								src/d_netfil.c
									
										
									
									
									
								
							|  | @ -42,6 +42,10 @@ | |||
| #include <utime.h> | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_CURL | ||||
| #include "curl/curl.h" | ||||
| #endif | ||||
| 
 | ||||
| #include "doomdef.h" | ||||
| #include "doomstat.h" | ||||
| #include "d_main.h" | ||||
|  | @ -65,6 +69,11 @@ | |||
| // Prototypes
 | ||||
| static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid); | ||||
| 
 | ||||
| #ifdef HAVE_CURL | ||||
| size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream); | ||||
| int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow); | ||||
| #endif | ||||
| 
 | ||||
| // Sender structure
 | ||||
| typedef struct filetx_s | ||||
| { | ||||
|  | @ -101,6 +110,22 @@ char downloaddir[512] = "DOWNLOAD"; | |||
| INT32 lastfilenum = -1; | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_CURL | ||||
| static CURL *http_handle; | ||||
| static CURLM *multi_handle; | ||||
| boolean curl_running = false; | ||||
| boolean curl_failedwebdownload = false; | ||||
| static double curl_dlnow; | ||||
| static double curl_dltotal; | ||||
| static time_t curl_starttime; | ||||
| INT32 curl_transfers = 0; | ||||
| static int curl_runninghandles = 0; | ||||
| static UINT32 curl_origfilesize; | ||||
| static UINT32 curl_origtotalfilesize; | ||||
| static char *curl_realname = '\0'; | ||||
| fileneeded_t *curl_curfile = NULL; | ||||
| #endif | ||||
| 
 | ||||
| /** Fills a serverinfo packet with information about wad files loaded.
 | ||||
|   * | ||||
|   * \todo Give this function a better name since it is in global scope. | ||||
|  | @ -238,10 +263,10 @@ boolean CL_CheckDownloadable(void) | |||
| 		{ | ||||
| 			CONS_Printf(" * \"%s\" (%dK)", fileneeded[i].filename, fileneeded[i].totalsize >> 10); | ||||
| 
 | ||||
| 				if (fileneeded[i].status == FS_NOTFOUND) | ||||
| 					CONS_Printf(M_GetText(" not found, md5: ")); | ||||
| 				else if (fileneeded[i].status == FS_MD5SUMBAD) | ||||
| 				if (fileneeded[i].status == FS_MD5SUMBAD) | ||||
| 					CONS_Printf(M_GetText(" wrong version, md5: ")); | ||||
| 				else | ||||
| 					CONS_Printf(M_GetText(" not found, md5: ")); | ||||
| 
 | ||||
| 			{ | ||||
| 				INT32 j; | ||||
|  | @ -296,7 +321,7 @@ boolean CL_SendRequestFile(void) | |||
| 	netbuffer->packettype = PT_REQUESTFILE; | ||||
| 	p = (char *)netbuffer->u.textcmd; | ||||
| 	for (i = 0; i < fileneedednum; i++) | ||||
| 		if ((fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD)) | ||||
| 		if ((fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD || fileneeded[i].status == FS_FALLBACK)) | ||||
| 		{ | ||||
| 			totalfreespaceneeded += fileneeded[i].totalsize; | ||||
| 			nameonly(fileneeded[i].filename); | ||||
|  | @ -1015,3 +1040,145 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet | |||
| 
 | ||||
| 	return (badmd5 ? FS_MD5SUMBAD : FS_NOTFOUND); // md5 sum bad or file not found
 | ||||
| } | ||||
| 
 | ||||
| #ifdef HAVE_CURL | ||||
| size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream) | ||||
| { | ||||
|     size_t written; | ||||
|     written = fwrite(ptr, size, nmemb, stream); | ||||
|     return written; | ||||
| } | ||||
| 
 | ||||
| int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) | ||||
| { | ||||
| 	(void)clientp; | ||||
| 	(void)ultotal; | ||||
| 	(void)ulnow; // Function prototype requires these but we won't use, so just discard
 | ||||
| 	curl_dlnow = dlnow; | ||||
| 	curl_dltotal = dltotal; | ||||
| 	getbytes = curl_dlnow / (time(NULL) - curl_starttime); // To-do: Make this more accurate???
 | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| void CURLPrepareFile(const char* url, int dfilenum) | ||||
| { | ||||
| #ifdef PARANOIA | ||||
| 	if (M_CheckParm("-nodownload")) | ||||
| 		I_Error("Attempted to download files in -nodownload mode"); | ||||
| #endif | ||||
| 
 | ||||
| 	curl_global_init(CURL_GLOBAL_ALL); | ||||
| 
 | ||||
| 	http_handle = curl_easy_init(); | ||||
| 	multi_handle = curl_multi_init(); | ||||
| 
 | ||||
| 	if (http_handle && multi_handle) | ||||
| 	{ | ||||
| 		I_mkdir(downloaddir, 0755); | ||||
| 
 | ||||
| 		curl_curfile = &fileneeded[dfilenum]; | ||||
| 		curl_realname = curl_curfile->filename; | ||||
| 		nameonly(curl_realname); | ||||
| 
 | ||||
| 		curl_origfilesize = curl_curfile->currentsize; | ||||
| 		curl_origtotalfilesize = curl_curfile->totalsize; | ||||
| 
 | ||||
| 		curl_easy_setopt(http_handle, CURLOPT_URL, va("%s/%s", url, curl_realname)); | ||||
| 
 | ||||
| 		// Only allow HTTP and HTTPS
 | ||||
| 		curl_easy_setopt(curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS); | ||||
| 
 | ||||
| 		curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("SRB2Kart/v%d.%d.%d", VERSION/100, VERSION%100, SUBVERSION)); // Set user agent as some servers won't accept invalid user agents.
 | ||||
| 
 | ||||
| 		// Follow a redirect request, if sent by the server.
 | ||||
| 		curl_easy_setopt(http_handle, CURLOPT_FOLLOWLOCATION, 1L); | ||||
| 
 | ||||
| 		curl_easy_setopt(http_handle, CURLOPT_FAILONERROR, 1L); | ||||
| 
 | ||||
| 		CONS_Printf("Downloading %s from %s\n", curl_realname, url); | ||||
| 
 | ||||
| 		strcatbf(curl_curfile->filename, downloaddir, "/"); | ||||
| 		curl_curfile->file = fopen(curl_curfile->filename, "wb"); | ||||
| 		curl_easy_setopt(http_handle, CURLOPT_WRITEDATA, curl_curfile->file); | ||||
| 		curl_easy_setopt(http_handle, CURLOPT_WRITEFUNCTION, curlwrite_data); | ||||
| 		curl_easy_setopt(http_handle, CURLOPT_NOPROGRESS, 0L); | ||||
| 		curl_easy_setopt(http_handle, CURLOPT_PROGRESSFUNCTION, curlprogress_callback); | ||||
| 
 | ||||
| 		curl_curfile->status = FS_DOWNLOADING; | ||||
| 		lastfilenum = dfilenum; | ||||
| 		curl_multi_add_handle(multi_handle, http_handle); | ||||
| 
 | ||||
| 		curl_multi_perform(multi_handle, &curl_runninghandles); | ||||
| 		curl_starttime = time(NULL); | ||||
| 		curl_running = true; | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void CURLGetFile(void) | ||||
| { | ||||
| 	CURLMcode mc; /* return code used by curl_multi_perform and curl_multi_wait() */ | ||||
| 	int numfds; | ||||
| 	CURLMsg *m; /* for picking up messages with the transfer status */ | ||||
| 	CURL *e; | ||||
| 	int msgs_left; /* how many messages are left */ | ||||
| 
 | ||||
|     if (curl_runninghandles) | ||||
|     { | ||||
|     	curl_multi_perform(multi_handle, &curl_runninghandles); | ||||
| 
 | ||||
| 		/* wait for activity, timeout or "nothing" */ | ||||
| 		mc = curl_multi_wait(multi_handle, NULL, 0, 1000, &numfds); | ||||
| 
 | ||||
| 		if (mc != CURLM_OK) | ||||
| 		{ | ||||
| 			CONS_Alert(CONS_WARNING, "curl_multi_wait() failed, code %d.\n", mc); | ||||
| 			return; | ||||
| 		} | ||||
| 		curl_curfile->currentsize = curl_dlnow; | ||||
| 		curl_curfile->totalsize = curl_dltotal; | ||||
|     } | ||||
| 
 | ||||
|     /* See how the transfers went */ | ||||
| 	while ((m = curl_multi_info_read(multi_handle, &msgs_left))) | ||||
| 	{ | ||||
| 		if (m && (m->msg == CURLMSG_DONE)) | ||||
| 		{ | ||||
| 			if (m->data.result != 0) | ||||
| 			{ | ||||
| 				nameonly(curl_realname); | ||||
| 				CONS_Printf(M_GetText("Failed to download %s...\n"), curl_realname); | ||||
| 				curl_curfile->status = FS_FALLBACK; | ||||
| 				curl_curfile->currentsize = curl_origfilesize; | ||||
| 				curl_curfile->totalsize = curl_origtotalfilesize; | ||||
| 				curl_failedwebdownload = true; | ||||
| 				fclose(curl_curfile->file); | ||||
| 				remove(curl_curfile->filename); | ||||
| 				curl_curfile->file = NULL; | ||||
| 				nameonly(curl_curfile->filename); | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				nameonly(curl_realname); | ||||
| 				CONS_Printf(M_GetText("Finished downloading %s\n"), curl_realname); | ||||
| 				curl_curfile->status = FS_FOUND; | ||||
| 				fclose(curl_curfile->file); | ||||
| 			} | ||||
| 
 | ||||
| 			e = m->easy_handle; | ||||
| 			curl_running = false; | ||||
| 			curl_transfers--; | ||||
| 			curl_multi_remove_handle(multi_handle, e); | ||||
| 			curl_easy_cleanup(e); | ||||
| 
 | ||||
| 			if (!curl_transfers) | ||||
| 				break; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
|     if (!curl_transfers) | ||||
|     { | ||||
| 		curl_multi_cleanup(multi_handle); | ||||
| 		curl_global_cleanup(); | ||||
|     } | ||||
| } | ||||
| #endif | ||||
|  | @ -30,7 +30,8 @@ typedef enum | |||
| 	FS_REQUESTED, | ||||
| 	FS_DOWNLOADING, | ||||
| 	FS_OPEN, // Is opened and used in w_wad
 | ||||
| 	FS_MD5SUMBAD | ||||
| 	FS_MD5SUMBAD, | ||||
| 	FS_FALLBACK, // HTTP failed
 | ||||
| } filestatus_t; | ||||
| 
 | ||||
| typedef struct | ||||
|  | @ -53,6 +54,12 @@ extern char downloaddir[512]; | |||
| extern INT32 lastfilenum; | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_CURL | ||||
| extern boolean curl_failedwebdownload; | ||||
| extern boolean curl_running; | ||||
| extern INT32 curl_transfers; | ||||
| #endif | ||||
| 
 | ||||
| UINT8 *PutFileNeeded(UINT16 firstfile); | ||||
| void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr, UINT16 firstfile); | ||||
| void CL_PrepareDownloadSaveGame(const char *tmpsave); | ||||
|  | @ -83,4 +90,9 @@ filestatus_t checkfilemd5(char *filename, const UINT8 *wantedmd5sum); | |||
| void nameonly(char *s); | ||||
| size_t nameonlylength(const char *s); | ||||
| 
 | ||||
| #ifdef HAVE_CURL | ||||
| void CURLPrepareFile(const char* url, int dfilenum); | ||||
| void CURLGetFile(void); | ||||
| #endif | ||||
| 
 | ||||
| #endif // __D_NETFIL__
 | ||||
|  |  | |||
|  | @ -152,6 +152,7 @@ if(${SDL2_FOUND}) | |||
| 			${PNG_LIBRARIES} | ||||
| 			${ZLIB_LIBRARIES} | ||||
| 			${OPENGL_LIBRARIES} | ||||
| 			${CURL_LIBRARIES} | ||||
| 		) | ||||
| 		set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}") | ||||
| 	else() | ||||
|  | @ -162,6 +163,7 @@ if(${SDL2_FOUND}) | |||
| 			${PNG_LIBRARIES} | ||||
| 			${ZLIB_LIBRARIES} | ||||
| 			${OPENGL_LIBRARIES} | ||||
| 			${CURL_LIBRARIES} | ||||
| 		) | ||||
| 
 | ||||
| 		if(${CMAKE_SYSTEM} MATCHES Linux) | ||||
|  | @ -241,6 +243,7 @@ if(${SDL2_FOUND}) | |||
| 		${PNG_INCLUDE_DIRS} | ||||
| 		${ZLIB_INCLUDE_DIRS} | ||||
| 		${OPENGL_INCLUDE_DIRS} | ||||
| 		${CURL_INCLUDE_DIRS} | ||||
| 	) | ||||
| 
 | ||||
| 	if(${SRB2_HAVE_MIXER}) | ||||
|  |  | |||
|  | @ -138,3 +138,12 @@ else | |||
| 	LDFLAGS+=-L../libs/miniupnpc/mingw32 | ||||
| endif #MINGW64 | ||||
| endif | ||||
| 
 | ||||
| ifndef NOCURL | ||||
| 	CURL_CFLAGS+=-I../libs/curl/include | ||||
| ifdef MINGW64 | ||||
| 	CURL_LDFLAGS+=-L../libs/curl/lib64 -lcurl | ||||
| else | ||||
| 	CURL_LDFLAGS+=-L../libs/curl/lib32 -lcurl | ||||
| endif #MINGW64 | ||||
| endif | ||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Steel Titanium
						Steel Titanium