From 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:43:23 -0500 Subject: initial commit --- files/zh-tw/web/http/methods/connect/index.html | 82 ++++++++++++++++ files/zh-tw/web/http/methods/get/index.html | 69 +++++++++++++ files/zh-tw/web/http/methods/index.html | 63 ++++++++++++ files/zh-tw/web/http/methods/post/index.html | 124 ++++++++++++++++++++++++ 4 files changed, 338 insertions(+) create mode 100644 files/zh-tw/web/http/methods/connect/index.html create mode 100644 files/zh-tw/web/http/methods/get/index.html create mode 100644 files/zh-tw/web/http/methods/index.html create mode 100644 files/zh-tw/web/http/methods/post/index.html (limited to 'files/zh-tw/web/http/methods') diff --git a/files/zh-tw/web/http/methods/connect/index.html b/files/zh-tw/web/http/methods/connect/index.html new file mode 100644 index 0000000000..0b44ddec87 --- /dev/null +++ b/files/zh-tw/web/http/methods/connect/index.html @@ -0,0 +1,82 @@ +--- +title: CONNECT +slug: Web/HTTP/Methods/CONNECT +translation_of: Web/HTTP/Methods/CONNECT +--- +
{{HTTPSidebar}}
+ +

HTTP CONNECT 方法會利用請求資源啟動一個雙向通訊。這通常可用於建立隧道。

+ +

舉例來說,CONNECT 方法可以用於存取使用 {{Glossary("SSL")}} ({{Glossary("HTTPS")}}) 的網站。客戶端請求 HTTP Proxy 伺服器建立 TCP 連結的隧道到指定的位置。伺服器接著代表客戶端建立連結。一但連結建立,Proxy 伺服器會持續收送 TCP 流到客戶端。

+ +

CONNECT 是個逐跳方法。

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
請求具有 Body
成功回覆具有 Body
{{Glossary("Safe")}}
{{Glossary("Idempotent")}}
{{Glossary("Cacheable")}}
可用於 HTML 表單
+ +

語法

+ +
CONNECT www.example.com:443 HTTP/1.1
+
+ +

範例

+ +

有些 Proxy 伺服器也許需要授權以建立隧道。請見 {{HTTPHeader("Proxy-Authorization")}} 標頭。

+ +
CONNECT server.example.com:80 HTTP/1.1
+Host: server.example.com:80
+Proxy-Authorization: basic aGVsbG86d29ybGQ=
+ +

規格

+ + + + + + + + + + + + +
規格標題
{{RFC("7231", "CONNECT", "4.3.6")}}超文本轉送協議 (HTTP/1.1): 語意與內容
+ +

瀏覽器相容性

+ + + +

{{Compat("http.methods.CONNECT")}}

+ +

參見

+ + diff --git a/files/zh-tw/web/http/methods/get/index.html b/files/zh-tw/web/http/methods/get/index.html new file mode 100644 index 0000000000..654d4a3d3d --- /dev/null +++ b/files/zh-tw/web/http/methods/get/index.html @@ -0,0 +1,69 @@ +--- +title: GET +slug: Web/HTTP/Methods/GET +translation_of: Web/HTTP/Methods/GET +--- +
{{HTTPSidebar}}
+ +

HTTP GET method 方法請求展示指定資源。 使用 GET 的請求只應用於取得資料。

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Request 有 bodyNo
成功的 response 有 bodyYes
{{Glossary("Safe")}}Yes
{{Glossary("Idempotent")}}Yes
{{Glossary("Cacheable")}}Yes
允許在 HTML 表單Yes
+ +

格式

+ +
GET /index.html
+
+ +

規範

+ + + + + + + + + + + + +
規範標題
{{RFC("7231", "GET", "4.3.1")}}Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content
+ +

瀏覽器相容性

+ + + +

{{Compat("http.methods.GET")}}

+ +

參見

+ + diff --git a/files/zh-tw/web/http/methods/index.html b/files/zh-tw/web/http/methods/index.html new file mode 100644 index 0000000000..fb44615883 --- /dev/null +++ b/files/zh-tw/web/http/methods/index.html @@ -0,0 +1,63 @@ +--- +title: HTTP 請求方法 +slug: Web/HTTP/Methods +translation_of: Web/HTTP/Methods +--- +
{{HTTPSidebar}}
+ +

