100 Continue
The HTTP 100 status code means a request looks good so far and that the client should continue with the request.
Imagine a case where you want to upload a large file to the server. Most web servers have limits on acceptable sizes of incoming messages to prevent DoS attacks (there can be other restrictions, such as authentication, authorization, or lack of support for particular HTTP methods). To avoid wasting bandwidth by sending a file only for the request to fail somewhere along the way, you can ask the server for an approval first, allowing it to flag any issues before the client sends the request body.
100 Continue
is an informational status code, and in most cases, you won’t have to deal with it directly. Informational status codes (1xx
) are temporary and should not be treated as final responses.
Expect header
You can request permission by including the Expect
header with the request:
POST /media HTTP/1.1
Host: example.com
Content-Type: video/mp4
Content-Length: 42424242
Expect: 100-continue
If the server decides that the request looks acceptable, it will respond with the 100 Continue
status code:
HTTP/1.1 100 Continue
Note that the Expect
header can only have a single value, which is 100-Continue
.
curl
curl includes the Expect
header automatically if one of the following holds:
- the request isn’t HTTP/2
- the HTTP request method is PUT
- the HTTP request method is POST, and the message body is either unknown or exceeds 1 megabyte
This mechanism can cause unnecessary delays in servers that don’t handle it properly. That’s why curl sends the Expect
header when the body exceeds 1 megabyte (up from 1 kilobyte).
See also
- 417 Expectation Failed - a status code servers use when they don’t support or couldn’t understand the
Expect
header.