Does HTTP response "200 OK" give a guarantee that the document has been received by the machine who generated the HTTP request?

Naveen Suryawanshi picture Naveen Suryawanshi · Mar 15, 2018 · Viewed 9k times · Source

I have two machines, A and B.

A sends an HTTP request to B and asks for some document. B responds back and sends the requested document and gives a 200 OK message, but machine A is complaining that the document is not received because of a network failure.

Does HTTP code 200 also work as acknowledgment that the document is received?

Answer

Stephen C picture Stephen C · Mar 15, 2018

Does the HTTP 200 code also work as an acknowledgment that document has been received?

No. Not at all.

It is not even a guarantee that the document was completely transmitted.

The response code is in the first line of the response stream. The server could fail, or be disconnected from the client anywhere between sending the first line and the last byte of the response. The server may not even know this has happened.

In fact, there is no way that the server can know if the client received a complete (or partial) HTTP response. There is no provision for an acknowledgment in the HTTP protocol.

Now you could implement an application protocol over the top of HTTP in which the client is required to send a second HTTP request to the server to say "yes, I got the document". But this would involve some "application logic" implemented in the user's browser; e.g. in Javascript.