HTTP is statel-less,so what does it mean by keep-alive?

前端 未结 5 1952
慢半拍i
慢半拍i 2021-02-07 10:49
Keep-Alive: 300
Proxy-Connection: keep-alive

As we know HTTP connection is closed when the request gets responded,so what does it mean by keep-al

5条回答
  •  日久生厌
    2021-02-07 11:33

    Keep-alive has nothing to do with statefulness.

    In networking, one of the costliest operation is repeatedly opening and closing connections. Modern HTML pages, however, technically ask you to do precisely that: First, get the page, then get each resource and repeat until you have everything. Since that would be incredibly slow, HTTP/1.1 allows agents to keep the connection alive until he ahs everything he wants from the server.

    Keep-aliveis basically the web browser telling the server not to hang up yet.

提交回复
热议问题