Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is HTTPS Stateful or Stateless?

Tags:

https

I want a bit of clarity on whether HTTPS is stateful or stateless? This is with regards to a RESTful API I built. We were initially using HTTP. Since HTTP essentially works over TCP/IP which is stateless hence HTTP is stateless, but when I switched to HTTPS my API became stateful. I wanted to know whether my conclusion that HTTPS is stateful. is correct or not? I created my API using a middleware tool called webMethods. Thanks

like image 394
OptionalName Avatar asked Jun 16 '12 22:06

OptionalName


2 Answers

TLS/SSL is stateful. The web server and the client (browser) cache the session including the cryptographic keys to improve performance and do not perform key exchange for every request.

HTTP 1 is not stateful. HTTP/2 however defines many stateful components, but the "application layer" still remains stateless.

TL;DR: The transport pipe (TLS) is stateful, original HTTP is not.

Additional note: Cookies and other stateful mechanisms are later additions defined in separate RFC's. They are not part of the original HTTP/1.0 specification, although other stateful mechanisms like caching and HTTP auth are defined HTTP 1.1 RFC and RFC 2617. HTTP 1 is said to be stateless although in practice we use standardized stateful mechanisms. HTTP/2 defines stateful components in its standard and is therefore stateful. A particular HTTP/2 application can use a subset of HTTP/2 features to maintain statelessness.

Theory aside, in practice you use HTTP statefully in your everyday life.

like image 92
Zamicol Avatar answered Oct 03 '22 02:10

Zamicol


The S in HTTPS is concerned with the transport, not the protocol. The semantics of the HTTP protocol remain the same for HTTPS. As the article about HTTPS on Wikipedia states,

Strictly speaking, HTTPS is not a separate protocol, but refers to use of ordinary HTTP over an encrypted SSL/TLS connection.

And the HTTP protocol is stateless by design, not because it is used most frequently over TCP/IP (nothing stops you to use HTTP over UDP for example).

like image 27
npclaudiu Avatar answered Oct 03 '22 01:10

npclaudiu