2 : TCP/IP : HTTP HTTP/2 1 / 22
httpget.txt: http.rb: ruby http get Java http ( ) HttpURLConnection 2 / 22
wireshark httpget.txt httpget cookie.txt ( ) telnet telnet localhost 80 GET /index.html HTTP/1.1 Host: 172.28. 3 / 22
RFC2616 RFC2616: HTTP/1.1 (http://www.ietf.org/rfc/rfc2616.txt) (RFC7230-7235 RFC2616) Resource: URI Client User Agent: ( ) Server Origin Server: Proxy ( ): ( ) ( ) Gateway: ( ) Tunnel: First hand: 4 / 22
inbound outbound ( ) proxy gateway ( ) 1.1 (Keep-Alive) 5 / 22
HTTP Message Header + CRLF + Body Entity Body Entity body Entity Header Message Header MIME (Content-Type multipart ) 6 / 22
Request Request = Request-Line *(( general-header request-header entity-header ) CRLF) CRLF [ message-body ] Request-Line = Method SP Request-URI SP HTTP-Version CRLF Method = OPTIONS GET HEAD POST PUT DELETE TRACE CONNECT request-header = Accept ; Authorization Expect From Host ; If-Match If-Modified-Since Range Referer User-Agent 7 / 22
Response Response = Status-Line *(( general-header response-header entity-header ) CRLF) CRLF [ message-body ] Status-Line = HTTP-Version SP Status-Code SP Reason CRLF response-header = Accept-Ranges Age ETag Location Proxy-Authenticate Retry-After Server Vary WWW-Authenticate 8 / 22
general-header = Cache-Control Connection Date Pragma Trailer Transfer-Encoding Upgrade Via Warning entity-header = Allow Content-Encoding Content-Language Content-Length Content-Location Content-MD5 Content-Range Content-Type Expires Last-Modified 9 / 22
: TCP-open Connection: Connection: close Connection: Keep-Alive ( ) 2 (RFC7230 6 ) / 10 / 22
GET: ( ) If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, If-Range (If-Range Range ) HEAD: GET POST: ( ) ( ) PUT: ( ) PUT 201 Created, 200 OK DELETE: ( ) TRACE: CONNECT: proxy (SSL ) 11 / 22
( ) 1xx: Informational - 100 continue: Expect 2xx: Success - 200 OK: 3xx: Redirection - 301 moved permanently:? 7 Location redirect 4xx: Client Error - 400 bad request: 404 not found: 5xx: Server Error - 500 internal server error 12 / 22
charset encoding user-agent 13 / 22
Referer Referrer Google GET / HTTP/1.1 Host: www.shibaura-it.ac.jp User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; ja; rv:1.9.1.16) Gecko/20 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: ja,en-us;q=0.7,en;q=0.3 Accept-Encoding: gzip,deflate Accept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://www.google.co.jp/search?hl=ja&source=hp&q=%e8%8a%9d%e6% B5%A6%E5%B7%A5%E6%A5%AD%E5%A4%A7%E5%AD%A6&gbv=2&oq=sibaurakougyou&gs_l= heirloom-hp.3.0.0i4l10.3235.28635.0.29690.46.19.26.0.0.0.120.1535.15j4. 19.0...0...1ac.1.24.heirloom-hp..2.44.1585.XrWLkbqJAWI Cookie: NavicastApi=20130928.150526.35224600.14370; (# ) https Referer 14 / 22
RFC2109/2965 ( NetScape ) [ UA] Set-Cookie: NAME=VALUE; expires=date; path=path; domain=domain NAME; secure NAME=VALUE: expires: ( UA ) domain: path: secure: https (!) : expires Set-Cookie [UA ] Cookie: NAME1=OPAQUE STRING1; NAME2=OPAQUE STRING2... 4KB path domain path prefix match domain domain-match ( ) (TLD NG) : httpget cookie.txt 15 / 22
(Cache System=CS Origin Server=OS) : 1. CS (CS OS ) 2. CS OS OS (OS ) : Expires: (Expires Cache-Control:max-age= ) 16 / 22
2 : Last-Modified: OS ( ) ETag: ( ) (Request) : IF-Modifed-Since: 304 (Not Modified) IF-Match: entity-tag ( PUT) IF-None-Match: entity-tag ( GET) 17 / 22
( ) : Cache-Control: no-cache ( ) ( ) 18 / 22
(BASIC ) GET... 401 Authorization Required WWW-Authenticate: Basic realm="..." GET... Authorization: Basic realm ( ) Base64 ID: Authorization: ( ) 19 / 22
(DIGEST ) GET... 401 Authorization Required WWW-Authenticate: Digest realm=" ",nonce=" " GET... Authorization: Digest username=" ",nonce="...",cnonce=" ",resp nonce, cnonce, user, password MD5 response cnonce MD5 Basic (SSL ) 20 / 22
curl, wget, webcopy tcpdump windump wireshark (ethereal) 21 / 22
Keep-Alive connection: close referrer SEO SPDY TRACE 22 / 22