Flow of an HTTP session.
A Thread ๐งต๐๐ป
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
โข 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.
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.
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.
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)
- 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.
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.
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.
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)
โข 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. ๐๐
Follow @Rapid_API for more exclusive content. ๐๐
Loading suggestions...