I know that HTTP is a stateless protocol. But there is no proper explanation for statelessness of HTTP protocol. Why HTTP protocol is stateless? What happens when HTTP Protocol is stateful ?
-
2What happens if a mouse flies? This is no "what happens" question. HTTP isn't stateful. Period. It's how the protocol is designed. – CodeCaster May 16 '18 at 10:36
-
1Can go through the same on this.. https://stackoverflow.com/questions/5836881/stateless-protocol-and-stateful-protocol – Nivas Pandian May 16 '18 at 10:42
1 Answers
There is no proper explanation for statelessness of HTTP protocol.
You probably have missed the RFC 7230, one of the documents that define the HTTP protocol. See some quotes below:
HTTP is a stateless request/response protocol that operates by exchanging messages across a reliable transport- or session-layer "connection". [...]
HTTP is defined as a stateless protocol, meaning that each request message can be understood in isolation. Many implementations depend on HTTP's stateless design in order to reuse proxied connections or dynamically load balance requests across multiple servers. [...]
What happens when HTTP Protocol is stateful?
It doesn't happen: HTTP is not stateful and won't be.
The RFC 6265 defines some mechanisms for state management in HTTP, such as cookies, but it doesn't make HTTP stateful.
As described in the RFC 7230, HTTP/1.1 supports "persistent connections", allowing multiple requests and responses to be carried over a single connection, but it also doesn't make HTTP a stateful protocol in any way.
If you need a stateful protocol, you may look at WebSockets, defined in the RFC 6455. It can coexist with HTTP and can deployed in the HTTP infrastructure.

- 1
- 1

- 124,154
- 35
- 280
- 359