1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

まだtelnet?

Last updated at Posted at 2016-11-21

DMZにあるサーバから外部(Intelnet)にあるサイトにアクセスできるか確認してほしい、コマンドはコレね、と言い渡されたのが以下。

$ telnet www.yahoo.co.jp 80

う~ん、これでもいいんだけど、これだと自分で

HEAD / HTTP/1.1
Host: www.yahoo.co.jp

って打たなきゃいけないじゃん。イケてない。
なので、curlの出番。
curlなら、
$ curl -I www.yahoo.co.jp
と打つだけで、ちゃんと同じことをしてくれる。

HTTP/1.1 200 OK
Server: nginx
Date: Mon, XX Nov 20XX XX:XX:XX GMT
Content-Type: text/html; charset=UTF-8
Connection: close
P3P: policyref="http://privacy.yahoo.co.jp/w3c/p3p_jp.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Expires: -1
Pragma: no-cache
Cache-Control: private, no-cache, no-store, must-revalidate
X-XRDS-Location: https://open.login.yahooapis.jp/openid20/www.yahoo.co.jp/xrds
X-Frame-Options: SAMEORIGIN

curlは他にも色々なオプションがあるので、これを使わない手はないですね。

1
2
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
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?