From owner-freebsd-bugs@FreeBSD.ORG Fri Mar 16 13:30:02 2007 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 85F8016A402 for ; Fri, 16 Mar 2007 13:30:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id 603C513C46C for ; Fri, 16 Mar 2007 13:30:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l2GDU23Q043467 for ; Fri, 16 Mar 2007 13:30:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l2GDU2Za043466; Fri, 16 Mar 2007 13:30:02 GMT (envelope-from gnats) Resent-Date: Fri, 16 Mar 2007 13:30:02 GMT Resent-Message-Id: <200703161330.l2GDU2Za043466@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Alexander Pohoyda Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2C99F16A403 for ; Fri, 16 Mar 2007 13:23:04 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [69.147.83.33]) by mx1.freebsd.org (Postfix) with ESMTP id 1BC1113C45A for ; Fri, 16 Mar 2007 13:23:04 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l2GDN31S084405 for ; Fri, 16 Mar 2007 13:23:03 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id l2GDN3D4084352; Fri, 16 Mar 2007 13:23:03 GMT (envelope-from nobody) Message-Id: <200703161323.l2GDN3D4084352@www.freebsd.org> Date: Fri, 16 Mar 2007 13:23:03 GMT From: Alexander Pohoyda To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: misc/110388: Missing NO_PROXY support in fetch(3) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Mar 2007 13:30:02 -0000 >Number: 110388 >Category: misc >Synopsis: Missing NO_PROXY support in fetch(3) >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Mar 16 13:30:01 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Alexander Pohoyda >Release: 7.0 >Organization: SAP AG >Environment: There is no problem. This is a feature request. >Description: fetch(3) tool, which uses the libfetch library, supports HTTP_PROXY and FTP_PROXY env. variables. However, if the *_PROXY variable is set, there's no way to exclude some domain name suffixes from being requested over that proxy. This is very annoying. >How-To-Repeat: $ setenv HTTP_PROXY "proxy:8080" $ fetch http://some-remote.machine/some-file $ fetch http://local-machine/file The first fetch works, because we must use the proxy to request the external pages, but the second fetch does not work. >Fix: Please apply the attached patch. Patch attached with submission follows: --- ftp.c.orig Fri Mar 16 13:56:09 2007 +++ ftp.c Fri Mar 16 14:08:36 2007 @@ -924,6 +924,22 @@ { conn_t *conn; int oflag; + char *no_proxy, *no_proxy_item; + size_t b, s; + + if ((no_proxy = getenv("NO_PROXY")) != NULL) { + b = strlen(url->host); + while ((no_proxy_item = strsep(&no_proxy, ",")) != NULL) { + s = strlen(no_proxy_item); + if (b > s && strcasecmp(url->host + b - s, + no_proxy_item) == 0) { + /* disable proxy */ + fetchFreeURL(purl); + purl = NULL; + break; + } + } + } /* check if we should use HTTP instead */ if (purl && strcasecmp(purl->scheme, SCHEME_HTTP) == 0) { --- http.c.orig Fri Mar 16 13:56:04 2007 +++ http.c Fri Mar 16 14:06:32 2007 @@ -779,6 +779,22 @@ FILE *f; hdr_t h; char hbuf[MAXHOSTNAMELEN + 7], *host; + char *no_proxy, *no_proxy_item; + size_t b, s; + + if ((no_proxy = getenv("NO_PROXY")) != NULL) { + b = strlen(URL->host); + while ((no_proxy_item = strsep(&no_proxy, ",")) != NULL) { + s = strlen(no_proxy_item); + if (b > s && strcasecmp(URL->host + b - s, + no_proxy_item) == 0) { + /* disable proxy */ + fetchFreeURL(purl); + purl = NULL; + break; + } + } + } direct = CHECK_FLAG('d'); noredirect = CHECK_FLAG('A'); >Release-Note: >Audit-Trail: >Unformatted: