misc/85185: Env Parser problem in libfetch

Conall O'Brien conallob=freebsd at maths.tcd.ie
Sun Aug 21 13:50:01 GMT 2005


>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 at 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 at 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:


More information about the freebsd-bugs mailing list