HTTP 定義了一組能令給定資源,執行特定操作的請求方法(request methods)。他們儘管屬於名詞,但也能稱為 HTTP 動詞。每個方法都有不同的語意,不過也有些共享的相通功能,像是{{glossary("safe")}}、{{glossary("idempotent")}}、{{glossary("cacheable")}}。

+ +
+
GET
+
GET 方法請求展示指定資源。使用 GET 的請求只應用於取得資料。
+
HEAD
+
HEAD 方法請求與 GET 方法相同的回應,但它沒有回應主體(response body)。
+
POST
+
POST 方法用於提交指定資源的實體,通常會改變伺服器的狀態或副作用(side effect)。
+
PUT
+
PUT 方法會取代指定資源所酬載請求(request payload)的所有表現。
+
DELETE
+
DELETE 方法會刪除指定資源.
+
CONNECT
+
CONNECT 方法會和指定資源標明的伺服器之間,建立隧道(tunnel)。
+
OPTIONS
+
OPTIONS 方法描述指定資源的溝通方法(communication option)。
+
TRACE
+
TRACE 方法會與指定資源標明的伺服器之間,執行迴路返回測試(loop-back test)。
+
PATCH
+
PATCH 方法套用指定資源的部份修改。
+
+ +

規範

+ + + + + + + + + + + + + + + + + + + +
規範標題註解
{{RFC("7231", "Request methods", "4")}}Hypertext Transfer Protocol (HTTP/1.1): Semantics and ContentSpecifies GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE.
{{RFC("5789", "Patch method", "2")}}PATCH method for HTTPSpecifies PATCH.
+ +

瀏覽器相容性

+ + + +

{{Compat("http/methods")}}

+ +

參見

+ + diff --git a/files/zh-tw/web/http/methods/post/index.html b/files/zh-tw/web/http/methods/post/index.html new file mode 100644 index 0000000000..3332297535 --- /dev/null +++ b/files/zh-tw/web/http/methods/post/index.html @@ -0,0 +1,124 @@ +--- +title: POST +slug: Web/HTTP/Methods/POST +translation_of: Web/HTTP/Methods/POST +--- +
{{HTTPSidebar}}
+ +

The HTTP POST method sends data to the server. The type of the body of the request is indicated by the {{HTTPHeader("Content-Type")}} header.

+ +

The difference between PUT and {{HTTPMethod("POST")}} is that PUT is idempotent: calling it once or several times successively has the same effect (that is no side effect), where successive identical POST may have additional effects, like passing an order several times.

+ +

A POST request is typically sent via an HTML form and results in a change on the server. In this case, the content type is selected by putting the adequate string in the {{htmlattrxref("enctype", "form")}} attribute of the {{HTMLElement("form")}} element or the {{htmlattrxref("formenctype", "input")}} attribute of the {{HTMLElement("input") }} or {{HTMLElement("button")}} elements:

+ + + +

When the POST request is sent via a method other than an HTML form — like via an {{domxref("XMLHttpRequest")}} — the body can take any type. As described in the HTTP 1.1 specification, POST is designed to allow a uniform method to cover the following functions:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Request has bodyYes
Successful response has bodyYes
{{Glossary("Safe")}}No
{{Glossary("Idempotent")}}No
{{Glossary("Cacheable")}}Only if freshness information is included
Allowed in HTML formsYes
+ +

格式

+ +
POST /test
+
+ +

範例

+ +

使用 application/x-www-form-urlencoded 內容類型的簡易表單:

+ +
POST /test HTTP/1.1
+Host: foo.example
+Content-Type: application/x-www-form-urlencoded
+Content-Length: 27
+
+field1=value1&field2=value2
+ +

使用 multipart/form-data 內容類型的表單:

+ +
POST /test HTTP/1.1
+Host: foo.example
+Content-Type: multipart/form-data;boundary="boundary"
+
+--boundary
+Content-Disposition: form-data; name="field1"
+
+value1
+--boundary
+Content-Disposition: form-data; name="field2"; filename="example.txt"
+
+value2
+--boundary--
+
+ +

規範

+ + + + + + + + + + + + + + + + + + +
規範標題
{{RFC("7231", "POST", "4.3.3")}}Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content
{{RFC("2046", "Common Syntax", "5.1.1")}}Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types
+ +

瀏覽器相容性

+ + + +

{{Compat("http.methods.POST")}}

+ +

參見

+ + -- cgit v1.2.3-54-g00ecf