Shammer's Philosophy

My private adversaria

How to check the HTTP header?

The command line tools, curl has a -v option. This is very useful because all HTTP request and response header displays. The response header value is depends on the web server configuration. This is just sample to Debian squeeze apache response.

$ curl -v http://XXX.XXX.XXX.XXX
*1390724073* About to connect() to XXX.XXX.XXX.XXX port 80 (#0)
*1390724074*   Trying XXX.XXX.XXX.XXX...
*1390724075* Adding handle: conn: 0x7fb4e9003a00
*1390724076* Adding handle: send: 0
*1390724077* Adding handle: recv: 0
*1390724078* Curl_addHandleToPipeline: length: 1
*1390724079* - Conn 0 (0x7fb4e9003a00) send_pipe: 1, recv_pipe: 0
*1390724080* Connected to XXX.XXX.XXX.XXX (XXX.XXX.XXX.XXX) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.30.0
> Host: XXX.XXX.XXX.XXX
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Sun, 26 Jan 2014 08:05:14 GMT
*1390724081* Server Apache/2.2.16 (Debian) is not blacklisted
< Server: Apache/2.2.16 (Debian)
< Last-Modified: Sun, 26 Jan 2013 07:08:37 GMT
< ETag: "100699-1cc4-4f0da4294bbe1"
< Accept-Ranges: bytes
< Content-Length: 798
< Vary: Accept-Encoding
< Content-Type: text/html
<
〜以下略〜
  • HTTP/1.1. 200 OK means HTTP response code. Sometimes, this value is 404 or 403, and so on.
  • Date means Server timestamp.
  • Server means environment informations
  • Last-Modified is a timestamp of requested file
  • Content-Length is a response body length
  • Content-Type is a response type

I have no idea about ETag and Accept-Ranges, Vary. I guess Vary is a supported encoding on this server,
Accept-Ranges is a unit of Content-Length.