Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 412579 | Differences between
and this patch

Collapse All | Expand All

(-)wget-1.13.4_orig/configure.ac (+16 lines)
Lines 338-343 Link Here
338
  fi
338
  fi
339
fi
339
fi
340
340
341
dnl
342
dnl libproxy support
343
dnl
344
AC_ARG_ENABLE(libproxy,
345
  [  --enable-libproxy       libproxy support for system wide proxy configuration])
346
if test "${enable_libproxy}" != "no"
347
then
348
  PKG_CHECK_MODULES([libproxy], [libproxy-1.0], [enable_libproxy=yes], [enable_libproxy=no])
349
fi
350
if test "${enable_libproxy}" = "yes"
351
then
352
  AC_SUBST(libproxy_CFLAGS)
353
  AC_SUBST(libproxy_LIBS)
354
  AC_DEFINE([HAVE_LIBPROXY], 1, [Define when using libproxy])
355
fi
356
341
dnl **********************************************************************
357
dnl **********************************************************************
342
dnl Checks for IPv6
358
dnl Checks for IPv6
343
dnl **********************************************************************
359
dnl **********************************************************************
(-)wget-1.13.4_orig/doc/sample.wgetrc (+3 lines)
Lines 82-87 Link Here
82
# If you do not want to use proxy at all, set this to off.
82
# If you do not want to use proxy at all, set this to off.
83
#use_proxy = on
83
#use_proxy = on
84
84
85
# If you do not want to let libproxy handle proxies, set this to off.
86
#use_proxylib = on
87
85
# You can customize the retrieval outlook.  Valid options are default,
88
# You can customize the retrieval outlook.  Valid options are default,
86
# binary, mega and micro.
89
# binary, mega and micro.
87
#dot_style = default
90
#dot_style = default
(-)wget-1.13.4_orig/doc/sample.wgetrc.munged_for_texi_inclusion (+3 lines)
Lines 82-87 Link Here
82
# If you do not want to use proxy at all, set this to off.
82
# If you do not want to use proxy at all, set this to off.
83
#use_proxy = on
83
#use_proxy = on
84
84
85
# If you do not want to let libproxy handle proxies, set this to off.
86
#use_proxylib = on
87
85
# You can customize the retrieval outlook.  Valid options are default,
88
# You can customize the retrieval outlook.  Valid options are default,
86
# binary, mega and micro.
89
# binary, mega and micro.
87
#dot_style = default
90
#dot_style = default
(-)wget-1.13.4_orig/doc/wget.info (+8 lines)
Lines 2866-2871 Link Here
2866
     environment variables are set.  In that case it is the same as
2866
     environment variables are set.  In that case it is the same as
2867
     using `--no-proxy'.
2867
     using `--no-proxy'.
2868
2868
2869
use_proxylib = on/off
2870
     When set to off, don't use libproxy to handle proxies.
2871
     It only has effect if use_proxy above is on.
2872
2869
user = STRING
2873
user = STRING
2870
     Specify username STRING for both FTP and HTTP file retrieval.
2874
     Specify username STRING for both FTP and HTTP file retrieval.
2871
     This command can be overridden using the `ftp_user' and
2875
     This command can be overridden using the `ftp_user' and
Lines 2985-2990 Link Here
2985
     # If you do not want to use proxy at all, set this to off.
2989
     # If you do not want to use proxy at all, set this to off.
2986
     #use_proxy = on
2990
     #use_proxy = on
2987
2991
2992
     # If you use proxies but do not want them to be hadled by libproxy,
2993
     # set this to off.
2994
     #use_proxylib = on
2995
2988
     # You can customize the retrieval outlook.  Valid options are default,
2996
     # You can customize the retrieval outlook.  Valid options are default,
2989
     # binary, mega and micro.
2997
     # binary, mega and micro.
2990
     #dot_style = default
2998
     #dot_style = default
