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 |
#ifdef HAVE_LIBPROXY |
|
|
1173 |
pxProxyFactory *pf = px_proxy_factory_new(); |
1174 |
if (!pf) |
1175 |
{ |
1176 |
debug_logprintf (_("retr.c, getproxy: Allocating memory for libproxy failed")); |
1177 |
return NULL; |
1178 |
} |
1179 |
int i; |
1180 |
char direct[] = "direct://"; |
1181 |
|
1182 |
debug_logprintf (_("retr.c, getproxy: asking libproxy which proxy to use for url '%s'\n"), u->url); |
1183 |
char **proxies = px_proxy_factory_get_proxies(pf, u->url); |
1184 |
if (proxies[0]) |
1185 |
{ |
1186 |
char *check = NULL; |
1187 |
asprintf(&check , "%s", proxies[0]); |
1188 |
if(strcmp(check ,direct) != 0) |
1189 |
{ |
1190 |
asprintf(&proxy , "%s", proxies[0]); |
1191 |
} |
1192 |
debug_logprintf (_("retr.c, getproxy: libproxy suggests to use '%s'\n"), check); |
1193 |
} |
1194 |
for(i=0;proxies[i];i++) free(proxies[i]); |
1195 |
free(proxies); |
1196 |
free(pf); |
1197 |
#endif |
1198 |
|
1199 |
if (!proxy || !*proxy) |
1200 |
{ |
1201 |
switch (u->scheme) |
1169 |
{ |
1202 |
{ |
1170 |
case SCHEME_HTTP: |
1203 |
case SCHEME_HTTP: |
1171 |
proxy = opt.http_proxy ? opt.http_proxy : getenv ("http_proxy"); |
1204 |
proxy = opt.http_proxy ? opt.http_proxy : getenv ("http_proxy"); |
Lines 1183-1188
Link Here
|
1183 |
} |
1216 |
} |
1184 |
if (!proxy || !*proxy) |
1217 |
if (!proxy || !*proxy) |
1185 |
return NULL; |
1218 |
return NULL; |
|
|
1219 |
} |
1186 |
|
1220 |
|
1187 |
/* Handle shorthands. `rewritten_storage' is a kludge to allow |
1221 |
/* Handle shorthands. `rewritten_storage' is a kludge to allow |
1188 |
getproxy() to return static storage. */ |
1222 |
getproxy() to return static storage. */ |