top | item 21085363

HTTP 1, 2, and 3 in a Nutshell

5 points| colemorrison | 6 years ago |start.jcolemorrison.com

2 comments

order

billconan|6 years ago

I don't understand "using ONE TCP connection, it can send multiple request/responses in parallel!".

Say a browser sends 2 requests in parallel using the same socket.

one request asks for a png image, one request asks for a css file. The server returns 32 bytes of data back. How does the client know what that 32 bytes are? are they part of the png image or the css file?

ktpsns|6 years ago

Well of course because HTTP/2 is a layer on top TCP. While TCP 32 byte package header will allow the OS to route it to your socket, the HTTP/2 package header will allow the browser to route it to the correct request-response.