(-)wget-1.13.4_orig/src/init.c (+6 lines)
Lines 257-262 Link Here
257
  { "trustservernames", &opt.trustservernames,  cmd_boolean },
257
  { "trustservernames", &opt.trustservernames,  cmd_boolean },
258
  { "unlink",           &opt.unlink,            cmd_boolean },
258
  { "unlink",           &opt.unlink,            cmd_boolean },
259
  { "useproxy",         &opt.use_proxy,         cmd_boolean },
259
  { "useproxy",         &opt.use_proxy,         cmd_boolean },
260
#ifdef HAVE_LIBPROXY
261
  { "useproxylib",      &opt.use_proxylib,      cmd_boolean },
262
#endif
260
  { "user",             &opt.user,              cmd_string },
263
  { "user",             &opt.user,              cmd_string },
261
  { "useragent",        NULL,                   cmd_spec_useragent },
264
  { "useragent",        NULL,                   cmd_spec_useragent },
262
  { "useservertimestamps", &opt.useservertimestamps, cmd_boolean },
265
  { "useservertimestamps", &opt.useservertimestamps, cmd_boolean },
Lines 315-320 Link Here
315
  opt.htmlify = true;
318
  opt.htmlify = true;
316
  opt.http_keep_alive = true;
319
  opt.http_keep_alive = true;
317
  opt.use_proxy = true;
320
  opt.use_proxy = true;
321
#ifdef HAVE_LIBPROXY
322
  opt.use_proxylib = true;
323
#endif
318
  tmp = getenv ("no_proxy");
324
  tmp = getenv ("no_proxy");
319
  if (tmp)
325
  if (tmp)
320
    opt.no_proxy = sepstring (tmp);
326
    opt.no_proxy = sepstring (tmp);
(-)wget-1.13.4_orig/src/log.c (-2 / +3 lines)
Lines 41-46 Link Here
41
#include "utils.h"
41
#include "utils.h"
42
#include "log.h"
42
#include "log.h"
43
43
44
44
/* 2005-10-25 SMS.
45
/* 2005-10-25 SMS.
45
   VMS log files are often VFC record format, not stream, so fputs() can
46
   VMS log files are often VFC record format, not stream, so fputs() can
46
   produce multiple records, even when there's no newline terminator in
47
   produce multiple records, even when there's no newline terminator in
Lines 506-517 Link Here
506
  while (!done);
507
  while (!done);
507
}
508
}
508
509
509
#ifdef ENABLE_DEBUG
510
/* The same as logprintf(), but does anything only if opt.debug is
510
/* The same as logprintf(), but does anything only if opt.debug is
511
   true.  */
511
   true.  */
512
void
512
void
513
debug_logprintf (const char *fmt, ...)
513
debug_logprintf (const char *fmt, ...)
514
{
514
{
515
#ifdef ENABLE_DEBUG
515
  if (opt.debug)
516
  if (opt.debug)
516
    {
517
    {
517
      va_list args;
518
      va_list args;
Lines 531-538 Link Here
531
        }
532
        }
532
      while (!done);
533
      while (!done);
533
    }
534
    }
534
}
535
#endif /* ENABLE_DEBUG */
535
#endif /* ENABLE_DEBUG */
536
}
536
537
537
/* Open FILE and set up a logging stream.  If FILE cannot be opened,
538
/* Open FILE and set up a logging stream.  If FILE cannot be opened,
538
   exit with status of 1.  */
539
   exit with status of 1.  */
(-)wget-1.13.4_orig/src/main.c (+7 lines)
Lines 225-230 Link Here
225
    { "iri", 0, OPT_BOOLEAN, "iri", -1 },
225
    { "iri", 0, OPT_BOOLEAN, "iri", -1 },
226
    { "keep-session-cookies", 0, OPT_BOOLEAN, "keepsessioncookies", -1 },
226
    { "keep-session-cookies", 0, OPT_BOOLEAN, "keepsessioncookies", -1 },
