diff --git a/files/zh-tw/web/http/reference/status/100/index.md b/files/zh-tw/web/http/reference/status/100/index.md index a6810e4d0780cd..db134096a7fa92 100644 --- a/files/zh-tw/web/http/reference/status/100/index.md +++ b/files/zh-tw/web/http/reference/status/100/index.md @@ -2,14 +2,14 @@ title: 100 Continue slug: Web/HTTP/Reference/Status/100 l10n: - sourceCommit: b085d5418eb8ef812682e647045746221bad0e7e + sourceCommit: 4d929bb0a021c7130d5a71a4bf505bcb8070378d --- {{HTTPSidebar}} -HTTP **`100 Continue`** 資訊回應碼表示到目前為止一切正常,用戶端應該繼續請求,或者如果已經完成則忽略它。 +HTTP **`100 Continue`** [資訊回應](/zh-TW/docs/Web/HTTP/Reference/Status#資訊回應)狀態碼表示伺服器已收到請求的初始部分,且尚未拒絕。用戶應繼續發送請求,或者如果請求已經完成,則可以忽略 100 回應。 -為了讓伺服器檢查請求的標頭,用戶端必須在其初始請求中作為標頭發送 {{HTTPHeader("Expect")}}`: 100-continue`,並在收到 `100 Continue` 狀態碼的回應後才發送主體。 +當請求包含 {{HTTPHeader("Expect", "Expect: 100-continue")}} 標頭時,100 Continue 回應表示伺服器已準備好或能夠接收請求內容。如果用戶預期可能會發生錯誤,例如在未經驗證的情況下發送會改變狀態的操作,等待 100 Continue 回應會很有幫助。 ## 狀態 @@ -17,6 +17,32 @@ HTTP **`100 Continue`** 資訊回應碼表示到目前為止一切正常,用 100 Continue ``` +## 範例 + +### 使用 100 Continue 的 PUT 請求 + +以下 {{HTTPMethod("PUT")}} 請求會向伺服器傳送有關檔案上傳的訊息。用戶會在收到 100 回應後才繼續傳送內容,以避免在網路上傳送可能因 {{HTTPStatus("405")}}、{{HTTPStatus("401")}} 或 {{HTTPStatus("403")}} 等錯誤而失敗的資料。首先,用戶僅傳送標頭,其中包含 {{HTTPHeader("Expect", "Expect: 100-continue")}} 標頭: + +```http +PUT /videos HTTP/1.1 +Host: uploads.example.com +Content-Type: video/h264 +Content-Length: 123456789 +Expect: 100-continue +``` + +伺服器回應請求可以繼續: + +```http +HTTP/1.1 100 Continue +``` + +用戶接著傳送實際資料以完成請求: + +```http +[作為 PUT 請求內容的視訊資料] +``` + ## 規範 {{Specifications}}