From owner-svn-src-all@freebsd.org Sun Nov 29 14:27:01 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A077A3B3F3; Sun, 29 Nov 2015 14:27:01 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2EDA012C8; Sun, 29 Nov 2015 14:27:01 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tATER0As011246; Sun, 29 Nov 2015 14:27:00 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tATER0lb011244; Sun, 29 Nov 2015 14:27:00 GMT (envelope-from des@FreeBSD.org) Message-Id: <201511291427.tATER0lb011244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Sun, 29 Nov 2015 14:27:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r291453 - head/lib/libfetch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2015 14:27:01 -0000 Author: des Date: Sun Nov 29 14:26:59 2015 New Revision: 291453 URL: https://svnweb.freebsd.org/changeset/base/291453 Log: Use .netrc for HTTP sites and proxies, not just FTP. PR: 193740 Submitted by: TEUBEL György MFC after: 1 week Modified: head/lib/libfetch/fetch.3 head/lib/libfetch/http.c Modified: head/lib/libfetch/fetch.3 ============================================================================== --- head/lib/libfetch/fetch.3 Sun Nov 29 13:14:45 2015 (r291452) +++ head/lib/libfetch/fetch.3 Sun Nov 29 14:26:59 2015 (r291453) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 25, 2015 +.Dd November 29, 2015 .Dt FETCH 3 .Os .Sh NAME @@ -631,11 +631,11 @@ If defined but empty, no User-Agent head .It Ev NETRC Specifies a file to use instead of .Pa ~/.netrc -to look up login names and passwords for FTP sites. +to look up login names and passwords for FTP and HTTP sites as well as +HTTP proxies. See .Xr ftp 1 for a description of the file format. -This feature is experimental. .It Ev NO_PROXY Either a single asterisk, which disables the use of proxies altogether, or a comma- or whitespace-separated list of hosts for Modified: head/lib/libfetch/http.c ============================================================================== --- head/lib/libfetch/http.c Sun Nov 29 13:14:45 2015 (r291452) +++ head/lib/libfetch/http.c Sun Nov 29 14:26:59 2015 (r291453) @@ -1658,6 +1658,9 @@ http_request_body(struct url *URL, const http_seterr(HTTP_NEED_PROXY_AUTH); goto ouch; } + } else if (fetch_netrc_auth(purl) == 0) { + aparams.user = strdup(purl->user); + aparams.password = strdup(purl->pwd); } http_authorize(conn, "Proxy-Authorization", &proxy_challenges, &aparams, url); @@ -1685,6 +1688,11 @@ http_request_body(struct url *URL, const http_seterr(HTTP_NEED_AUTH); goto ouch; } + } else if (fetch_netrc_auth(url) == 0) { + aparams.user = url->user ? + strdup(url->user) : strdup(""); + aparams.password = url->pwd ? + strdup(url->pwd) : strdup(""); } else if (fetchAuthMethod && fetchAuthMethod(url) == 0) { aparams.user = strdup(url->user);