summaryrefslogtreecommitdiffstats
path: root/external/curl
diff options
context:
space:
mode:
authorThorsten Behrens <Thorsten.Behrens@CIB.de>2017-01-24 16:43:18 +0100
committerMichael Stahl <mstahl@redhat.com>2017-01-26 22:18:25 +0000
commit2be42d9480fc831144e4d5b216b0a01ffbdb5c8f (patch)
tree6b5d4ae3988b93b39f9d988f65ce71b4e752d9c3 /external/curl
parentupdate credits (diff)
downloadcore-2be42d9480fc831144e4d5b216b0a01ffbdb5c8f.tar.gz
core-2be42d9480fc831144e4d5b216b0a01ffbdb5c8f.zip
curl: get winProxy support back
with properly aligned asterisks Change-Id: I48b31bce45cdce378fa1cfdd9ddde82b9e669cf5 Reviewed-on: https://gerrit.libreoffice.org/33500 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'external/curl')
-rw-r--r--external/curl/curl-7.26.0_win-proxy.patch117
1 files changed, 117 insertions, 0 deletions
diff --git a/external/curl/curl-7.26.0_win-proxy.patch b/external/curl/curl-7.26.0_win-proxy.patch
index 7edf1b512b97..1c478868d7d2 100644
--- a/external/curl/curl-7.26.0_win-proxy.patch
+++ b/external/curl/curl-7.26.0_win-proxy.patch
@@ -9,3 +9,120 @@
CFLAGS = $(CFLAGS) $(EXCFLAGS)
CFGSET = FALSE
+--- curl-7.26.0/lib/url.c
++++ misc/build/curl-7.26.0/lib/url.c
+@@ -78,6 +78,10 @@
+ bool curl_win32_idn_to_ascii(const char *in, char **out);
+ #endif /* USE_LIBIDN2 */
+
++#ifdef _WIN32
++#include <WinHttp.h>
++#endif
++
+ #include "urldata.h"
+ #include "netrc.h"
+
+@@ -4586,6 +4590,21 @@
+ return FALSE;
+ }
+
++#ifdef _WIN32
++static char *wstrToCstr(LPWSTR wStr)
++{
++ int bufSize;
++ char *out = NULL;
++ if(wStr != NULL) {
++ bufSize = WideCharToMultiByte(
++ CP_ACP, 0, wStr, -1, NULL, 0, NULL, NULL);
++ out = (char *)malloc(bufSize * sizeof(char));
++ WideCharToMultiByte(CP_ACP, 0, wStr, -1, out, bufSize, NULL, NULL);
++ }
++ return out;
++}
++#endif
++
+ /****************************************************************
+ * Detect what (if any) proxy to use. Remember that this selects a host
+ * name and is not limited to HTTP proxies only.
+@@ -4594,6 +4613,7 @@
+ static char *detect_proxy(struct connectdata *conn)
+ {
+ char *proxy = NULL;
++ char *no_proxy=NULL;
+
+ #ifndef CURL_DISABLE_HTTP
+ /* If proxy was not specified, we check for default proxy environment
+@@ -4613,7 +4633,64 @@
+ * For compatibility, the all-uppercase versions of these variables are
+ * checked if the lowercase versions don't exist.
+ */
+- char *no_proxy=NULL;
++#ifdef _WIN32
++ WINHTTP_CURRENT_USER_IE_PROXY_CONFIG *ieProxyConfig;
++ ieProxyConfig = (WINHTTP_CURRENT_USER_IE_PROXY_CONFIG *)
++ malloc(sizeof(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG));
++ if(WinHttpGetIEProxyConfigForCurrentUser(ieProxyConfig)) {
++ if(!ieProxyConfig->fAutoDetect) {
++ char *ieProxy;
++ char *ieNoProxy;
++ char *pos;
++
++ ieProxy = wstrToCstr(ieProxyConfig->lpszProxy);
++ ieNoProxy = wstrToCstr(ieProxyConfig->lpszProxyBypass);
++
++ /* Convert the ieNoProxy into a proper no_proxy value */
++ if(NULL != ieNoProxy) {
++ no_proxy = strdup(ieNoProxy);
++ pos = strpbrk(no_proxy, "; ");
++ while(NULL != pos) {
++ no_proxy[pos-no_proxy] = ',';
++ pos = strpbrk(no_proxy, "; ");
++ }
++ }
++
++ if(!check_noproxy(conn->host.name, no_proxy)) {
++ /* Look for the http proxy setting */
++ char *tok;
++ char *saveptr;
++
++ if(NULL != ieProxy) {
++ tok = strtok_s(ieProxy, ";", &saveptr);
++ if(strchr(tok, '=') == NULL) {
++ proxy = strdup(ieProxy);
++ }
++ else {
++ do {
++ if(strncmp(tok, "http=", 5) == 0) {
++ /* We found HTTP proxy value, then use it */
++ proxy = strdup(tok + 5);
++ }
++ tok = strtok_s(NULL, ";", &saveptr);
++ }
++ while(NULL != tok);
++ }
++ }
++ }
++
++ free(ieProxy);
++ free(ieNoProxy);
++ }
++ else {
++ /* TODO Handle the Proxy config Auto Detection case */
++ }
++
++ GlobalFree(ieProxyConfig->lpszAutoConfigUrl);
++ GlobalFree(ieProxyConfig->lpszProxy);
++ GlobalFree(ieProxyConfig->lpszProxyBypass);
++ }
++#else /* !WIN32 */
+ char proxy_env[128];
+
+ no_proxy=curl_getenv("no_proxy");
+@@ -4663,6 +4739,7 @@
+ }
+ } /* if(!check_noproxy(conn->host.name, no_proxy)) - it wasn't specified
+ non-proxy */
++#endif /* WIN32 */
+ free(no_proxy);
+
+ #else /* !CURL_DISABLE_HTTP */