mirror of
https://github.com/sheumann/hush.git
synced 2024-11-05 21:04:56 +00:00
Patch from Matt Kraai to enable proxy support.
This commit is contained in:
parent
f57c944e09
commit
f3b2b52b58
@ -52,6 +52,7 @@ int wget_main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
FILE *sfp; /* socket to web server */
|
FILE *sfp; /* socket to web server */
|
||||||
char *uri_host, *uri_path; /* parsed from command line url */
|
char *uri_host, *uri_path; /* parsed from command line url */
|
||||||
|
char *proxy;
|
||||||
int uri_port;
|
int uri_port;
|
||||||
char *s, buf[512];
|
char *s, buf[512];
|
||||||
int n;
|
int n;
|
||||||
@ -101,10 +102,20 @@ int wget_main(int argc, char **argv)
|
|||||||
|
|
||||||
if (do_continue && !fname_out)
|
if (do_continue && !fname_out)
|
||||||
error_msg_and_die("cannot specify continue (-c) without a filename (-O)\n");
|
error_msg_and_die("cannot specify continue (-c) without a filename (-O)\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse url into components.
|
* Use the proxy if necessary.
|
||||||
*/
|
*/
|
||||||
parse_url(argv[optind], &uri_host, &uri_port, &uri_path);
|
if ((proxy = getenv("http_proxy")) != NULL) {
|
||||||
|
proxy = xstrdup(proxy);
|
||||||
|
parse_url(proxy, &uri_host, &uri_port, &uri_path);
|
||||||
|
uri_path = argv[optind];
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* Parse url into components.
|
||||||
|
*/
|
||||||
|
parse_url(argv[optind], &uri_host, &uri_port, &uri_path);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open socket to server.
|
* Open socket to server.
|
||||||
@ -475,7 +486,7 @@ progressmeter(int flag)
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: wget.c,v 1.10 2000/12/07 19:56:48 markw Exp $
|
* $Id: wget.c,v 1.11 2000/12/07 22:42:11 andersen Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -611,7 +611,7 @@ int full_read(int fd, char *buf, int len)
|
|||||||
* location, and do something (something specified
|
* location, and do something (something specified
|
||||||
* by the fileAction and dirAction function pointers).
|
* by the fileAction and dirAction function pointers).
|
||||||
*
|
*
|
||||||
* Unfortunatly, while nftw(3) could replace this and reduce
|
* Unfortunately, while nftw(3) could replace this and reduce
|
||||||
* code size a bit, nftw() wasn't supported before GNU libc 2.1,
|
* code size a bit, nftw() wasn't supported before GNU libc 2.1,
|
||||||
* and so isn't sufficiently portable to take over since glibc2.1
|
* and so isn't sufficiently portable to take over since glibc2.1
|
||||||
* is so stinking huge.
|
* is so stinking huge.
|
||||||
@ -1444,7 +1444,7 @@ extern void *xcalloc(size_t nmemb, size_t size)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined BB_FEATURE_NFSMOUNT || defined BB_SH || defined BB_LS
|
#if defined BB_FEATURE_NFSMOUNT || defined BB_LS || defined BB_SH || defined BB_WGET
|
||||||
# ifndef DMALLOC
|
# ifndef DMALLOC
|
||||||
extern char * xstrdup (const char *s) {
|
extern char * xstrdup (const char *s) {
|
||||||
char *t;
|
char *t;
|
||||||
|
17
wget.c
17
wget.c
@ -52,6 +52,7 @@ int wget_main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
FILE *sfp; /* socket to web server */
|
FILE *sfp; /* socket to web server */
|
||||||
char *uri_host, *uri_path; /* parsed from command line url */
|
char *uri_host, *uri_path; /* parsed from command line url */
|
||||||
|
char *proxy;
|
||||||
int uri_port;
|
int uri_port;
|
||||||
char *s, buf[512];
|
char *s, buf[512];
|
||||||
int n;
|
int n;
|
||||||
@ -101,10 +102,20 @@ int wget_main(int argc, char **argv)
|
|||||||
|
|
||||||
if (do_continue && !fname_out)
|
if (do_continue && !fname_out)
|
||||||
error_msg_and_die("cannot specify continue (-c) without a filename (-O)\n");
|
error_msg_and_die("cannot specify continue (-c) without a filename (-O)\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse url into components.
|
* Use the proxy if necessary.
|
||||||
*/
|
*/
|
||||||
parse_url(argv[optind], &uri_host, &uri_port, &uri_path);
|
if ((proxy = getenv("http_proxy")) != NULL) {
|
||||||
|
proxy = xstrdup(proxy);
|
||||||
|
parse_url(proxy, &uri_host, &uri_port, &uri_path);
|
||||||
|
uri_path = argv[optind];
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* Parse url into components.
|
||||||
|
*/
|
||||||
|
parse_url(argv[optind], &uri_host, &uri_port, &uri_path);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open socket to server.
|
* Open socket to server.
|
||||||
@ -475,7 +486,7 @@ progressmeter(int flag)
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: wget.c,v 1.10 2000/12/07 19:56:48 markw Exp $
|
* $Id: wget.c,v 1.11 2000/12/07 22:42:11 andersen Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user