HTTP協議學習筆記

一直使用HTTP,卻從未看來過他的協議自己。前端

此次把這個技術債補上。瀏覽器

 

HTTP 1.1RFC編號2616,地址:  緩存

https://www.ietf.org/rfc/rfc2616.txt服務器

由於HTTP/1.0沒有充分考慮到分層代理,緩存的做用以及對穩定鏈接和虛擬主機的需求。cookie

全部纔有了HTTP/1.1的誕生。app

(相關 cookies 地址https://www.ietf.org/rfc/rfc6265.txt )ide

 

此次閱讀記錄如下幾點:ui

1.默認編碼是 ISO-8859-1this

3.7.1 Canonicalization and Text Defaults編碼

 

The "charset" parameter is used with some media types to define the

character set (section 3.4) of the data. When no explicit charset

parameter is provided by the sender, media subtypes of the "text"

type are defined to have a default charset value of "ISO-8859-1" when

received via HTTP. Data in character sets other than "ISO-8859-1" or

its subsets MUST be labeled with an appropriate charset value. See

section 3.4.1 for compatibility problems.

 

 

2.HTTP並不是必定是創建在TCP/IP協議上。任何能保證可靠傳輸的均可以。

HTTP communication usually takes place over TCP/IP connections. The default port is TCP 80 [19], but other ports can be used. This does not preclude HTTP from being implemented on top of any other protocol on the Internet, or on other networks. HTTP only presumes a reliable transport; any protocol that provides such guarantees can be used; the mapping of the HTTP/1.1 request and response structures onto the transport data units of the protocol in question is outside the scope of this specification.

 

3.HTTP協議自己要求對URI不作長度限制。

The HTTP protocol does not place any a priori limit on the length of a URI. Servers MUST be able to handle the URI of any resource they serve, and SHOULD be able to handle URIs of unbounded length if they provide GET-based forms that could generate such URIs. A server SHOULD return 414 (Request-URI Too Long) status if a URI is longer than the server can handle (see section 10.4.15).

 

4.只有第2個request事GET或者Head 時,重定向才能夠不經過用戶。

This class of status code indicates that further action needs to be

taken by the user agent in order to fulfill the request. The action

required MAY be carried out by the user agent without interaction

with the user if and only if the method used in the second request is

GET or HEAD.

 

 

5.緩存

緩存是HTTP協議的重要部分,佔了協議至關的筆墨

工做裏常常遇到改了前端頁面,按F5刷新沒有效果,須要使用瀏覽器的清除緩存功能。緣由就是瀏覽器實現了HTTP協議的緩存。

經過2個字段 Expires、Cache-control實現

 

6.URL太長

10.4.15 414 請求URI太長(Request-URI Too Long)

服務器拒絕爲請求服務由於此請求URI太長了以致於服務器不能理解。這種狀況是不多的,只發生在當客戶端把POST請求不合適地轉換爲帶有大量查詢信息的GET請求時。

相關文章
相關標籤/搜索