HTTP響應的細節——狀態行
狀態行
格式: HTTP版本號 狀態碼 原因敘述<CRLF>
舉例:HTTP/1.1 200 OK
狀態碼用於表示服務器對請求的處理結果,它是一個三位的十進制數。響應狀態碼分爲5類,如下所示:
狀態碼 |
含義 |
100~199 |
表示成功接收請求,要求客戶端繼續提交下一次請求才能完成整個處理過程 |
200~299 |
表示成功接收請求並已完成整個處理過程,常用200 |
300~399 |
爲完成請求,客戶需進一步細化請求。例如,請求的資源已經移動一個新地址,常用302、307和304 |
400~499 |
客戶端的請求有錯誤,常用404 |
500~599 |
服務器端出現錯誤,常用 500 |
HTTP響應細節——常用響應頭
HTTP請求中的常用響應頭
Location: http://www.it315.org/index.jsp
Server:apache tomcat
Content-Encoding: gzip
Content-Length: 80
Content-Language: zh-cn
Content-Type: text/html; charset=GB2312
Last-Modified: Tue, 11 Jul 2000 18:23:51 GMT
Refresh: 1;url=http://www.it315.org
Content-Disposition: attachment; filename=aaa.zip
Transfer-Encoding: chunked
Set-Cookie:SS=Q0=5Lb_nQ; path=/search
ETag: W/"7777-1242234904000"
Expires: -1
Cache-Control: no-cache
Pragma: no-cache
Connection: close/Keep-Alive
Date: Tue, 11 Jul 2000 18:23:51 GMT