2021-10-29 15:02:10 +02:00
|
|
|
Index: wget-1.21.2/configure.ac
|
2011-04-09 22:21:44 +02:00
|
|
|
===================================================================
|
2021-10-29 15:02:10 +02:00
|
|
|
--- wget-1.21.2.orig/configure.ac
|
|
|
|
+++ wget-1.21.2/configure.ac
|
|
|
|
@@ -654,6 +654,22 @@ else
|
2018-12-01 17:33:46 +01:00
|
|
|
fi
|
|
|
|
fi
|
2014-10-30 06:38:34 +01:00
|
|
|
|
2011-04-09 22:21:44 +02:00
|
|
|
+dnl
|
|
|
|
+dnl libproxy support
|
|
|
|
+dnl
|
|
|
|
+AC_ARG_ENABLE(libproxy,
|
|
|
|
+ [ --enable-libproxy libproxy support for system wide proxy configuration])
|
|
|
|
+if test "${enable_libproxy}" != "no"
|
|
|
|
+then
|
|
|
|
+ PKG_CHECK_MODULES([libproxy], [libproxy-1.0], [enable_libproxy=yes], [enable_libproxy=no])
|
|
|
|
+fi
|
|
|
|
+if test "${enable_libproxy}" = "yes"
|
|
|
|
+then
|
|
|
|
+ AC_SUBST(libproxy_CFLAGS)
|
|
|
|
+ AC_SUBST(libproxy_LIBS)
|
|
|
|
+ AC_DEFINE([HAVE_LIBPROXY], 1, [Define when using libproxy])
|
|
|
|
+fi
|
|
|
|
+
|
|
|
|
dnl **********************************************************************
|
|
|
|
dnl Checks for IPv6
|
|
|
|
dnl **********************************************************************
|
2021-10-29 15:02:10 +02:00
|
|
|
Index: wget-1.21.2/src/Makefile.am
|
2011-04-09 22:21:44 +02:00
|
|
|
===================================================================
|
2021-10-29 15:02:10 +02:00
|
|
|
--- wget-1.21.2.orig/src/Makefile.am
|
|
|
|
+++ wget-1.21.2/src/Makefile.am
|
2021-01-07 14:43:06 +01:00
|
|
|
@@ -63,7 +63,7 @@ wget_SOURCES = connect.c convert.c cooki
|
2017-02-04 06:51:45 +01:00
|
|
|
nodist_wget_SOURCES = version.c
|
2021-10-29 15:02:10 +02:00
|
|
|
EXTRA_wget_SOURCES = iri.c metalink.c xattr.c
|
2021-01-07 14:43:06 +01:00
|
|
|
LDADD = $(CODE_COVERAGE_LIBS) $(LIBOBJS) ../lib/libgnu.a $(GETADDRINFO_LIB) $(HOSTENT_LIB)\
|
2017-02-04 06:51:45 +01:00
|
|
|
- $(INET_NTOP_LIB) $(LIBSOCKET) $(LIB_CLOCK_GETTIME) $(LIB_CRYPTO)\
|
|
|
|
+ $(INET_NTOP_LIB) $(LIBSOCKET) $(libproxy_LIBS) $(LIB_CLOCK_GETTIME) $(LIB_CRYPTO)\
|
2017-02-18 13:04:58 +01:00
|
|
|
$(LIB_NANOSLEEP) $(LIB_POSIX_SPAWN) $(LIB_SELECT) $(LIBICONV) $(LIBINTL)\
|
|
|
|
$(LIBTHREAD) $(LIBUNISTRING) $(SERVENT_LIB)
|
2021-01-07 14:43:06 +01:00
|
|
|
AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib $(CODE_COVERAGE_CPPFLAGS)
|
2021-10-29 15:02:10 +02:00
|
|
|
Index: wget-1.21.2/src/retr.c
|
2014-01-23 22:22:02 +01:00
|
|
|
===================================================================
|
2021-10-29 15:02:10 +02:00
|
|
|
--- wget-1.21.2.orig/src/retr.c
|
|
|
|
+++ wget-1.21.2/src/retr.c
|
2018-12-01 17:33:46 +01:00
|
|
|
@@ -61,6 +61,10 @@ as that of the covered work. */
|
2011-04-09 22:21:44 +02:00
|
|
|
#include "iri.h"
|
2015-11-18 13:56:06 +01:00
|
|
|
#include "hsts.h"
|
2011-04-09 22:21:44 +02:00
|
|
|
|
|
|
|
+#ifdef HAVE_LIBPROXY
|
|
|
|
+#include "proxy.h"
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
/* Total size of downloaded files. Used to enforce quota. */
|
2021-10-29 15:02:10 +02:00
|
|
|
wgint total_downloaded_bytes;
|
2011-04-09 22:21:44 +02:00
|
|
|
|
2021-10-29 15:02:10 +02:00
|
|
|
@@ -1498,7 +1502,40 @@ getproxy (struct url *u)
|
2011-04-09 22:21:44 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!proxy || !*proxy)
|
|
|
|
+#ifdef HAVE_LIBPROXY
|
|
|
|
+ {
|
2017-02-18 13:04:58 +01:00
|
|
|
+ pxProxyFactory *pf = px_proxy_factory_new();
|
|
|
|
+ if (!pf)
|
|
|
|
+ {
|
|
|
|
+ debug_logprintf (_("Allocating memory for libproxy failed"));
|
|
|
|
+ return NULL;
|
|
|
|
+ }
|
2017-02-04 06:51:45 +01:00
|
|
|
+ int i;
|
|
|
|
+ char direct[] = "direct://";
|
2011-04-09 22:21:44 +02:00
|
|
|
+
|
2017-02-04 06:51:45 +01:00
|
|
|
+ debug_logprintf (_("asking libproxy about url '%s'\n"), u->url);
|
|
|
|
+ char **proxies = px_proxy_factory_get_proxies(pf, u->url);
|
|
|
|
+ if (proxies[0])
|
|
|
|
+ {
|
2017-02-18 13:04:58 +01:00
|
|
|
+ char *check = NULL;
|
|
|
|
+ asprintf(&check , "%s", proxies[0]);
|
|
|
|
+ debug_logprintf (_("libproxy suggest to use '%s'\n"), check);
|
|
|
|
+ if(strcmp(check ,direct) != 0)
|
|
|
|
+ {
|
|
|
|
+ asprintf(&proxy , "%s", proxies[0]);
|
|
|
|
+ debug_logprintf (_("case 2: libproxy setting to use '%s'\n"), proxy);
|
|
|
|
+ }
|
2017-02-04 06:51:45 +01:00
|
|
|
+ }
|
|
|
|
+ for(i=0;proxies[i];i++) free(proxies[i]);
|
|
|
|
+ free(proxies);
|
|
|
|
+ px_proxy_factory_free(pf);
|
|
|
|
+
|
2017-02-18 13:04:58 +01:00
|
|
|
+ if (!proxy || !*proxy)
|
|
|
|
+ return NULL;
|
2011-04-09 22:21:44 +02:00
|
|
|
+ }
|
|
|
|
+#else
|
|
|
|
return NULL;
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
/* Handle shorthands. `rewritten_storage' is a kludge to allow
|
|
|
|
getproxy() to return static storage. */
|
2021-10-29 15:02:10 +02:00
|
|
|
Index: wget-1.21.2/tests/Makefile.am
|
2014-10-30 06:38:34 +01:00
|
|
|
===================================================================
|
2021-10-29 15:02:10 +02:00
|
|
|
--- wget-1.21.2.orig/tests/Makefile.am
|
|
|
|
+++ wget-1.21.2/tests/Makefile.am
|
2021-01-07 14:43:06 +01:00
|
|
|
@@ -31,6 +31,7 @@
|
2014-12-24 18:36:14 +01:00
|
|
|
#
|
|
|
|
# Version: @VERSION@
|
2014-10-30 06:38:34 +01:00
|
|
|
#
|
2017-02-04 06:51:45 +01:00
|
|
|
++LIBS += $(libproxy_LIBS)
|
2014-10-30 06:38:34 +01:00
|
|
|
|
|
|
|
../src/wget$(EXEEXT):
|
|
|
|
cd ../src && $(MAKE) $(AM_MAKEFLAGS)
|