| The server can certainly send that header on a response when it intends to close the connection immediately after the response. I wouldn't consider that connection to be idle. However, when the server holds the connection open for some amount of time and then decides to close it, it's not permitted for the server to send a response header, because there's no request to respond to. I would love to be wrong, but I don't think I am, because this scenario is mentioned in the RFC, "For example, a client might have started to send a new request at the same time that the server has decided to close the "idle" connection. From the server's point of view, the connection is being closed while it was idle, but from the client's point of view, a request is in progress." [1] An example chain of events is: t0 client opens connection (syn) t1 server accepts connection (syn+ack) t2 client sends first request t3 server sends response and keeps connection open ... t63 client sends second request t63 (simultaneously within a margin of the one way trip time), server closes connection because it's been idle for
60 seconds t64 client receives FIN t64 server receives data on closed socket and sends RST t65 client receives RST http/2 improves this greatly because in this example, a compliant server will send goaway with last-stream-id 1 prior to closing the connection, and the client will know the second request was not processed and should be retried. It still suffers a latency penalty because it has to start a new connection, and it already wasted somewhere between a one way trip and a round trip. [1] https://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.... |