cpanm 如何检索需要用户名和密码的代理的设置
How can cpanm retrieve settings for a proxy that requires username and password
我正在使用 CPANM 与需要用户名和密码的代理进行交互。我在运行"o conf init /proxy/ under cpan"时指定了设置。我的看法是在 unix 环境中用于指定代理的变量在整个环境中并不是标准的。将环境变量设置为正确的值后,其他 unix 实用程序可以通过代理正常工作。
我的问题如下:
CPANM 如何与任何环境变量交互?他们会是什么?
是否有代码的相关区域我们可以查看以帮助消除歧义,我认为 CPANM 内部有一个 LWP 接口?
https://github.com/miyagawa/cpanminus/blob/devel/App-cpanminus/cpanm
####:/mnt/c/Projects$ sudo cpanm install Catalyst::Helper -v
cpanm (App::cpanminus) 1.7040 on perl 5.022001 built for x86_64-linux-gnu-thread-multi
Work directory is /home/####/.cpanm/work/1543605706.124
You have make /usr/bin/make
You have LWP 6.36
You have /bin/tar: tar (GNU tar) 1.28
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by John Gilmore and Jay Fenlason.
Searching install () on cpanmetadb ...
########:/mnt/c/Projects$ env | grep HTTP_proxy
HTTP_proxy=http://####:###
据我所知,cpanm(实际上 App::Cpanminus 依赖于 HTTP::Tiny 到 运行 HTTP 请求。
HTTP::Tiny can proxy both http and https requests. Only Basic proxy authorization is supported and it must be provided as part of the proxy URL: http://user:pass@proxy.example.com/.
HTTP::Tiny supports the following proxy environment variables: http_proxy or HTTP_PROXY, https_proxy or HTTPS_PROXY, all_proxy or ALL_PROXY
因此您应该尝试将代理用户名和密码指定为 url 的一部分,例如:
$ export HTTP_PROXY=http://<user>:<password>@<url>:<port>
$ export HTTPS_PROXY=http://<user>:<password>@<url>:<port>
此外,根据文档,LWP::UserAgent(cpan 命令行实用程序使用的主要 HTTP 客户端)接受 HTTP_PROXY 设置,而 c 支持 HTTPS_PROXY url(LWP 失败时 cpan 的回退)。参见 the LWP::UserAgent docs and the curl docs。
因此HTTP_PROXY/HTTPS_PROXY应该是所有CPAN客户端都支持的公共环境变量。
我正在使用 CPANM 与需要用户名和密码的代理进行交互。我在运行"o conf init /proxy/ under cpan"时指定了设置。我的看法是在 unix 环境中用于指定代理的变量在整个环境中并不是标准的。将环境变量设置为正确的值后,其他 unix 实用程序可以通过代理正常工作。
我的问题如下:
CPANM 如何与任何环境变量交互?他们会是什么?
是否有代码的相关区域我们可以查看以帮助消除歧义,我认为 CPANM 内部有一个 LWP 接口? https://github.com/miyagawa/cpanminus/blob/devel/App-cpanminus/cpanm
####:/mnt/c/Projects$ sudo cpanm install Catalyst::Helper -v
cpanm (App::cpanminus) 1.7040 on perl 5.022001 built for x86_64-linux-gnu-thread-multi
Work directory is /home/####/.cpanm/work/1543605706.124
You have make /usr/bin/make
You have LWP 6.36
You have /bin/tar: tar (GNU tar) 1.28
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by John Gilmore and Jay Fenlason.
Searching install () on cpanmetadb ...
########:/mnt/c/Projects$ env | grep HTTP_proxy
HTTP_proxy=http://####:###
据我所知,cpanm(实际上 App::Cpanminus 依赖于 HTTP::Tiny 到 运行 HTTP 请求。
HTTP::Tiny can proxy both http and https requests. Only Basic proxy authorization is supported and it must be provided as part of the proxy URL: http://user:pass@proxy.example.com/.
HTTP::Tiny supports the following proxy environment variables: http_proxy or HTTP_PROXY, https_proxy or HTTPS_PROXY, all_proxy or ALL_PROXY
因此您应该尝试将代理用户名和密码指定为 url 的一部分,例如:
$ export HTTP_PROXY=http://<user>:<password>@<url>:<port>
$ export HTTPS_PROXY=http://<user>:<password>@<url>:<port>
此外,根据文档,LWP::UserAgent(cpan 命令行实用程序使用的主要 HTTP 客户端)接受 HTTP_PROXY 设置,而 c 支持 HTTPS_PROXY url(LWP 失败时 cpan 的回退)。参见 the LWP::UserAgent docs and the curl docs。
因此HTTP_PROXY/HTTPS_PROXY应该是所有CPAN客户端都支持的公共环境变量。