From owner-svn-src-all@FreeBSD.ORG Tue Jul 30 13:07:56 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3AA8340F; Tue, 30 Jul 2013 13:07:56 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0C82321D7; Tue, 30 Jul 2013 13:07:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r6UD7tBl022011; Tue, 30 Jul 2013 13:07:55 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r6UD7tCf022007; Tue, 30 Jul 2013 13:07:55 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201307301307.r6UD7tCf022007@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Tue, 30 Jul 2013 13:07:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r253805 - in head: lib/libfetch usr.bin/fetch 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.14 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: Tue, 30 Jul 2013 13:07:56 -0000 Author: des Date: Tue Jul 30 13:07:55 2013 New Revision: 253805 URL: http://svnweb.freebsd.org/changeset/base/253805 Log: Include an Accept header in requests. PR: kern/180917 MFC after: 1 week Modified: head/lib/libfetch/fetch.3 head/lib/libfetch/http.c head/usr.bin/fetch/fetch.1 Modified: head/lib/libfetch/fetch.3 ============================================================================== --- head/lib/libfetch/fetch.3 Tue Jul 30 13:05:51 2013 (r253804) +++ head/lib/libfetch/fetch.3 Tue Jul 30 13:07:55 2013 (r253805) @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 1998-2011 Dag-Erling Smørgrav +.\" Copyright (c) 1998-2013 Dag-Erling Smørgrav .\" Copyright (c) 2013 Michael Gmelin .\" All rights reserved. .\" @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 25, 2013 +.Dd July 30, 2013 .Dt FETCH 3 .Os .Sh NAME @@ -571,6 +571,15 @@ variable is set. Same as .Ev FTP_PROXY , for compatibility. +.It Ev HTTP_ACCEPT +Specifies the value of the +.Va Accept +header for HTTP requests. +If empty, no +.Va Accept +header is sent. +The default is +.Dq */* . .It Ev HTTP_AUTH Specifies HTTP authorization parameters as a colon-separated list of items. Modified: head/lib/libfetch/http.c ============================================================================== --- head/lib/libfetch/http.c Tue Jul 30 13:05:51 2013 (r253804) +++ head/lib/libfetch/http.c Tue Jul 30 13:07:55 2013 (r253805) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2000-2011 Dag-Erling Smørgrav + * Copyright (c) 2000-2013 Dag-Erling Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1664,6 +1664,12 @@ http_request(struct url *URL, const char } /* other headers */ + if ((p = getenv("HTTP_ACCEPT")) != NULL) { + if (*p != '\0') + http_cmd(conn, "Accept: %s", p); + } else { + http_cmd(conn, "Accept: */*"); + } if ((p = getenv("HTTP_REFERER")) != NULL && *p != '\0') { if (strcasecmp(p, "auto") == 0) http_cmd(conn, "Referer: %s://%s%s", Modified: head/usr.bin/fetch/fetch.1 ============================================================================== --- head/usr.bin/fetch/fetch.1 Tue Jul 30 13:05:51 2013 (r253804) +++ head/usr.bin/fetch/fetch.1 Tue Jul 30 13:07:55 2013 (r253805) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 27, 2011 +.Dd July 30, 2013 .Dt FETCH 1 .Os .Sh NAME @@ -340,6 +340,7 @@ for a description of additional environm .Ev FTP_PASSWORD , .Ev FTP_PROXY , .Ev ftp_proxy , +.Ev HTTP_ACCEPT , .Ev HTTP_AUTH , .Ev HTTP_PROXY , .Ev http_proxy ,