summaryrefslogtreecommitdiffstats
path: root/lib/libfetch/http.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2000-01-07 10:59:12 +0000
committerdes <des@FreeBSD.org>2000-01-07 10:59:12 +0000
commit1e930b38f85120ad766f987dbbe256d25f9f5fc2 (patch)
treef796672a55f7c9e6ba03a7cb4902b9ebcb02e504 /lib/libfetch/http.c
parent5a9ffb7f5aae940fea91a0088b42469832041093 (diff)
downloadFreeBSD-src-1e930b38f85120ad766f987dbbe256d25f9f5fc2.zip
FreeBSD-src-1e930b38f85120ad766f987dbbe256d25f9f5fc2.tar.gz
Patches I've had lying around for several months:
* Add the 'h' ftp flag (allocate local port in high range) * Add the 'd' flag (use direct connection even if proxy is defined) * Make sure flags != NULL before calling strchr(). * Minor changes to some comments.
Diffstat (limited to 'lib/libfetch/http.c')
-rw-r--r--lib/libfetch/http.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c
index 716d6c2..9b32bc2 100644
--- a/lib/libfetch/http.c
+++ b/lib/libfetch/http.c
@@ -293,13 +293,14 @@ _http_auth(char *usr, char *pwd)
FILE *
fetchGetHTTP(struct url *URL, char *flags)
{
- int sd = -1, e, i, enc = ENC_NONE, verbose;
+ int sd = -1, e, i, enc = ENC_NONE, direct, verbose;
struct cookie *c;
char *ln, *p, *px, *q;
FILE *f, *cf;
size_t len;
- verbose = (strchr(flags, 'v') != NULL);
+ direct = (flags && strchr(flags, 'd'));
+ verbose = (flags && strchr(flags, 'v'));
/* allocate cookie */
if ((c = calloc(1, sizeof(struct cookie))) == NULL)
@@ -310,14 +311,14 @@ fetchGetHTTP(struct url *URL, char *flags)
URL->port = 80; /* default HTTP port */
/* attempt to connect to proxy server */
- if ((px = getenv("HTTP_PROXY")) != NULL) {
+ if (!direct && (px = getenv("HTTP_PROXY")) != NULL) {
char host[MAXHOSTNAMELEN];
int port = 3128; /* XXX I think 3128 is default... check? */
/* measure length */
len = strcspn(px, ":");
- /* get port (atoi is a little too tolerant perhaps?) */
+ /* get port (XXX atoi is a little too tolerant perhaps?) */
if (px[len] == ':')
port = atoi(px+len+1);
OpenPOWER on IntegriCloud