News for hackers. Stuff that matters.
Re:Http2 explained by jerf on Thursday February 12, 2015 @03:01PM (#9041018)
"One of the drawbacks with HTTP 1.1 is that when a HTTP message has sent off with a Content-Length of a certain size, you can't easily just stop it. Sure you can often (but not always – I'll skip the lengthy reasoning of exactly why here) disconnect the TCP connection"

Can someone give me more of a hint of that reasoning so that I can at least search for it? I'm intrigued, but the search terms I'm trying all come back with explanations of why you might need Content-Length, a different issue.

Re:Http2 explained by Lukasa on Thursday February 12, 2015 @03:09PM (#9041074)
Sure. The only way to stop a message before the content-length is transmitted is to kill your TCP connection. This is inefficient: you need to recreate it, bearing all the TCP set-up cost all over again, and then deal with the small initial congestion window on your new connection.

HTTP/2 allows you to avoid that by saying "I'm done with this stream now, sorry!"

Re:Http2 explained by ashmud on Thursday February 12, 2015 @03:38PM (#9041245)
How do web browsers handle cancelled requests? Subjectively speaking, it feels like browsers can take a while to recover from cancelling the loading of a large page/page with a large number of assets. Could this be part of that?
Re:Http2 explained by patrickmcmanus on Thursday February 12, 2015 @05:10PM (#9041700)
you're right. Cancel's in H1 are very painful because all the in-progress transactions have to be torn down completely. New transactions have to set them all up again.

H2 let's you just send the server a short message that says "stop sending that stream" and you can go ahead and pipeline a new request right along with that cancel.

This happens a lot more than you think as you browse through a collection of things and are just scanning them and clicking the next button - that's a really common use case h2 will handle much better.

Re:Http2 explained by Lukasa on Thursday February 12, 2015 @03:11PM (#9041079)
Ah, sorry, I misread your question! I don't actually know the lengthy reasoning for that edge case. =(
Re:Http2 explained by jerf on Thursday February 12, 2015 @04:05PM (#9041381)
No problem, I see I was not clear. Yes, I am specifically curious about the edge case when you "can't" just disconnect the TCP. Scare quoted because I'm sure you can, it just involves something undesirable happening. I have vague ideas and guesses, but I'm curious about what the intent was.
Re:Http2 explained by pluma on Friday February 13, 2015 @08:09AM (#9044094)
Basically, in HTTP 1.x there are only very specific times at which the server can respond throughout a request. In particular, there's no way to tell a client "please stop" when it is transmitting the request body.

So how most web applications handle request bodies that are too big is to either kill the connection (which to the client looks like a network issue) or patiently pipe the entire message to /dev/null before sending a response that indicates the message has not been processed (e.g. HTTP 413).

Unless I'm mistaken, this can be avoided if the client sends an honest Content-Length header, but this only works if the size is known in advance and the client is honest (you could submit an arbitrary number of bytes with a Content-Length header indicating something much smaller).

Because there is no clear way to distinguish a server aborting a request mid-body because of the size versus spontaneous existence failure, a client might misinterpret that and attempt to re-submit the same request later.

Re:Http2 explained by iso8859-1 on Friday February 13, 2015 @01:03PM (#9045852)
Most requests are GET, how would Content-Length help there?