Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Aug 2005 14:40:38 +0100 (BST)
From:      "Conall O'Brien" <conallob=freebsd@maths.tcd.ie>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        David Malone <dwmalone@FreeBSD.org>, Ian Dowse <iedowse@FreeBSD.org>
Subject:   misc/85185: Env Parser problem in libfetch
Message-ID:  <200508211440.aa07330@walton.maths.tcd.ie>
Resent-Message-ID: <200508211350.j7LDo0Rj082877@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         85185
>Category:       misc
>Synopsis:       Env Parser problem in libfetch
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 21 13:50:00 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Conall O'Brien
>Release:        FreeBSD 4.11-STABLE i386
>Organization:
>Environment:
System: 
FreeBSD walton.maths.tcd.ie 4.11-STABLE FreeBSD 4.11-STABLE #25: Mon May 9 11:36:51 BST 2005 conallob@gosset.maths.tcd.ie:/mnt/obj/usr/src/sys/WALTON i386

FreeBSD sweetums.infocad.ie 5.4-STABLE FreeBSD 5.4-STABLE #4: Fri Aug  5 15:29:22 IST 2005     conall@sweetums.infocad.ie:/usr/src/obj/usr/src/sys/SWEETUMS  alpha

>Description:
fetch misunderstands envirometal variables http_proxy and HTTP_PROXY, 
if set to ""

As a result, fetch assumes the proxy host is "" and the proxy port is 
3124 and fails every time


An example:

fetch -vv http://www.google.com
scheme:   [http]
user:     []
password: []
host:     [www.google.com]
port:     [0]
document: [/]
scheme:   []
user:     []
password: []
host:     []
port:     [0]
document: [/]
---> :3128
looking up 
fetch: http://www.google.com: Host not found

>How-To-Repeat:
Behaviour has been reproduced on RELENG_4 and RELENG_5.

Set HTTP_PROXY or http_proxy to working proxy config, or unset 
variables accordingly and fetch works as expected.

(setenv | export) HTTP_PROXY or http_proxy to "" and fetch fails.
>Fix:
Use the same parser checks from src/lib/libfetch/ftp.c in 
src/lib/libfetch/http.c


--- http.c.orig Sun Aug 21 14:19:26 2005
+++ http.c      Sun Aug 21 14:22:26 2005
@@ -717,7 +717,7 @@
        if (flags != NULL && strchr(flags, 'd') != NULL)
                return (NULL);
        if (((p = getenv("HTTP_PROXY")) || (p = getenv("http_proxy"))) &&
-           (purl = fetchParseURL(p))) {
+           *p && (purl = fetchParseURL(p)) =! NULL) {
                if (!*purl->scheme)
                  strcpy(purl->scheme, SCHEME_HTTP);
                if (!purl->port)
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200508211440.aa07330>