LoginSignup
1
1

More than 5 years have passed since last update.

Wget,cURLにおいてProxyを利用する際の設定

Posted at

cURL

$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
curl: (7) couldn't connect to host
  • -xを使う
 -x/--proxy <host[:port]> Use HTTP proxy on given port
    --proxy-anyauth Pick "any" proxy authentication method (H)
    --proxy-basic   Use Basic authentication on the proxy (H)
    --proxy-digest  Use Digest authentication on the proxy (H)
    --proxy-negotiate Use Negotiate authentication on the proxy (H)
    --proxy-ntlm    Use NTLM authentication on the proxy (H)
$ curl -x http://192.***.***.***:****/ https://bootstrap.pypa.io/get-pip.py -o get-
pip.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1488k  100 1488k    0     0  3381k      0 --:--:-- --:--:-- --:--:-- 5816k

Wget

$ wget --no-check-certificate https://access.redhat.com
--2016-07-15 19:13:54--  https://access.redhat.com/
access.redhat.com をDNSに問いあわせています... ***.***.***.***
access.redhat.com|***.***.***.***|:443 に接続しています... 失敗しました: 接続がタイムアウトしました.
  • /etc/wgetrcに明示的に有効と記述する
--- /etc/wgetrc.orig    2016-07-15 19:11:40.368050104 +0900
+++ /etc/wgetrc 2016-07-15 19:16:53.756649933 +0900
@@ -77,9 +77,11 @@
 # They will override the value in the environment.
 #https_proxy = http://proxy.yoyodyne.com:18023/
 #http_proxy = http://proxy.yoyodyne.com:18023/
+http_proxy = http://192.***.***.***:****/
+https_proxy = http://192.***.***.***:****/
 #ftp_proxy = http://proxy.yoyodyne.com:18023/
 # If you do not want to use proxy at all, set this to off.
-#use_proxy = on
+use_proxy = on

 # You can customize the retrieval outlook.  Valid options are default,
 # binary, mega and micro.
$ wget --no-check-certificate https://access.redhat.com
--2016-07-15 19:19:14--  https://access.redhat.com/
192.***.***.***:****/ に接続しています... 接続しました。
Proxy による接続要求を送信しました、応答を待っています... 200 OK
長さ: 89324 (87K) [text/html]
`index.html' に保存中

100%[===============================================================>] 89,324      --.-K/s 時間 0.07s   

2016-07-15 19:19:15 (1.29 MB/s) - `index.html' へ保存完了 [89324/89324]

環境変数

  • 登録
$ export http_proxy=http://192.***.***.***:****/
$ export https_proxy=http://192.***.***.***:****/
  • 削除
$ unset http_proxy
$ unset https_proxy
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1