HTTP, State and Session Management : The HornHill Saga (Part one)
On a cold wintry morning, Ser Ludwig stood on the balcony of his ancestral castle, an old but mighty building, sat atop the hills of HornHill. He was clad in a crimson cloak hovering his once shiny knight armour - which has seen dozens of war and countless battles - and a long sharp battle-axe found its place in his right hand. "Hurry along to the prison", he commanded his new young Squire, Mertens, who hurried along the slopes to the prison. He got to the prison and relayed the order to the prison guard on duty who didn't even flinch. The prisoner had been captured the previous night and orders had been set regarding people who can transport the prisoner and he's considered high valued, with knowledge of several enemy intel which can be extracted. "Where's your letter of authorization confirming this request, otherwise known as the HTTP request?" the prison guard asked, "No letter was given to me, I was just told to come for the prisoner", "Then I'm sorry, you'll have to go back for the authorization". "No problem", the Squire said as he climbed back on his horse, a tired but still energetic Andalusian war horse, and strode away, back to HornHill.
HTTP: As Mertens got back to HornHill, he hurried along to his masters quarters, found him on the same balcony he had left him earlier, and explained to him the difficulty he faced, and asked the meaning of "HTTP request" and why it was so important it has to be issued before the prisoner could be released. Understanding his ordeal, Ser Ludwig explained, 'an HTTP request is made by a client (in this case which is himself), to a named host (the unsmilling prison guard), which is located on a server (the prison). The aim of the request is to access a resource on the server (which is the captured prisoner). To make the request, the client uses components of a URL (Uniform Resource Locator), which includes the information needed to access the resource, which is basically the request itself' - He said. After that, Ser Ludwig entered his chambers and brought a wax-sealed document, and handed it over to the Squire, and told him, "Hurry, the document is time sensitive, if you didn't get there or you stay inside the prison too long, I'll have to send another one, and I do not want to" He commanded. "Yes sir", Mertens said, dashed out and went on his way.
Stateless : As he galloped along the slopes of HornHill, a perfect countryside with great landscape and less traffic, especially in this winter. A thought came to him, what if he acquired the prisoner, negotiate with the prisoner on their way back and they both run away to his city for a reward, since there's no way his master can know his current status with the prisoner, meaning he is independent while carrying out the task and his master has to depend on his abilities to do the task. In order words, he is under something called a stateless protocol. A stateless protocol means that each request to the server (prison guard) is executed independently, where the server does not maintain, or know the current status of the individual client for each request execution. In simpler words, the status (state) of the client (prisoner) is not saved or maintained (less). In a sense, the server is unable to link up previous communications with the client.
Session Management: Mertens got down from his horse, walked briskly to the entrance of the prison, still harmed with the HTTP request, he was stopped by the unsmilling prison guard once again. "Where's your HTTP request", he demanded, Mertens handed it over, and after a careful look at it, the prison guard handed him another document, on it was written "Session Management". What thou Session Management, pray tell. The prison guard let out a frown, with his face even more unfriendly, then proceeded to explain. "Session management refers to the management of the prisoner (clients') states in the prison (server). A session can refer to the period between the beginning to the end of the intended usage of the prison. The period where from where the user logs into the prison system till the user logs out of it is an example of a session. Session management is when I, the guard (the server) maintains that you (the client) is logged in during the example session. And the process is even divided into 3, you noob". Getting so interested in how things work, Mertens proceeded to ask, "you mind explaining the processes to me, sir?". The guard, seeing he has no choice than to, proceeded
"I. Registering the client's state (e.g. After successful login) : Here is when you successfully gain entrance to the prison and cells, you're inside and are navigating yourself to the designated prisoner cell which I will have told you beforehand.
II. Checking the client's state (e.g. Looking at profile page: Here you've successfully located your prisoner, then you proceed to identify him/her, after positive identification, he/she is handed over to you to transport back to HornHill.
III. Destroying the managed client's state (e.g. Logging out): Here is when you're processed out of the prison system, so it's all you alone with the prisoner from here on.
On realising this, the thought of cutting a deal with the prisoner left Mertens, because what if the prisoner decided to attack him instead. He proceeded into the prison and located the prisoner, who had been waiting eagerly, with a broad smile on his face he said "Hello Mertens, so long " with a devilish smile. Confused and surprised, Mertens asked "How did you know my name ? Have we met before? ". The prisoner smiled and said "If you really wanna know, you'll have to wait for the second part of this post, where we will discuss about the journey back to HornHill". Thank you