0
votes

HTTP is client - server communication where client always initiates the connection and server responds.

In the client server communication with HTTP 1.1 the following steps takes place: 1. Client sends the request to the server. 2. Server sends the response to the client with the response message and the status code.

My question is how is the data transfer handled in the protocol? I know HTTP is stateless and also it is either everything or nothing mechanism but how do you prove this? How is the handshake between server and client?

For example: When the server sends the response back to the client, what happens if 50% of the data is sent and then there is connection loss...then what will happen in this scenario? Will the client wait for remaining 50% of the message or it will start new transfer where server tries to send 100% of the message again? (In synchronous communication)

1
This is why such requests have a timeout. if no response is given within the timeout, connection loss or error is assumed.Timothy Groote
Yes I get that when there is timeout but how can we confirm that 100% message is received to the client from the server? does the client sends back anything to the server in the protocol that can validate this?user3384231
(please note, you are asking about HTTP, i think you're after what happens on the TCP layer)Timothy Groote
Yes, thanks for correcting me. sorry to bother u with my silly question. When there is 200, OK, does that mean server is sending 200, OK to client that message is sent to the client, and as well as Client also sends 200, OK to the server? Is that 2-way?user3384231

1 Answers

0
votes

HTTP relies on a TCP connection, so in your example if 50% of the data is correctly sent but others packets (yes, you should think in terms of packets) are lost, the data will be sent again following the rules defined in TCP protocol