The HTTP protocol is stateless, but I found this on the Kurose-Ross book:
The default HTTP method is with persistent connections and pipeling.
This means that it can handle multiple requests, so it keeps opened the socket of a client that wants to ask multiple requests.Is that true? If yes, why is HTTP protocol considered stateless?
HTTP persistent connections relate to TCP connection being left open. HTTP operates on top of TCP – so TCP can be connected and/or stateful whereas HTTP would not. TCP is just the transport for HTTP.
If you look at the OSI model, you can see that TCP is on layer 4 (transport), whereas HTTP is on layer 7 (application). HTTP is not tied to TCP and could use other ways of transport too – as a protocol, it is not “inheriting” features from TCP.
(Note also that the persistent connection is not really persistent for a very long time. For Apache 2, it is open only for 5 seconds per default, and “According to RFC 2616 (page 46), a single-user client should not maintain more than 2 connections with any server or proxy”.)