HTTP status code 100 “Continue” is an informational status code indicating that the client can continue sending the remainder of the request. This status code is commonly used in HTTP pipelining or when sending POST requests to confirm that the server is ready to receive the request body.
By default, when a client sends an HTTP request, it waits for the server’s response before sending the request body. However, if the client includes the Expect: 100-continue
header, it first sends the request headers and then waits for the server’s 100 Continue response before sending the request body. This mechanism helps avoid sending unnecessary data in cases where the server does not need the request body (e.g., if the server knows the request will result in an error, such as a 413 Request Entity Too Large).
Here’s an example of an HTTP request using the Expect: 100-continue
header:
POST /submit-form HTTP/1.1
Host: www.example.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 128
Expect: 100-continue
param=value¶m2=value2
In this example, the client first sends the request headers, including Expect: 100-continue
. Upon receiving this request, if the server is ready to accept the request body, it responds with the 100 Continue status code. The client then proceeds to send the request body.
Server Response:
HTTP/1.1 100 Continue
After receiving the 100 Continue response, the client will then send the request body.
This mechanism helps reduce unnecessary data transfer and improves communication efficiency.