Why is it said that “HTTP is a stateless protocol”

2019-01-02 16:55发布

HTTP has HTTP Cookies. Cookies allow the server to track the user state, the number of connections, last connection, etc.

HTTP has persistent connections (Keep-Alive) where several requests can be sent from the same TCP Connection.

8条回答
浮光初槿花落
2楼-- · 2019-01-02 17:35

Because a stateless protocol does not require the server to retain session information or status about each communications partner for the duration of multiple requests.

HTTP is a stateless protocol, which means that the connection between the browser and the server is lost once the transaction ends.

查看更多
刘海飞了
3楼-- · 2019-01-02 17:36

It isn't stateless. HTTP is (usually) built on top of TCP, which is stateful. It maintains connection information, at the very least. If it were built on UDP things would be different.

Saying that HTTP is stateless is like saying that computer programs are electron-less because the computers that host them are what use the electrons. That's nonsense. In the same way, you can't completely separate HTTP from TCP.

layers

查看更多
登录 后发表回答