13 Tweets Jan 31, 2023
Flow of an HTTP session.
A Thread ๐Ÿงต๐Ÿ‘‡๐Ÿป
In HTTP protocol, a typical session has three phases:
โ€ข Establishes a TCP connection
โ€ข Client sends an HTTP request
โ€ข Server sends an HTTP response
๐Ÿ“Œ Establishing a connection
The client establishes the connection with the server using the TCP layer.
Default HTTP port with TCP layer is 80 but other ports might be used as well.
As the 80 port number is the default for the HTTP protocol, so adding it with the domain is not mandatory.
For example,
"RapidAPI .com/hub" and "RapidAPI .com:80/hub" are the same things.
But "RapidAPI .com:8080/hub" is different.
๐Ÿ“Œ HTTP Request
After a successful connection, the client can ask for data from the server.
User-agent (mostly web browsers) can send HTTP requests and ask for the necessary data.
A typical HTTP request contains three things:
- Request methods
- HTTP headers
- Method body (optional)
There are request methods that clients can use to perform various operations.
๐Ÿ“Œ HTTP Response
The third and final step in the HTTP session is handled by the server, and that is HTTP response.
After the client sent the request, the server process it and sends the response accordingly.
Server always returns a response doesn't matter request is successful or not.
How does a client know that the request is successful or not?
This is where HTTP status codes come into play.
They are predefined codes according to the response.
The structure of the HTTP response looks like this:
โ€ข Status line
โ€ข Response header
โ€ข Message body (optional)
Check out this thread for HTTP headers:
And that's pretty much it for this thread.
Follow @Rapid_API for more exclusive content. ๐Ÿ’™๐Ÿ™

Loading suggestions...