4 ms·
"HTTP/1.1 keep-alive connections, though, do not support sending multiple requests out at the same time, which again resulted in a bottleneck due to the growing
by 3xblah 7y ago
"HTTP/1.1 keep-alive connections, though, do not support sending multiple requests out at the same time, which again resulted in a bottleneck due to the growing complexity of Web pages."
Is this true.
Below we use HTTP/1.1 pipelining to send multiple requests (30) over a single TCP connection in order to print short descriptions of the last 30 infoq.com articles posted to HN.
http11 ()
{
while read x;do case $x in https://*)x1=${x#https://*/};;http://*)x1=${x#http://*/};;*)x1=${x#*/};esac;[ $x1 != $x ]||x1="";x2=${x#*//};x3=${x2%%/*};printf "GET /$x1 HTTP/1.1\r\nHost: $x3\r\nConnection: keep-alive\r\n\r\n";done|sed '/^$/d;N;$!P;$!D;$d';printf "Connection: close\r\n\r\n";
}
curl https://news.ycombinator.com/from?site=infoq.com|grep -o "https://www.infoq[^\"?]*"| http11 |openssl s_client -connect www.infoq.com:443 -ign_eof -quiet 2>/dev/null|sed -n '/@id/p;/^ \"description\": \"/p'
- gsnedders 7y agoWith HTTP/1.1 pipelining, you can't reliably start sending the second request until the first response is complete. As such, you can't have multiple requests out at the same time. It's also very much linear.
- 3xblah 7y ago"With HTTP/1.1 pipelining, you can't reliably start sending the second request until the first response is complete." In the example, all 30 requests were sent at the same time. openssl did not wait for any responses. This example can be repeated again and again and every time, all the responses are received, in order. It is reliable. Not sure who "you" refers to in the above statement, however if it applies to me then that statement is incorrect. I have been using HTTP/1.1 pipelining outside the browser for decades. HTTP/1.1 was written for HTTP clients. Browsers are just one type of client, not the only type. More than half the traffic on the internet is initiated by non-interactive clients. Besides headless, that excludes browsers. From RFC 2616: user agent The client which initiates a request. These are often browsers, editors, spiders (web-traversing robots), or other end user tools.
- gsnedders 7y agoAh, I seem to have misremembered; from RFC 7230: > A client that supports persistent connections MAY "pipeline" its requests (i.e., send multiple requests without waiting for each response). Maybe this was just yet another case where plenty of intermediaries are broken and mass-deployment has always been difficult?
- Dylan16807 7y agoYes, that. I always set firefox to attempt pipelining until they removed it in favor of HTTP/2. It worked well.