holblocking-blogpost icon indicating copy to clipboard operation
holblocking-blogpost copied to clipboard

How to reproduce the example of HOL HTTP1.1?

Open ManfredHu opened this issue 2 years ago • 1 comments

Thanks for your article, I tried to reproduce the example of HOL HTTP1.1, but found that it was not possible to merge two files in one TCP package.

image

I used wireshark to grab the html file, and found that the js and css files were in two GET requests.How to reproduce the case of the article?

ManfredHu avatar Jul 13 '22 16:07 ManfredHu

Hey @ManfredHu,

I'm not entirely sure what you are asking here exactly, as there are several HTTP/1.1 examples in the post, but none of them have 2 requests in a single TCP packet, only responses? (not that it matters all that much in practice, but still).

If you're trying to recreate TCP packet 2 of Figure 2, that should be possible in concept, but it depends on the TCP + HTTP/1.1 server you're using. The one you're using now probably calls a socket.flush() or similar, causing the HTTP data to end up in separate TCP packets instead of in the same one. There's not really anything technical to prevent them from being sent in the same packet, as receivers treat incoming TCP data as a bytestream instead of individual packets anyway. As such, you can probably emulate this yourself by concatenating HTTP/1.1 responses (including headers!) in a single buffer, then writing it to the TCP server socket in 1 go. That should cause both to end up in a single TCP packet.

If you're trying to recreate TCP packet 2 of Figure 3... well, I don't think you'll ever be able to, that's of course the entire point of the article and the reason we have HTTP/2 and QUIC, because that's just not possible with HTTP/1.1 (without producing errors).

I hope this helps. If not, please provide me with a bit more context about what you're trying to do and how exactly :)

With best regards, Robin

rmarx avatar Jul 14 '22 16:07 rmarx