tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: FETCH_PROXY



Greg Troxel wrote:
> 
> Edgar Fu? <ef%math.uni-bonn.de@localhost> writes:
> 
> > Could we have FETCH_PROXY.http etc. (defaulting to FETCH_PROXY), please?

New patch defines FETCH_PROXY.ftp/http/https and defaults them to
FETCH_PROXY.

> I was going to ask if you are sure that it really makes sense to have a
> single proxy variable, instead of separate for http/https/ftp.

Protocol specific variables don't extend to other protocols like socks.
So, I use FETCH_PROXY both as a default value for protocol specific
variables and to pass other protocols:

FETCH_USING=            curl
FETCH_PROXY=            socks4a://127.0.0.1:9050

Because FETCH_PROXY is used for two different purposes, socks proxy will
appear in the command line 4 times:

env ftp_proxy=socks4a://127.0.0.1:9050 \
    http_proxy=socks4a://127.0.0.1:9050 \
    https_proxy=socks4a://127.0.0.1:9050 \
  curl --proxy socks4a://127.0.0.1:9050 ...

It works fine it curl, though.

-- 
Alex
Index: mk/fetch/fetch.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/fetch/fetch.mk,v
retrieving revision 1.69
diff -p -u -u -r1.69 fetch.mk
--- mk/fetch/fetch.mk	1 Aug 2017 13:15:32 -0000	1.69
+++ mk/fetch/fetch.mk	6 Jan 2018 22:00:16 -0000
@@ -197,10 +197,24 @@ fetch-check-interactive: .USEBEFORE
 #	connections after the given amount of seconds.
 #       The specific behavior depends on the command used.
 #
+# FETCH_PROXY
+# FETCH_PROXY.ftp
+# FETCH_PROXY.http
+# FETCH_PROXY.https
+#	If defined, will cause the fetch command to connect over
+#	the specified proxy.
+#	The specific behavior depends on the command used.
+#
 # FETCH_USE_IPV4_ONLY, if defined, will cause the fetch command to force
 #	connecting to only IPv4 addresses.
 #
 
+.if defined(FETCH_PROXY)
+FETCH_PROXY.ftp?=	${FETCH_PROXY}
+FETCH_PROXY.http?=	${FETCH_PROXY}
+FETCH_PROXY.https?=	${FETCH_PROXY}
+.endif
+
 # If this host is behind a filtering firewall, use passive ftp(1)
 _FETCH_BEFORE_ARGS.ftp=		${PASSIVE_FETCH:D-p} \
 				${FETCH_TIMEOUT:D-q ${FETCH_TIMEOUT}} \
@@ -208,14 +222,22 @@ _FETCH_BEFORE_ARGS.ftp=		${PASSIVE_FETCH
 _FETCH_AFTER_ARGS.ftp=		# empty
 _FETCH_RESUME_ARGS.ftp=		-R
 _FETCH_OUTPUT_ARGS.ftp=		-o
-_FETCH_CMD.ftp=			${TOOLS_PATH.ftp}
+_FETCH_CMD.ftp=			${PKGSRC_SETENV} \
+				${FETCH_PROXY.ftp:Dftp_proxy=${FETCH_PROXY.ftp:Q}} \
+				${FETCH_PROXY.http:Dhttp_proxy=${FETCH_PROXY.http:Q}} \
+				${FETCH_PROXY.https:Dhttps_proxy=${FETCH_PROXY.https:Q}} \
+				${TOOLS_PATH.ftp}
 
 _FETCH_BEFORE_ARGS.fetch=	${FETCH_TIMEOUT:D-T ${FETCH_TIMEOUT}} \
 				${FETCH_USE_IPV4_ONLY:D-4}
 _FETCH_AFTER_ARGS.fetch=	# empty
 _FETCH_RESUME_ARGS.fetch=	-r
 _FETCH_OUTPUT_ARGS.fetch=	-o
-_FETCH_CMD.fetch=		${TOOLS_PATH.fetch}
+_FETCH_CMD.fetch=		${PKGSRC_SETENV} \
+				${FETCH_PROXY.ftp:Dftp_proxy=${FETCH_PROXY.ftp:Q}} \
+				${FETCH_PROXY.http:Dhttp_proxy=${FETCH_PROXY.http:Q}} \
+				${FETCH_PROXY.https:Dhttps_proxy=${FETCH_PROXY.https:Q}} \
+				${TOOLS_PATH.fetch}
 
 _FETCH_BEFORE_ARGS.wget=	${PASSIVE_FETCH:D--passive-ftp} \
 				--no-check-certificate \
@@ -224,17 +246,26 @@ _FETCH_BEFORE_ARGS.wget=	${PASSIVE_FETCH
 _FETCH_AFTER_ARGS.wget=		# empty
 _FETCH_RESUME_ARGS.wget=	-c
 _FETCH_OUTPUT_ARGS.wget=	-O
-_FETCH_CMD.wget=		${TOOLS_PATH.wget}
+_FETCH_CMD.wget=		${PKGSRC_SETENV} \
+				${FETCH_PROXY.ftp:Dftp_proxy=${FETCH_PROXY.ftp:Q}} \
+				${FETCH_PROXY.http:Dhttp_proxy=${FETCH_PROXY.http:Q}} \
+				${FETCH_PROXY.https:Dhttps_proxy=${FETCH_PROXY.https:Q}} \
+				${TOOLS_PATH.wget}
 
 _FETCH_BEFORE_ARGS.curl=	${PASSIVE_FETCH:D--ftp-pasv} \
 				--fail --insecure --location --remote-time \
 				${FETCH_TIMEOUT:D--connect-timeout ${FETCH_TIMEOUT}} \
 				${FETCH_TIMEOUT:D--speed-time ${FETCH_TIMEOUT}} \
+				${FETCH_PROXY:D--proxy ${FETCH_PROXY:Q}} \
 				${FETCH_USE_IPV4_ONLY:D--ipv4}
 _FETCH_AFTER_ARGS.curl=		-O # must be here to honor -o option
 _FETCH_RESUME_ARGS.curl=	-C -
 _FETCH_OUTPUT_ARGS.curl=	-o
-_FETCH_CMD.curl=		${TOOLS_PATH.curl}
+_FETCH_CMD.curl=		${PKGSRC_SETENV} \
+				${FETCH_PROXY.ftp:Dftp_proxy=${FETCH_PROXY.ftp:Q}} \
+				${FETCH_PROXY.http:Dhttp_proxy=${FETCH_PROXY.http:Q}} \
+				${FETCH_PROXY.https:Dhttps_proxy=${FETCH_PROXY.https:Q}} \
+				${TOOLS_PATH.curl}
 
 _FETCH_CMD.manual=		${TOOLS_PATH.false}
 

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index