HTTP response status code 100 Continue is one of the informational HTTP responses returned by the server. It indicates that the HTTP session is progressing as expected and is asking the client to continue to the next step. The client can safely ignore this HTTP response if the HTTP request is complete. The HTTP response is only sent when the client includes the HTTP header request field Expect.
Clients that include the Expect HTTP header request field want to ensure that the server is prepared to receive the message body before it is transmitted. For instance, if a message body is very large, is not of a type that is accepted by the server, or the user is not authorized to send files, this process can be used to validate these conditions in advance of sending the body.
Once the 100 Continue status code has been received, the message body can be sent. If alternatively, the server returns a 417 Expectation Failed HTTP response, then the client is not to continue.
The advantage to using the Expect HTTP header with
100-continue is to conserve bandwidth in situations where the server is particular about the content that it receives and processes.
The disadvantage to using this approach is that because the HTTP request header and body are sent independently, some environments are prone to having them separated and ultimately can return an error instead of processing the HTTP request.
PUT /docs HTTP/1.1 Host: www.example.ai Content-Type: application/pdf Content-Length: 99000 Expect: 100-continue
HTTP/1.1 100 Continue
Follow-up to request
<PDF file contents are sent as message body>
HTTP/1.1 200 OK
In the example, the client is planning to send a 99kb PDF file to the server for processing and indicates this in the HTTP request, asking for validation in advance. The server responds that it is okay, and the client sends the message body. As a final response, the server concludes the HTTP session with an indication of success.
Alternatively, the server may have initially responded with an HTTP status code error, such as:
HTTP/1.1 417 Expectation Failed
In this situation, then the client did not send the PDF, and further communication will take place starting with a new HTTP request.
Apache HttpComponents Core
The 100 Continue informational response status code is sent by the server to inform the client that their HTTP request is authorized to continue and the server awaits the client sending the message body.