227
    { "level", 'l', OPT_VALUE, "reclevel", -1 },
227
    { "level", 'l', OPT_VALUE, "reclevel", -1 },
228
#ifdef HAVE_LIBPROXY
229
    { "libproxy", 0, OPT_BOOLEAN, "useproxylib", -1 },
230
#endif
228
    { "limit-rate", 0, OPT_VALUE, "limitrate", -1 },
231
    { "limit-rate", 0, OPT_VALUE, "limitrate", -1 },
229
    { "load-cookies", 0, OPT_VALUE, "loadcookies", -1 },
232
    { "load-cookies", 0, OPT_VALUE, "loadcookies", -1 },
230
    { "local-encoding", 0, OPT_VALUE, "localencoding", -1 },
233
    { "local-encoding", 0, OPT_VALUE, "localencoding", -1 },
Lines 495-500 Link Here
495
       --random-wait             wait from 0.5*WAIT...1.5*WAIT secs between retrievals.\n"),
498
       --random-wait             wait from 0.5*WAIT...1.5*WAIT secs between retrievals.\n"),
496
    N_("\
499
    N_("\
497
       --no-proxy                explicitly turn off proxy.\n"),
500
       --no-proxy                explicitly turn off proxy.\n"),
501
#ifdef HAVE_LIBPROXY
502
    N_("\
503
       --no-libproxy             explicitly disable proxy handling by libproxy (only effective if proxy turned on).\n"),
504
#endif
498
    N_("\
505
    N_("\
499
  -Q,  --quota=NUMBER            set retrieval quota to NUMBER.\n"),
506
  -Q,  --quota=NUMBER            set retrieval quota to NUMBER.\n"),
500
    N_("\
507
    N_("\
(-)wget-1.13.4_orig/src/Makefile.am (-1 / +1 lines)
Lines 37-43 Link Here
37
37
38
# The following line is losing on some versions of make!
38
# The following line is losing on some versions of make!
39
DEFS     = @DEFS@ -DSYSTEM_WGETRC=\"$(sysconfdir)/wgetrc\" -DLOCALEDIR=\"$(localedir)\"
39
DEFS     = @DEFS@ -DSYSTEM_WGETRC=\"$(sysconfdir)/wgetrc\" -DLOCALEDIR=\"$(localedir)\"
40
LIBS     = @LIBICONV@ @LIBINTL@ @LIBS@ $(LIB_CLOCK_GETTIME)
40
LIBS     = @LIBICONV@ @LIBINTL@ @LIBS@ $(LIB_CLOCK_GETTIME) @libproxy_LIBS@
41
41
42
EXTRA_DIST = css.l css.c css_.c build_info.c.in
42
EXTRA_DIST = css.l css.c css_.c build_info.c.in
43
43
(-)wget-1.13.4_orig/src/options.h (+3 lines)
Lines 105-110 Link Here
105
  bool http_keep_alive;		/* whether we use keep-alive */
105
  bool http_keep_alive;		/* whether we use keep-alive */
106
106
107
  bool use_proxy;		/* Do we use proxy? */
107
  bool use_proxy;		/* Do we use proxy? */
108
#ifdef HAVE_LIBPROXY
109
  bool use_proxylib;		/* Do we let libproxy do proxy handling? (only relevant if use_proxy == true) */
110
#endif
108
  bool allow_cache;		/* Do we allow server-side caching? */
111
  bool allow_cache;		/* Do we allow server-side caching? */
109
  char *http_proxy, *ftp_proxy, *https_proxy;
112
  char *http_proxy, *ftp_proxy, *https_proxy;
110
  char **no_proxy;
113
  char **no_proxy;
(-)wget-1.13.4_orig/src/retr.c (-1 / +67 lines)
Lines 54-59 Link Here
54
#include "html-url.h"
54
#include "html-url.h"
55
#include "iri.h"
55
#include "iri.h"
56
56
57
#ifdef HAVE_LIBPROXY
58
#include "proxy.h"
59
#endif
60
57
/* Total size of downloaded files.  Used to enforce quota.  */
61
/* Total size of downloaded files.  Used to enforce quota.  */
58
SUM_SIZE_INT total_downloaded_bytes;
62
SUM_SIZE_INT total_downloaded_bytes;
59
63
Lines 1165-1171 Link Here
1165
  if (no_proxy_match (u->host, (const char **)opt.no_proxy))
1169
  if (no_proxy_match (u->host, (const char **)opt.no_proxy))
1166
    return NULL;
1170
    return NULL;
1167
1171
1168
  switch (u->scheme)
1172
  bool use_libproxy = false;
1173
1174
#ifdef HAVE_LIBPROXY
1175
  use_libproxy = opt.use_proxylib;
1176
  if(use_libproxy)
1177
  {
1178
    pxProxyFactory *pf = px_proxy_factory_new();
1179
    if (!pf)
1180
    {
1181
      debug_logprintf (_("retr.c, getproxy: Allocating memory for libproxy failed"));
1182
      return NULL;
1183
    }
1184
    int i; 
1185
    const char direct[] = "direct://";
1186
    struct url *proxy_url;
1187
    int up_error_code;
1188
    char *up_error;
1189
1190
    debug_logprintf (_("retr.c, getproxy: asking libproxy which proxy to use for url '%s'\n"), u->url);
1191
    char **proxies = px_proxy_factory_get_proxies(pf, u->url);
1192
    for(i=0; proxies[i]; i++)
1193
    {
1194
      if(strcmp(proxies[i] ,direct) != 0)
1195
      {
1196
        // verify we can connect to that proxy, otherwise move along to the next one
1197
        proxy_url = url_parse (proxies[i], &up_error_code, NULL, true);
1198
        if (proxy_url)
1199
        {
1200
          if (connect_to_host(proxy_url->host, proxy_url->port) > 0)
1201
          {
1202
            proxy = strdup(proxies[i]);
1203
          }
1204
          else
1205
          {
1206
            logprintf (LOG_NOTQUIET, _("retr.c, getproxy: Failed to connect to proxy URL %s\n"), proxies[i]);
1207
          }
1208
        }
1209
        else
1210
        {
1211
          up_error = url_error (proxies[i], up_error_code);
1212
          logprintf (LOG_NOTQUIET, _("retr.c, getproxy: Error parsing proxy URL %s: %s.\n"),
1213
                     proxies[i], up_error);
1214
          xfree (up_error);
1215
        }
1216
        url_free (proxy_url);
1217
        if (proxy && *proxy)
1218
        {
1219
          // found a valid proxy, interrupt the loop
1220
          break;
1221
        }
1222
      }
1223
    }
1224
    debug_logprintf (_("retr.c, getproxy: libproxy suggests to use '%s'\n"), proxy ? proxy : direct);
1225
    for(i=0; proxies[i]; i++) free(proxies[i]);
1226
    free(proxies);
1227
    px_proxy_factory_free(pf);
1228
  }
1229
#endif
1230
1231
  if (!use_libproxy && (!proxy || !*proxy))
1232
  {
1233
    switch (u->scheme)
1169
    {
1234
    {
1170
    case SCHEME_HTTP:
1235
    case SCHEME_HTTP:
1171
      proxy = opt.http_proxy ? opt.http_proxy : getenv ("http_proxy");
1236
      proxy = opt.http_proxy ? opt.http_proxy : getenv ("http_proxy");
Lines 1181-1186 Link Here
1181
    case SCHEME_INVALID:
1246
    case SCHEME_INVALID:
1182
      break;
1247
      break;
1183
    }
1248
    }
1249
  }
1184
  if (!proxy || !*proxy)
1250
  if (!proxy || !*proxy)
1185
    return NULL;
1251
    return NULL;
1186
1252

Return to bug 412579