408 請求超時
HTTP 408 請求超時 客戶端錯誤響應 狀態碼錶示伺服器希望關閉此未使用的連線。某些伺服器會在空閒連線上傳送 408,即使客戶端之前沒有發出任何請求。
伺服器應在響應中傳送 Connection: close 標頭欄位,因為 408 意味著伺服器已決定關閉連線而不是繼續等待。
由於某些瀏覽器(如 Chrome 和 Firefox)使用 HTTP 預連線機制來加速瀏覽,因此此響應的使用頻率更高。
注意:某些伺服器會在不傳送此訊息的情況下關閉連線。
狀態
http
408 Request Timeout
示例
表單提交中的超時
以下示例顯示了當 <input type="file"> 元素在表單提交時使用影像且 method="post" 時客戶端可能會發送的內容。
http
POST /upload HTTP/1.1
Host: example.com
Content-Type: multipart/form-data; boundary=----Boundary1234
Content-Length: 4012345
------Boundary1234
Content-Disposition: form-data; name="file"; filename="myImage.jpg"
Content-Type: image/jpeg
\xFF\xD8\xFF\xE0\x00...(binary data)
------Boundary1234--
如果由於網路問題或延遲導致資料未完全接收,則伺服器可能會使連線超時。客戶端可以再次重複請求,並將使用新的連線。
http
HTTP/1.1 408 Request Timeout
Content-Type: text/html
<html>
<head>
<title>408 Request Timeout</title>
</head>
<body>
<h1>408 Request Timeout</h1>
<p>Failed to process request in time. Please try again.</p>
</body>
</html>
規範
| 規範 |
|---|
| HTTP 語義 # status.408 |