About 100 Continue
Overview of 100 Continue
Optimizing the Preparation StageHTTP Status Code | ||
100 Continue Overview 100 Continue is an HTTP status code indicating that the client’s request is acceptable, and the client can proceed with sending the request body. This code is typically returned by the server when the request header includes |
||
Meaning The server has received the initial part of the request and instructed the client to continue. |
When is 100 Continue Returned?
- When the client sends a request with the
Expect: 100-continue
header - When the client wants to ensure server approval before sending the request body
- When used to avoid unnecessary data transfer for large requests
Examples of 100 Continue
Confirming the Initial Part of a Request
POST /upload HTTP/1.1 Host: example.com Content-Length: 1048576 Expect: 100-continue
Response example:
HTTP/1.1 100 Continue
Explanation: When the client sends a request with the Expect: 100-continue
header, the server returns the 100 status code to indicate readiness to accept the request. The client can then proceed to send the request body (e.g., large data).
Alternative Response in Case of Error
POST /upload HTTP/1.1 Host: example.com Content-Length: 1048576 Expect: 100-continue
Response example:
HTTP/1.1 417 Expectation Failed
Explanation: If the server is not ready to accept the request, it may return 417 Expectation Failed
instead of the 100 status code.
Points to Note
Considerations when returning 100 Continue:
- Return before receiving the request body
The 100 status code must be sent before the request body is received. - Handle client expectations properly
IgnoringExpect: 100-continue
can lead to inefficiencies in client-server communication.
Comparison with Related HTTP Status Codes
Explanation of HTTP status codes related to 100 Continue:
- 200 OK: Used when the request is fully successful. 100 indicates an intermediate stage.
- 417 Expectation Failed: Returned when the
Expect: 100-continue
expectation is not met.
Understanding these differences ensures the appropriate use of the 100 status code.