Yevgeny Simkin
Yevgeny Simkin

Reputation: 28359

Does 200 mean the request successfully started or successfully finished?

I realize this might sound like an odd question, but I'm seeing some odd results in my network calls so I'm trying to figure out if perhaps I'm misunderstanding something.

I see situations where in isolated incidents, when I'm uploading data, even though the response is 200, the data doesn't appear on the server. My guess is that the 200 response arrives during the initial HTTP handshake and then something goes wrong after the fact. Is that a correct interpretation of the order of events? Or is the 200 delivered once the server has collected whatever data the sending Header tells it is in the request? (cause if so then I'm back to the drawing board as to how I'm seeing what I'm seeing).

Upvotes: 1

Views: 327

Answers (3)

Remy Lebeau
Remy Lebeau

Reputation: 596497

A success reply, like 200, is not sent until after server has received and processed the full request. Error replies, on the other hand, may be sent before the request is fully received. If that happens, stop sending your request.

Upvotes: 1

Jetti
Jetti

Reputation: 2458

It means it has been successfully finished. From the HTTP /1.1 Spec

10.2.1 200 OK

The request has succeeded. The information returned with the response is dependent on the method used in the request, for example:

GET an entity corresponding to the requested resource is sent in the response;

HEAD the entity-header fields corresponding to the requested resource are sent in the response without any message-body;

POST an entity describing or containing the result of the action;

TRACE an entity containing the request message as received by the end server.

Upvotes: 5

Romeo Mihalcea
Romeo Mihalcea

Reputation: 10252

Finished. It doesn't make sense otherwise. Something might go wrong and the code could throw an error. How could the server send that error code when it already sent 200 OK.

What you experience might be lag, caching, detached thread running after the server sent the 200 etc.

Upvotes: 2

Related Questions