I saw Expect: 100-continue in some PUT request(uploading a file), what does it mean?
Upon Expect: 100-continue , the server responds with: 100 (Continue) if the information from the request header is insufficient to resolve the response and the client should proceed with sending the body.
If the target resource does have a current representation and that representation is successfully modified in accordance with the state of the enclosed representation, then the origin server must send either a 200 ( OK ) or a 204 ( No Content ) response to indicate successful completion of the request.
The HTTP 200 OK success status response code indicates that the request has succeeded. A 200 response is cacheable by default. The meaning of a success depends on the HTTP request method: GET : The resource has been fetched and is transmitted in the message body.
What is supposed to happen, is you're supposed to send the request headers with an:
Expect: 100-continue
header. Then, after you have sent the headers, but before you send the payload, you should check to see if you get the 100 response, or a 417 response. If you get the 100 response, you can continue sending the payload. If you don't, you should stop.
The premise is that when you're getting ready to send that 10GB file, this gives the server an opportunity to say "Hold on, cowboy" and then you can handle the process more elegantly than the server simply slamming the socket shut on you.
The fact that you got a 100 back, and you weren't expecting it, says you probably got both the 100 and the 200 (or whatever) response. The 100 was sent to you after the headers were sent, then the final response when the request was finished.
That you weren't paying attention to it is really a detail.
But, ideally, in the future your processing can consider the proper mid-request response.
If you did NOT send the Expect header, the server should not have sent you the 100, since you weren't telling it that you were going to process it. If you DID send the Expect header, then the 100 should not have come as a surprise.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With