100 Continue
The HTTP 100 Continue informational response status
code indicates the HTTP session is
progressing as expected and asks the client to continue.
The client safely ignores this response when the HTTP
request is already complete. The server sends this
response only when the client includes the
Expect header with 100-continue.
Usage
Clients including the Expect header want to confirm the server is prepared to receive the message body before transmitting. When a message body is large, uses a content type the server does not accept, or the user lacks authorization to send files, this process validates those conditions before sending the body.
Once the 100 Continue status code arrives, the message body is sent. When the server returns 417 instead, the client does not continue.
The advantage of using the Expect header
with 100-continue is conserving bandwidth when the
server is selective about the content received and
processed.
The disadvantage is the HTTP request header and body are sent independently. Some environments are prone to having them separated and returning an error instead of processing the HTTP request.
Example
Request
PUT /docs HTTP/1.1
Host: www.example.re
Content-Type: application/pdf
Content-Length: 99000
Expect: 100-continue
Response
HTTP/1.1 100 Continue
Follow-up to request
<PDF file contents are sent as message body>
Final response
HTTP/1.1 200 OK
The client plans to send a 99 KB PDF file to the server for processing and indicates this in the HTTP request, asking for validation in advance. The server responds positively, and the client sends the message body. As a final response, the server concludes the HTTP session with a success indication.
Alternatively, the server responds with an error:
HTTP/1.1 417 Expectation Failed
In this situation, the client does not send the PDF, and further communication starts with a new HTTP request.
Code references
.NET
HttpStatusCode.Continue
Rust
http::StatusCode::CONTINUE
Rails
:continue
Go
http.StatusContinue
Symfony
Response::HTTP_CONTINUE
Python3.5+
http.HTTPStatus.CONTINUE
Apache HttpComponents Core
org.apache.hc.core5.http.HttpStatus.SC_CONTINUE
Angular
@angular/common/http/HttpStatusCode.Continue
Takeaway
The 100 Continue informational response status code is sent by the server to inform the client the HTTP request is authorized to continue and the server awaits the message body.