#navi(../)

* TELNETコマンドを利用してHTTPレスポンスヘッダを確認する [#d6771894]
telnetコマンドを利用してHTTPレスポンスヘッダを確認する方法を以下に記します。~
使用した環境はWindows 7, Mac OS X, CentOSを利用しました。

#contents
#htmlinsertpcsp(web-top.html,web-sp.html)

* telnetコマンドの使い方 [#y7d64c3a]
以下のようにtelnetコマンドの後にウェブサーバ、ポート番号(80)を指定します。
 telnet ウェブサーバ ポート番号
Linux、Macでは以下のような文字列が表示されたら
 Escape character is '^]'.
Windowsでは、サーバに接続されると画面にはカーソルのみ表示されます。
次に以下のコマンドを入力しENTERキーを2度押します。(Windowsでは何も表示されませんが打ち込んでください。)
 GET / HTTP/1.0
 
 
そうすると、HTTPヘッダと/のHTMLが返却されます。

* Windows 7のtelnetコマンドでHTTPレスポンスヘッダを確認 [#ubfe8b89]
Windows 7の初期状態ではtelnetコマンドがインストールされていません。~
以下のリンクの資料を参考にtelnetコマンドをインストールしてください。
-[[Windows 7にtelnetコマンドをインストールする>http://win.just4fun.biz/Windows%E8%A8%AD%E5%AE%9A%E9%96%A2%E9%80%A3/telnet%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E3%81%8C%E7%84%A1%E3%81%84%E5%A0%B4%E5%90%88%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E6%96%B9%E6%B3%95.html]]

コマンドプロンプトを起動しtelnetコマンドでgooに接続したときの出力です。
 C:\Users\sakura>telnet www.goo.ne.jp 80

 HTTP/1.1 200 OK
 Date: Sat, 12 May 2012 16:47:26 GMT
 Server: Apache
 Cache-Control: no-cache
 Pragma: no-cache
 Expires: Thu, 01 Jan 1970 00:00:00 GMT
 Set-cookie: NGUserID=d2a0c95c-5765-1336841246-1; expires=Wednesday, 30-Dec-2037 16:00:00 GMT; path=/; domain=.goo.ne.jp
 Set-Cookie: gootop=RK:1&LU:38_24_23_49_48_16&MV:1&AX:8LN6ZAm9ypYXupjZw3d2Xw&KR:qrG9a%2F4VZJyCn6i0JtLA796wrtAMFJO7&SR:01003; expires=Mon, 11-Jun-2012 16:47:26 GMT; path=/
 Set-Cookie: gootopstay=FA:1336841246&FR:0&FS:&FT:&UC:e128bbae6dbc32a4fda577ee6022b3c2; expires=Sun, 12-May-2013 16:47:26 GMT; path=/
 Set-Cookie: gooproperty=AR%3D%26WE%3D%26TV%3D%26TH%3D%26ST%3D%26HO%3D%26TR%3D%26TP%3D%26MP%3D; expires=Mon, 12-May-2014 16:47:26 GMT; path=/; domain=goo.ne.jp
 Vary: Accept-Encoding,User-Agent
 P3P: policyref="/w3c/p3p.xml",CP="CAO DSP COR CURa ADMa DEVa TAIa PSAa PSDa IVAi IVDi CONo OUR SAMo OTRo IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA HEA PRE LOC"
 Connection: close
 Content-Type: text/html; charset=UTF-8

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <以下省略>


* Mac OS XのtelnetコマンドでHTTPレスポンスヘッダを確認 [#e6d61fc2]
以下、yahooに接続して確認したときの出力です。
 lion:~ sakura$ telnet www.yahoo.co.jp 80
 Trying 203.216.227.245...
 Connected to www.g.yahoo.co.jp.
 Escape character is '^]'.
 GET / HTTP/1.0
 
 HTTP/1.1 200 OK
 Date: Sat, 12 May 2012 16:28:46 GMT
 P3P: policyref="http://privacy.yahoo.co.jp/w3c/p3p.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"
 Expires: -1
 Pragma: no-cache
 Cache-Control: private, no-cache, no-store, must-revalidate
 X-XRDS-Location: http://open.login.yahoo.co.jp/openid20/www.yahoo.co.jp/xrds
 Vary: Accept-Encoding
 Connection: close
 Content-Type: text/html; charset=utf-8
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html>
 <以下省略>

* CentOSのtelnetコマンドでHTTPレスポンスヘッダを確認 [#rd525a4a]
以下、rakutenに接続して確認したときの出力です。

 [sakura@centos ~]$ telnet www.rakuten.co.jp 80 | head -20
 Trying 202.72.50.128...
 Connected to www.rakuten.co.jp (202.72.50.128).
 Escape character is '^]'.
 GET / HTTP/1.0
 
 HTTP/1.1 200 OK
 Date: Sat, 12 May 2012 16:38:20 GMT
 Server: Apache
 Pragma: no-cache
 Cache-Control: private
 Set-Cookie: wPzd=lng%3DNA%3Acnt%3DJP; expires=Sun, 12-May-2013 16:38:20 GMT; path=/; domain=www.rakuten.co.jp
 Content-Type: text/html; charset=EUC-JP
 X-Cache: MISS from www.rakuten.co.jp
 Connection: close
 
 <!DOCTYPE html>
 <html lang="ja" xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml">
 <head>
 <以下省略>

#htmlinsertpcsp(web-btm.html,web-sp.html)

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS