Skip to content
Permalink
Browse files

Possible fixes for resource download failures caused by ac0715c, rela…

  • Loading branch information...
patrikjuvonen committed Jun 2, 2019
1 parent 526171c commit f5173464c04d9ed7b354082f6fd36deb912b3749
Showing with 27 additions and 8 deletions.
  1. +16 −2 vendor/curl/lib/config-win32.h
  2. +5 −2 vendor/curl/lib/conncache.c
  3. +6 −4 vendor/curl/lib/url.c
@@ -154,6 +154,11 @@
#define HAVE_WS2TCPIP_H 1
#endif

/* Define if you have the <Iphlpapi.h> header file. */
#ifndef __SALFORDC__
#define HAVE_IPHLPAPI_H 1
#endif

/* ---------------------------------------------------------------- */
/* OTHER HEADER INFO */
/* ---------------------------------------------------------------- */
@@ -188,6 +193,9 @@
/* Define to 1 if you have the `getpeername' function. */
#define HAVE_GETPEERNAME 1

/* Define to 1 if you have the getsockname function. */
#define HAVE_GETSOCKNAME 1

/* Define if you have the gethostbyaddr function. */
#define HAVE_GETHOSTBYADDR 1

@@ -582,8 +590,9 @@ Vista
# endif
#endif

/* Availability of freeaddrinfo, getaddrinfo and getnameinfo functions is
quite convoluted, compiler dependent and even build target dependent. */
/* Availability of freeaddrinfo, getaddrinfo, getnameinfo and if_nametoindex
functions is quite convoluted, compiler dependent and even build target
dependent. */
#if defined(HAVE_WS2TCPIP_H)
# if defined(__POCC__)
# define HAVE_FREEADDRINFO 1
@@ -602,6 +611,11 @@ Vista
# define HAVE_GETNAMEINFO 1
# endif
#endif
#if defined(HAVE_IPHLPAPI_H)
#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600)
#define HAVE_IF_NAMETOINDEX 1
#endif
#endif

#if defined(__POCC__)
# ifndef _MSC_VER
@@ -162,11 +162,14 @@ static void hashkey(struct connectdata *conn, char *buf,
size_t len) /* something like 128 is fine */
{
const char *hostname;
long port = conn->remote_port;

if(conn->bits.socksproxy)
hostname = conn->socks_proxy.host.name;
else if(conn->bits.httpproxy)
else if(conn->bits.httpproxy && !conn->bits.tunnel_proxy) {
hostname = conn->http_proxy.host.name;
port = conn->port;
}
else if(conn->bits.conn_to_host)
hostname = conn->conn_to_host.name;
else
@@ -175,7 +178,7 @@ static void hashkey(struct connectdata *conn, char *buf,
DEBUGASSERT(len > 32);

/* put the number first so that the hostname gets cut off if too long */
msnprintf(buf, len, "%ld%s", conn->port, hostname);
msnprintf(buf, len, "%ld%s", port, hostname);
}

void Curl_conncache_unlock(struct Curl_easy *data)
@@ -34,10 +34,12 @@
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#endif
#ifdef HAVE_IPHLPAPI_H
#include <Iphlpapi.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif

#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
@@ -439,7 +441,7 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data)

set->httpreq = HTTPREQ_GET; /* Default HTTP request */
set->rtspreq = RTSPREQ_OPTIONS; /* Default RTSP request */
#ifndef CURL_DISABLE_FILE
#ifndef CURL_DISABLE_FTP
set->ftp_use_epsv = TRUE; /* FTP defaults to EPSV operations */
set->ftp_use_eprt = TRUE; /* FTP defaults to EPRT operations */
set->ftp_use_pret = FALSE; /* mainly useful for drftpd servers */
@@ -1991,7 +1993,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
}
else {
unsigned long port = strtoul(data->state.up.port, NULL, 10);
conn->remote_port = curlx_ultous(port);
conn->port = conn->remote_port = curlx_ultous(port);
}

(void)curl_url_get(uh, CURLUPART_QUERY, &data->state.up.query, 0);
@@ -2298,7 +2300,7 @@ static CURLcode parse_proxy(struct Curl_easy *data,
struct connectdata *conn, char *proxy,
curl_proxytype proxytype)
{
char *portptr;
char *portptr = NULL;
long port = -1;
char *proxyuser = NULL;
char *proxypasswd = NULL;

1 comment on commit f517346

@ccw808

This comment has been minimized.

Copy link
Member

commented on f517346 Jun 3, 2019

Getting compile error curl_d.lib(url.obj) : error LNK2019: unresolved external symbol _if_nametoindex@4 referenced in function _parseurlandfillconn

To reproduce add following lines to the end of Client\loader\premake5.lua:

    filter {}
        defines { "CURL_STATICLIB" }
        links { "zlib", "ws2_32", "curl" }
        includedirs { "../../vendor/curl/include" }

and to the end of Client\loader\Main.cpp:

#include "curl/curl.h"
CURL* x = curl_easy_init();

Run win-create-projects.bat, load VS and build the Loader project

Please sign in to comment.
You can’t perform that action at this time.