mirror of
https://github.com/curl/curl.git
synced 2026-08-06 13:16:14 +03:00
windows: bump minimum to Vista (from XP)
After this patch curl requires targeting Vista or newer, and a toolchain with Vista support. Supported MSVC compilers (VS2010+) all support Vista: - VS2012+ target Win8 (or later) by default. - VS2010 targets Win7 by default. Supported mingw-w64 versions (v3+) all support Vista: - mingw-w64 v9+ target Win10 by default. - mingw-w64 v8 and older target Server 2003 (~XP) by default. After this patch it may be necessary to override the default Windows target version to Vista (or newer) via: autotools: `CPPFLAGS=-D_WIN32_WINNT=0x0600` cmake: `-DCURL_TARGET_WINDOWS_VERSION=0x0600` - mingw-w64 v6+ allow changing the default at toolchain build-time. Notes: - For non-MSVC, non-mingw-w64 toolchains, `if_nametoindex` needs to be allowlisted in `curl_setup.h`, if they do support it. Fixes #17985 (discussion) Closes #18009
This commit is contained in:
parent
6c8956c1cb
commit
b17ef873ae
27 changed files with 136 additions and 611 deletions
|
|
@ -440,37 +440,6 @@ int Curl_socket_close(struct Curl_easy *data, struct connectdata *conn,
|
|||
return socket_close(data, conn, FALSE, sock);
|
||||
}
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
/* When you run a program that uses the Windows Sockets API, you may
|
||||
experience slow performance when you copy data to a TCP server.
|
||||
|
||||
https://learn.microsoft.com/troubleshoot/windows-server/networking/slow-performance-copy-data-tcp-server-sockets-api
|
||||
|
||||
Work-around: Make the Socket Send Buffer Size Larger Than the Program Send
|
||||
Buffer Size
|
||||
|
||||
The problem described in this knowledge-base is applied only to pre-Vista
|
||||
Windows. Following function trying to detect OS version and skips
|
||||
SO_SNDBUF adjustment for Windows Vista and above.
|
||||
*/
|
||||
|
||||
void Curl_sndbuf_init(curl_socket_t sockfd)
|
||||
{
|
||||
int val = CURL_MAX_WRITE_SIZE + 32;
|
||||
int curval = 0;
|
||||
int curlen = sizeof(curval);
|
||||
|
||||
if(Curl_isVistaOrGreater)
|
||||
return;
|
||||
|
||||
if(getsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (char *)&curval, &curlen) == 0)
|
||||
if(curval > val)
|
||||
return;
|
||||
|
||||
setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (const char *)&val, sizeof(val));
|
||||
}
|
||||
#endif /* USE_WINSOCK */
|
||||
|
||||
/*
|
||||
* Curl_parse_interface()
|
||||
*
|
||||
|
|
@ -1133,8 +1102,6 @@ static CURLcode cf_socket_open(struct Curl_cfilter *cf,
|
|||
|
||||
nosigpipe(cf, data, ctx->sock);
|
||||
|
||||
Curl_sndbuf_init(ctx->sock);
|
||||
|
||||
if(is_tcp && data->set.tcp_keepalive)
|
||||
tcpkeepalive(cf, data, ctx->sock);
|
||||
|
||||
|
|
|
|||
|
|
@ -76,21 +76,6 @@ CURLcode Curl_socket_open(struct Curl_easy *data,
|
|||
int Curl_socket_close(struct Curl_easy *data, struct connectdata *conn,
|
||||
curl_socket_t sock);
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
/* When you run a program that uses the Windows Sockets API, you may
|
||||
experience slow performance when you copy data to a TCP server.
|
||||
|
||||
https://learn.microsoft.com/troubleshoot/windows-server/networking/slow-performance-copy-data-tcp-server-sockets-api
|
||||
|
||||
Work-around: Make the Socket Send Buffer Size Larger Than the Program Send
|
||||
Buffer Size
|
||||
|
||||
*/
|
||||
void Curl_sndbuf_init(curl_socket_t sockfd);
|
||||
#else
|
||||
#define Curl_sndbuf_init(y) Curl_nop_stmt
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Creates a cfilter that opens a TCP socket to the given address
|
||||
* when calling its `connect` implementation.
|
||||
|
|
|
|||
|
|
@ -28,53 +28,6 @@
|
|||
/* Hand crafted config file for Windows */
|
||||
/* ================================================================ */
|
||||
|
||||
/* Define some minimum and default build targets for Visual Studio */
|
||||
#ifdef _MSC_VER
|
||||
/* VS2012 default target settings and minimum build target check. */
|
||||
# if _MSC_VER >= 1700
|
||||
/* The minimum and default build targets for VS2012 are Vista and 8,
|
||||
respectively, unless Update 1 is installed and the v110_xp toolset
|
||||
is chosen. */
|
||||
# ifdef _USING_V110_SDK71_
|
||||
# define VS2012_MIN_TARGET 0x0501 /* XP */
|
||||
# define VS2012_DEF_TARGET 0x0501 /* XP */
|
||||
# else
|
||||
# define VS2012_MIN_TARGET 0x0600 /* Vista */
|
||||
# define VS2012_DEF_TARGET 0x0602 /* 8 */
|
||||
# endif
|
||||
|
||||
# ifndef _WIN32_WINNT
|
||||
# define _WIN32_WINNT VS2012_DEF_TARGET
|
||||
# endif
|
||||
# ifndef WINVER
|
||||
# define WINVER VS2012_DEF_TARGET
|
||||
# endif
|
||||
# if (_WIN32_WINNT < VS2012_MIN_TARGET) || (WINVER < VS2012_MIN_TARGET)
|
||||
# ifdef _USING_V110_SDK71_
|
||||
# error VS2012 does not support build targets prior to Windows XP
|
||||
# else
|
||||
# error VS2012 does not support build targets prior to Windows Vista
|
||||
# endif
|
||||
# endif
|
||||
/* VS2010 default target settings and minimum build target check. */
|
||||
# else
|
||||
/* VS2010 default build target is Windows 7 (0x0601).
|
||||
We override default target to be Windows XP. */
|
||||
# define VS2010_MIN_TARGET 0x0501 /* XP */
|
||||
# define VS2010_DEF_TARGET 0x0501 /* XP */
|
||||
|
||||
# ifndef _WIN32_WINNT
|
||||
# define _WIN32_WINNT VS2010_DEF_TARGET
|
||||
# endif
|
||||
# ifndef WINVER
|
||||
# define WINVER VS2010_DEF_TARGET
|
||||
# endif
|
||||
# if (_WIN32_WINNT < VS2010_MIN_TARGET) || (WINVER < VS2010_MIN_TARGET)
|
||||
# error VS2010 does not support build targets prior to Windows XP
|
||||
# endif
|
||||
# endif
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* HEADER FILES */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -156,6 +156,18 @@
|
|||
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#ifdef _WIN32
|
||||
# if defined(_WIN32_WINNT) && (_WIN32_WINNT < 0x0600)
|
||||
# error The minimum build target is Windows Vista (0x0600)
|
||||
# endif
|
||||
|
||||
# if !defined(CURL_WINDOWS_UWP) && (defined(_MSC_VER) || defined(__MINGW32__))
|
||||
# ifndef HAVE_IF_NAMETOINDEX
|
||||
# define HAVE_IF_NAMETOINDEX
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* ================================================================ */
|
||||
/* Definition of preprocessor macros/symbols which modify compiler */
|
||||
/* behavior or generated code characteristics must be done here, */
|
||||
|
|
|
|||
|
|
@ -41,11 +41,7 @@
|
|||
# define curl_mutex_t CRITICAL_SECTION
|
||||
# define curl_thread_t HANDLE
|
||||
# define curl_thread_t_null (HANDLE)0
|
||||
# if !defined(_WIN32_WINNT) || (_WIN32_WINNT < _WIN32_WINNT_VISTA)
|
||||
# define Curl_mutex_init(m) InitializeCriticalSection(m)
|
||||
# else
|
||||
# define Curl_mutex_init(m) InitializeCriticalSectionEx(m, 0, 1)
|
||||
# endif
|
||||
# define Curl_mutex_init(m) InitializeCriticalSectionEx(m, 0, 1)
|
||||
# define Curl_mutex_acquire(m) EnterCriticalSection(m)
|
||||
# define Curl_mutex_release(m) LeaveCriticalSection(m)
|
||||
# define Curl_mutex_destroy(m) DeleteCriticalSection(m)
|
||||
|
|
|
|||
|
|
@ -25,54 +25,26 @@
|
|||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include "version_win32.h"
|
||||
#include "../system_win32.h"
|
||||
|
||||
LARGE_INTEGER Curl_freq;
|
||||
bool Curl_isVistaOrGreater;
|
||||
|
||||
/* For tool or tests, we must initialize before calling curlx_now().
|
||||
Providing this function here is wrong. */
|
||||
void curlx_now_init(void)
|
||||
{
|
||||
if(curlx_verify_windows_version(6, 0, 0, PLATFORM_WINNT,
|
||||
VERSION_GREATER_THAN_EQUAL))
|
||||
Curl_isVistaOrGreater = true;
|
||||
else
|
||||
Curl_isVistaOrGreater = false;
|
||||
|
||||
QueryPerformanceFrequency(&Curl_freq);
|
||||
}
|
||||
|
||||
/* In case of bug fix this function has a counterpart in tool_util.c */
|
||||
void curlx_pnow(struct curltime *pnow)
|
||||
{
|
||||
bool isVistaOrGreater;
|
||||
isVistaOrGreater = Curl_isVistaOrGreater;
|
||||
if(isVistaOrGreater) { /* QPC timer might have issues pre-Vista */
|
||||
LARGE_INTEGER count;
|
||||
LARGE_INTEGER freq;
|
||||
freq = Curl_freq;
|
||||
DEBUGASSERT(freq.QuadPart);
|
||||
QueryPerformanceCounter(&count);
|
||||
pnow->tv_sec = (time_t)(count.QuadPart / freq.QuadPart);
|
||||
pnow->tv_usec = (int)((count.QuadPart % freq.QuadPart) * 1000000 /
|
||||
freq.QuadPart);
|
||||
}
|
||||
else {
|
||||
/* Disable /analyze warning that GetTickCount64 is preferred */
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:28159)
|
||||
#endif
|
||||
DWORD milliseconds = GetTickCount();
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
pnow->tv_sec = (time_t)(milliseconds / 1000);
|
||||
pnow->tv_usec = (int)((milliseconds % 1000) * 1000);
|
||||
}
|
||||
LARGE_INTEGER count;
|
||||
DEBUGASSERT(Curl_freq.QuadPart);
|
||||
QueryPerformanceCounter(&count);
|
||||
pnow->tv_sec = (time_t)(count.QuadPart / Curl_freq.QuadPart);
|
||||
pnow->tv_usec = (int)((count.QuadPart % Curl_freq.QuadPart) * 1000000 /
|
||||
Curl_freq.QuadPart);
|
||||
}
|
||||
|
||||
#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC) || \
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#define GLOBAL_INIT_IS_THREADSAFE
|
||||
|
||||
#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600
|
||||
#ifdef _WIN32
|
||||
|
||||
#define curl_simple_lock SRWLOCK
|
||||
#define CURL_SIMPLE_LOCK_INIT SRWLOCK_INIT
|
||||
|
|
@ -72,8 +72,6 @@ static CURL_INLINE void curl_simple_lock_lock(curl_simple_lock *lock)
|
|||
__builtin_ia32_pause();
|
||||
#elif defined(__aarch64__)
|
||||
__asm__ volatile("yield" ::: "memory");
|
||||
#elif defined(_WIN32)
|
||||
Sleep(1);
|
||||
#elif defined(HAVE_SCHED_YIELD)
|
||||
sched_yield();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -583,9 +583,6 @@ static CURLcode ftp_initiate_transfer(struct Curl_easy *data,
|
|||
size prior to the actual upload. */
|
||||
Curl_pgrsSetUploadSize(data, data->state.infilesize);
|
||||
|
||||
/* set the SO_SNDBUF for the secondary socket for those who need it */
|
||||
Curl_sndbuf_init(data->conn->sock[SECONDARYSOCKET]);
|
||||
|
||||
/* FTP upload, shutdown DATA, ignore shutdown errors, as we rely
|
||||
* on the server response on the CONTROL connection. */
|
||||
Curl_xfer_setup_send(data, SECONDARYSOCKET);
|
||||
|
|
|
|||
14
lib/idn.c
14
lib/idn.c
|
|
@ -143,20 +143,6 @@ static CURLcode mac_ascii_to_idn(const char *in, char **out)
|
|||
#ifdef USE_WIN32_IDN
|
||||
/* using Windows kernel32 and normaliz libraries. */
|
||||
|
||||
#if (!defined(_WIN32_WINNT) || _WIN32_WINNT < _WIN32_WINNT_VISTA) && \
|
||||
(!defined(WINVER) || WINVER < 0x600)
|
||||
WINBASEAPI int WINAPI IdnToAscii(DWORD dwFlags,
|
||||
const WCHAR *lpUnicodeCharStr,
|
||||
int cchUnicodeChar,
|
||||
WCHAR *lpASCIICharStr,
|
||||
int cchASCIIChar);
|
||||
WINBASEAPI int WINAPI IdnToUnicode(DWORD dwFlags,
|
||||
const WCHAR *lpASCIICharStr,
|
||||
int cchASCIIChar,
|
||||
WCHAR *lpUnicodeCharStr,
|
||||
int cchUnicodeChar);
|
||||
#endif
|
||||
|
||||
#define IDN_MAX_LENGTH 255
|
||||
|
||||
static char *idn_curlx_convert_wchar_to_UTF8(const wchar_t *str_w, int chars)
|
||||
|
|
|
|||
|
|
@ -35,8 +35,7 @@
|
|||
|
||||
#ifdef _WIN32
|
||||
|
||||
#if defined(_WIN32_WINNT) && _WIN32_WINNT >= _WIN32_WINNT_VISTA && \
|
||||
!defined(CURL_WINDOWS_UWP)
|
||||
#ifndef CURL_WINDOWS_UWP
|
||||
# define HAVE_WIN_BCRYPTGENRANDOM
|
||||
# include <bcrypt.h>
|
||||
# ifdef _MSC_VER
|
||||
|
|
|
|||
|
|
@ -90,12 +90,6 @@
|
|||
* newer symbols.
|
||||
*/
|
||||
|
||||
#ifndef _WIN32_WINNT_WINXP
|
||||
#define _WIN32_WINNT_WINXP 0x0501 /* Windows XP */
|
||||
#endif
|
||||
#ifndef _WIN32_WINNT_WS03
|
||||
#define _WIN32_WINNT_WS03 0x0502 /* Windows Server 2003 */
|
||||
#endif
|
||||
#ifndef _WIN32_WINNT_VISTA
|
||||
#define _WIN32_WINNT_VISTA 0x0600 /* Windows Vista */
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -181,11 +181,6 @@ struct sha256_ctx {
|
|||
};
|
||||
typedef struct sha256_ctx my_sha256_ctx;
|
||||
|
||||
/* Offered when targeting Vista (XP SP2+) */
|
||||
#ifndef CALG_SHA_256
|
||||
#define CALG_SHA_256 0x0000800c
|
||||
#endif
|
||||
|
||||
static CURLcode my_sha256_init(void *in)
|
||||
{
|
||||
my_sha256_ctx *ctx = (my_sha256_ctx *)in;
|
||||
|
|
|
|||
|
|
@ -26,20 +26,8 @@
|
|||
#ifdef _WIN32
|
||||
|
||||
#include "system_win32.h"
|
||||
#include "curlx/version_win32.h"
|
||||
#include "curl_sspi.h"
|
||||
|
||||
#ifndef HAVE_IF_NAMETOINDEX
|
||||
/* Handle of iphlpapp.dll */
|
||||
static HMODULE s_hIpHlpApiDll = NULL;
|
||||
|
||||
/* Pointer to the if_nametoindex function */
|
||||
IF_NAMETOINDEX_FN Curl_if_nametoindex = NULL;
|
||||
|
||||
/* This is used to dynamically load DLLs */
|
||||
static HMODULE curl_load_library(LPCTSTR filename);
|
||||
#endif
|
||||
|
||||
/* Curl_win32_init() performs Win32 global initialization */
|
||||
CURLcode Curl_win32_init(long flags)
|
||||
{
|
||||
|
|
@ -88,28 +76,6 @@ CURLcode Curl_win32_init(long flags)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_IF_NAMETOINDEX
|
||||
s_hIpHlpApiDll = curl_load_library(TEXT("iphlpapi.dll"));
|
||||
if(s_hIpHlpApiDll) {
|
||||
/* Get the address of the if_nametoindex function */
|
||||
IF_NAMETOINDEX_FN pIfNameToIndex =
|
||||
CURLX_FUNCTION_CAST(IF_NAMETOINDEX_FN,
|
||||
GetProcAddress(s_hIpHlpApiDll, "if_nametoindex"));
|
||||
|
||||
if(pIfNameToIndex)
|
||||
Curl_if_nametoindex = pIfNameToIndex;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* curlx_verify_windows_version must be called during init at least once
|
||||
because it has its own initialization routine. */
|
||||
if(curlx_verify_windows_version(6, 0, 0, PLATFORM_WINNT,
|
||||
VERSION_GREATER_THAN_EQUAL)) {
|
||||
Curl_isVistaOrGreater = TRUE;
|
||||
}
|
||||
else
|
||||
Curl_isVistaOrGreater = FALSE;
|
||||
|
||||
QueryPerformanceFrequency(&Curl_freq);
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
|
@ -117,14 +83,6 @@ CURLcode Curl_win32_init(long flags)
|
|||
/* Curl_win32_cleanup() is the opposite of Curl_win32_init() */
|
||||
void Curl_win32_cleanup(long init_flags)
|
||||
{
|
||||
#ifndef HAVE_IF_NAMETOINDEX
|
||||
if(s_hIpHlpApiDll) {
|
||||
FreeLibrary(s_hIpHlpApiDll);
|
||||
s_hIpHlpApiDll = NULL;
|
||||
Curl_if_nametoindex = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_WINDOWS_SSPI
|
||||
Curl_sspi_global_cleanup();
|
||||
#endif
|
||||
|
|
@ -136,104 +94,4 @@ void Curl_win32_cleanup(long init_flags)
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef HAVE_IF_NAMETOINDEX
|
||||
|
||||
#ifndef LOAD_WITH_ALTERED_SEARCH_PATH
|
||||
#define LOAD_WITH_ALTERED_SEARCH_PATH 0x00000008
|
||||
#endif
|
||||
|
||||
#ifndef LOAD_LIBRARY_SEARCH_SYSTEM32
|
||||
#define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
|
||||
#endif
|
||||
|
||||
/* We use our own typedef here since some headers might lack these */
|
||||
typedef HMODULE (APIENTRY *LOADLIBRARYEX_FN)(LPCTSTR, HANDLE, DWORD);
|
||||
|
||||
/* See function definitions in winbase.h */
|
||||
#ifdef UNICODE
|
||||
# define LOADLIBARYEX "LoadLibraryExW"
|
||||
#else
|
||||
# define LOADLIBARYEX "LoadLibraryExA"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* curl_load_library()
|
||||
*
|
||||
* This is used to dynamically load DLLs using the most secure method available
|
||||
* for the version of Windows that we are running on.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* filename [in] - The filename or full path of the DLL to load. If only the
|
||||
* filename is passed then the DLL will be loaded from the
|
||||
* Windows system directory.
|
||||
*
|
||||
* Returns the handle of the module on success; otherwise NULL.
|
||||
*/
|
||||
static HMODULE curl_load_library(LPCTSTR filename)
|
||||
{
|
||||
#ifndef CURL_WINDOWS_UWP
|
||||
HMODULE hModule = NULL;
|
||||
LOADLIBRARYEX_FN pLoadLibraryEx = NULL;
|
||||
|
||||
/* Get a handle to kernel32 so we can access its functions at runtime */
|
||||
HMODULE hKernel32 = GetModuleHandle(TEXT("kernel32"));
|
||||
if(!hKernel32)
|
||||
return NULL;
|
||||
|
||||
/* Attempt to find LoadLibraryEx() which is only available on Windows 2000
|
||||
and above */
|
||||
pLoadLibraryEx =
|
||||
CURLX_FUNCTION_CAST(LOADLIBRARYEX_FN,
|
||||
GetProcAddress(hKernel32, LOADLIBARYEX));
|
||||
|
||||
/* Detect if there is already a path in the filename and load the library if
|
||||
there is. Note: Both back slashes and forward slashes have been supported
|
||||
since the earlier days of DOS at an API level although they are not
|
||||
supported by command prompt */
|
||||
if(_tcspbrk(filename, TEXT("\\/"))) {
|
||||
/** !checksrc! disable BANNEDFUNC 1 **/
|
||||
hModule = pLoadLibraryEx ?
|
||||
pLoadLibraryEx(filename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH) :
|
||||
LoadLibrary(filename);
|
||||
}
|
||||
/* Detect if KB2533623 is installed, as LOAD_LIBRARY_SEARCH_SYSTEM32 is only
|
||||
supported on Windows Vista, Windows Server 2008, Windows 7 and Windows
|
||||
Server 2008 R2 with this patch or natively on Windows 8 and above */
|
||||
else if(pLoadLibraryEx && GetProcAddress(hKernel32, "AddDllDirectory")) {
|
||||
/* Load the DLL from the Windows system directory */
|
||||
hModule = pLoadLibraryEx(filename, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||
}
|
||||
else {
|
||||
/* Attempt to get the Windows system path */
|
||||
UINT systemdirlen = GetSystemDirectory(NULL, 0);
|
||||
if(systemdirlen) {
|
||||
/* Allocate space for the full DLL path (Room for the null-terminator
|
||||
is included in systemdirlen) */
|
||||
size_t filenamelen = _tcslen(filename);
|
||||
TCHAR *path = curlx_malloc(sizeof(TCHAR) *
|
||||
(systemdirlen + 1 + filenamelen));
|
||||
if(path && GetSystemDirectory(path, systemdirlen)) {
|
||||
/* Calculate the full DLL path */
|
||||
_tcscpy(path + _tcslen(path), TEXT("\\"));
|
||||
_tcscpy(path + _tcslen(path), filename);
|
||||
|
||||
/* Load the DLL from the Windows system directory */
|
||||
/** !checksrc! disable BANNEDFUNC 1 **/
|
||||
hModule = pLoadLibraryEx ?
|
||||
pLoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH) :
|
||||
LoadLibrary(path);
|
||||
}
|
||||
curlx_free(path);
|
||||
}
|
||||
}
|
||||
return hModule;
|
||||
#else
|
||||
/* the Universal Windows Platform (UWP) cannot do this */
|
||||
(void)filename;
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
#endif /* !HAVE_IF_NAMETOINDEX */
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
|
|
|||
|
|
@ -26,21 +26,11 @@
|
|||
#include "curl_setup.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
extern LARGE_INTEGER Curl_freq;
|
||||
extern bool Curl_isVistaOrGreater;
|
||||
|
||||
CURLcode Curl_win32_init(long flags);
|
||||
void Curl_win32_cleanup(long init_flags);
|
||||
|
||||
#ifndef HAVE_IF_NAMETOINDEX
|
||||
/* We use our own typedef here since some headers might lack this */
|
||||
typedef unsigned int(WINAPI *IF_NAMETOINDEX_FN)(const char *);
|
||||
|
||||
/* This is used instead of if_nametoindex if available on Windows */
|
||||
extern IF_NAMETOINDEX_FN Curl_if_nametoindex;
|
||||
#endif
|
||||
#else /* !_WIN32 */
|
||||
#else
|
||||
#define Curl_win32_init(x) CURLE_OK
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
|
|
|||
13
lib/url.c
13
lib/url.c
|
|
@ -1675,7 +1675,7 @@ static void zonefrom_url(CURLU *uh, struct Curl_easy *data,
|
|||
{
|
||||
char *zoneid;
|
||||
CURLUcode uc = curl_url_get(uh, CURLUPART_ZONEID, &zoneid, 0);
|
||||
#ifdef CURL_DISABLE_VERBOSE_STRINGS
|
||||
#if !defined(HAVE_IF_NAMETOINDEX) || defined(CURL_DISABLE_VERBOSE_STRINGS)
|
||||
(void)data;
|
||||
#endif
|
||||
|
||||
|
|
@ -1687,18 +1687,9 @@ static void zonefrom_url(CURLU *uh, struct Curl_easy *data,
|
|||
conn->scope_id = (unsigned int)scope;
|
||||
#ifdef HAVE_IF_NAMETOINDEX
|
||||
else {
|
||||
#elif defined(_WIN32)
|
||||
else if(Curl_if_nametoindex) {
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_IF_NAMETOINDEX) || defined(_WIN32)
|
||||
/* Zone identifier is not numeric */
|
||||
unsigned int scopeidx = 0;
|
||||
#ifdef HAVE_IF_NAMETOINDEX
|
||||
scopeidx = if_nametoindex(zoneid);
|
||||
#else
|
||||
scopeidx = Curl_if_nametoindex(zoneid);
|
||||
#endif
|
||||
if(!scopeidx) {
|
||||
#ifndef CURL_DISABLE_VERBOSE_STRINGS
|
||||
char buffer[STRERROR_LEN];
|
||||
|
|
@ -1709,7 +1700,7 @@ static void zonefrom_url(CURLU *uh, struct Curl_easy *data,
|
|||
else
|
||||
conn->scope_id = scopeidx;
|
||||
}
|
||||
#endif /* HAVE_IF_NAMETOINDEX || _WIN32 */
|
||||
#endif /* HAVE_IF_NAMETOINDEX */
|
||||
|
||||
curlx_free(zoneid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,11 +105,6 @@
|
|||
* #define failf(x, y, ...) curl_mprintf(y, __VA_ARGS__)
|
||||
*/
|
||||
|
||||
/* Offered when targeting Vista (XP SP2+) */
|
||||
#ifndef CALG_SHA_256
|
||||
#define CALG_SHA_256 0x0000800c
|
||||
#endif
|
||||
|
||||
/* Offered by mingw-w64 v4+. MS SDK 6.0A+. */
|
||||
#ifndef PKCS12_NO_PERSIST_KEY
|
||||
#define PKCS12_NO_PERSIST_KEY 0x00008000
|
||||
|
|
@ -221,99 +216,48 @@ static const struct algo algs[] = {
|
|||
CIPHEROPTION(CALG_MAC),
|
||||
CIPHEROPTION(CALG_RSA_SIGN),
|
||||
CIPHEROPTION(CALG_DSS_SIGN),
|
||||
/* ifdefs for the options that are defined conditionally in wincrypt.h */
|
||||
#ifdef CALG_NO_SIGN
|
||||
CIPHEROPTION(CALG_NO_SIGN),
|
||||
#endif
|
||||
CIPHEROPTION(CALG_RSA_KEYX),
|
||||
CIPHEROPTION(CALG_DES),
|
||||
#ifdef CALG_3DES_112
|
||||
CIPHEROPTION(CALG_3DES_112),
|
||||
#endif
|
||||
CIPHEROPTION(CALG_3DES),
|
||||
CIPHEROPTION(CALG_DESX),
|
||||
CIPHEROPTION(CALG_RC2),
|
||||
CIPHEROPTION(CALG_RC4),
|
||||
CIPHEROPTION(CALG_SEAL),
|
||||
#ifdef CALG_DH_SF
|
||||
CIPHEROPTION(CALG_DH_SF),
|
||||
#endif
|
||||
CIPHEROPTION(CALG_DH_EPHEM),
|
||||
#ifdef CALG_AGREEDKEY_ANY
|
||||
CIPHEROPTION(CALG_AGREEDKEY_ANY),
|
||||
#endif
|
||||
#ifdef CALG_HUGHES_MD5
|
||||
CIPHEROPTION(CALG_HUGHES_MD5),
|
||||
#endif
|
||||
CIPHEROPTION(CALG_SKIPJACK),
|
||||
#ifdef CALG_TEK
|
||||
CIPHEROPTION(CALG_TEK),
|
||||
#endif
|
||||
CIPHEROPTION(CALG_CYLINK_MEK), /* spellchecker:disable-line */
|
||||
CIPHEROPTION(CALG_SSL3_SHAMD5),
|
||||
#ifdef CALG_SSL3_MASTER
|
||||
CIPHEROPTION(CALG_SSL3_MASTER),
|
||||
#endif
|
||||
#ifdef CALG_SCHANNEL_MASTER_HASH
|
||||
CIPHEROPTION(CALG_SCHANNEL_MASTER_HASH),
|
||||
#endif
|
||||
#ifdef CALG_SCHANNEL_MAC_KEY
|
||||
CIPHEROPTION(CALG_SCHANNEL_MAC_KEY),
|
||||
#endif
|
||||
#ifdef CALG_SCHANNEL_ENC_KEY
|
||||
CIPHEROPTION(CALG_SCHANNEL_ENC_KEY),
|
||||
#endif
|
||||
#ifdef CALG_PCT1_MASTER
|
||||
CIPHEROPTION(CALG_PCT1_MASTER),
|
||||
#endif
|
||||
#ifdef CALG_SSL2_MASTER
|
||||
CIPHEROPTION(CALG_SSL2_MASTER),
|
||||
#endif
|
||||
#ifdef CALG_TLS1_MASTER
|
||||
CIPHEROPTION(CALG_TLS1_MASTER),
|
||||
#endif
|
||||
#ifdef CALG_RC5
|
||||
CIPHEROPTION(CALG_RC5),
|
||||
#endif
|
||||
#ifdef CALG_HMAC
|
||||
CIPHEROPTION(CALG_HMAC),
|
||||
#endif
|
||||
#ifdef CALG_TLS1PRF
|
||||
CIPHEROPTION(CALG_TLS1PRF),
|
||||
#endif
|
||||
#ifdef CALG_HASH_REPLACE_OWF
|
||||
CIPHEROPTION(CALG_HASH_REPLACE_OWF),
|
||||
#endif
|
||||
#ifdef CALG_AES_128
|
||||
CIPHEROPTION(CALG_AES_128),
|
||||
#endif
|
||||
#ifdef CALG_AES_192
|
||||
CIPHEROPTION(CALG_AES_192),
|
||||
#endif
|
||||
#ifdef CALG_AES_256
|
||||
CIPHEROPTION(CALG_AES_256),
|
||||
#endif
|
||||
#ifdef CALG_AES
|
||||
CIPHEROPTION(CALG_AES),
|
||||
#endif
|
||||
#ifdef CALG_SHA_256
|
||||
CIPHEROPTION(CALG_SHA_256),
|
||||
#endif
|
||||
#ifdef CALG_SHA_384
|
||||
CIPHEROPTION(CALG_SHA_384),
|
||||
#endif
|
||||
#ifdef CALG_SHA_512
|
||||
CIPHEROPTION(CALG_SHA_512),
|
||||
#endif
|
||||
#ifdef CALG_ECDH
|
||||
CIPHEROPTION(CALG_ECDH),
|
||||
#endif
|
||||
/* Offered by mingw-w64 v4+. MS SDK 6.0A+. */
|
||||
#ifdef CALG_ECMQV
|
||||
CIPHEROPTION(CALG_ECMQV),
|
||||
#endif
|
||||
#ifdef CALG_ECDSA
|
||||
CIPHEROPTION(CALG_ECDSA),
|
||||
#endif
|
||||
/* Offered by mingw-w64 v7+. MS SDK 7.0A+. */
|
||||
#ifdef CALG_ECDH_EPHEM
|
||||
CIPHEROPTION(CALG_ECDH_EPHEM),
|
||||
#endif
|
||||
|
|
@ -613,12 +557,8 @@ static CURLcode schannel_acquire_credential_handle(struct Curl_cfilter *cf,
|
|||
else
|
||||
pszPassword[0] = 0;
|
||||
|
||||
if(Curl_isVistaOrGreater)
|
||||
cert_store = PFXImportCertStore(&datablob, pszPassword,
|
||||
PKCS12_NO_PERSIST_KEY);
|
||||
else
|
||||
cert_store = PFXImportCertStore(&datablob, pszPassword, 0);
|
||||
|
||||
cert_store = PFXImportCertStore(&datablob, pszPassword,
|
||||
PKCS12_NO_PERSIST_KEY);
|
||||
curlx_free(pszPassword);
|
||||
}
|
||||
if(!blob)
|
||||
|
|
@ -858,14 +798,6 @@ static CURLcode schannel_connect_step1(struct Curl_cfilter *cf,
|
|||
DEBUGF(infof(data, "schannel: SSL/TLS connection with %s port %d (step 1/3)",
|
||||
connssl->peer.hostname, connssl->peer.port));
|
||||
|
||||
if(curlx_verify_windows_version(5, 1, 0, PLATFORM_WINNT,
|
||||
VERSION_LESS_THAN_EQUAL)) {
|
||||
/* Schannel in Windows XP (OS version 5.1) uses legacy handshakes and
|
||||
algorithms that may not be supported by all servers. */
|
||||
infof(data, "schannel: Windows version is old and may not be able to "
|
||||
"connect to some servers due to lack of SNI, algorithms, etc.");
|
||||
}
|
||||
|
||||
#ifdef HAS_ALPN_SCHANNEL
|
||||
backend->use_alpn = connssl->alpn && s_win_has_alpn;
|
||||
#else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue