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). Instead of wasting bandwidth to send the file and have the request fail somewhere along the way, you can ask the server if it’s OK to proceed with the upload.

This mechanism gives the server a chance to error prematurely before the client can send 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:

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 - status code servers use when they don’t support or couldn’t understand the Expect header.

Interested in no-nonsense technical guides?

No spyware, no promotional emails, or keyword-stuffed junk. I will only send you a single email when I've got something interesting to say. Unsubscribe anytime.

You can also subscribe to the Atom feed (it's like RSS, but better).