All About HTTP (Hypertext Transfer Protocol) and DHCP (Dynamic Host Configuration Protocol): A Detailed Study of the Most Commonly Used Application Layer Protocols
In our previous tutorial, we had an in-depth look at DNS, SMTP, FTP, and MIME protocols with some examples.
In this tutorial, we will explore a few other most commonly used application layer protocols. All that you need to know about HTTP and DHCP is explained in simple terms for your easy understanding.
Also, Read => Free Training Tutorials on Networking
What You Will Learn:
HTTP (Hypertext Transfer Protocol)
It is the TCP/IP-based application layer protocol and is deployed to transport data in the form of images, video, text, HTML files, and query results on the World Wide Web.
The default port assigned to it is 80, however, the other ports are also applicable. It is basically the standardization of communication between various machines on the Internet to communicate with each other.
- Connectionless: Unlike FTP, in which the connection is established and continued till the end of the entire communication session, the HTTP is connectionless.
- The HTTP client is the one in which the browser starts up an HTTP request and after the request is raised it disconnects itself from the server and holds up for a response. When the server is ready with the response, it again makes a new connection with the client and delivers the response.
- Media free: Data in any form like voice, text, or video can be sent over it, as it is the duty of the client and the server to handle the analyzing part at their respective ends.
- Stateless: The client and the server are concerned about the network addresses and other information about each other only during the communication session and after that, they don’t bother about each other. Thus the client and the server don’t save any data about each other and it thereby makes them stateless.
It is based on the client-server architecture model whereas the search engines like Mozilla, web browsers, etc., behave as HTTP clients and the web server behaves as HTTP servers.
The Client initiates the request to the server by using different methods like URI, pursued by the MIME messages which have the information regarding format, client data, and content on a UDP connection.
The HTTP server in response sends back a status message with a success or error code, along with the information requested by the client and again is pursued by MIME messages.
For understanding and writing the HTTP messages, we should understand some of the parameters that are used in building up the messages. The parameters are explained below for your reference.
Also, read =>> What is URI In World Wide Web
Uniform Resource Identifiers:
The URI is used for building up a network connection and recognizing a particular resource. The protocol employs the reference provisions by the URI as a location known as URL and the name known as a URN, for reflecting on the source that which methodology is going to be used.
For an HTML hyperlink, the generic form of uniform resource locator is HTTP: //host: port- number/path/file.html. While the generic form of the URL reference is service: //host/file. File- extension.
Thus in this way the protocol is used for communication over the Internet and the communication between the users and several other media like proxy servers, gateways, etc., by using other protocols as well on this interface.
To provision, the open and extended data typing, the accept headers, and content type fields are deployed.
The generic format is as follows:
Media type= type “/” subtype *(“;” parameter)
For Example, accept: image/jpeg
The HTTP request and response messages use the format RFC 822 and are built up on the basis of the below four articles.
- Start line
- Header fields
- An empty line
- The message body, sometimes selective
#1) Start Line: The format is start line = Request- line | status-line.
For Example: GET /how is you.htm HTTP/1.1 is the request line sent by the client and HTTP/1.1 20 FINE is the status line sent by the server.
#2) Header fields: Header fields are very important as they carry the necessary data about the objects attached in the message body and request or response data of the message line.
There are four kinds of header fields i.e. General header, Request header, Response header, and Entity header.
The generic format of the header field is Message header= field –name “:” [field – value]
Apart from this, there are other few header fields that are most commonly used.
Below is the format with an example of the most commonly used header fields.
(i) HTTP_ACCEPT: The server can acknowledge or even exclude the request raised by the client. Therefore, this is the case where the HTTP server will accept the header information.
Format: Type/subtype, type/subtype and E.g.( Accept: image/gif, text/HTML) and so on.
(ii) HTTP_USER_AGENT: This is used to specify the software, its version, and which browser the client is using for sending the request to the server.
Format: software/version library/version
(iii) Content-Type: It tells which kind of data is sent to the destination end like the type of file, etc. With the help of this header, the recipient will get to know how to handle the data.
Format: content type: audio/mp4.
(iv) Date: It specifies the date and time on which the request is being initiated.
Format: Date: Fri, 21 Sep 2018 18:00:12 GMT
(v) Expires: It specifies the validity session of the information in the resource.
Expires: Fri, 26 Oct 2018 20:00:30 GMT
(vi) From: It specifies the Internet e-mail address of the end-user who initiated the request. This header field is used to avoid the entry of unauthorized resources into the system and unwanted IP addresses can be blocked.
(vii) Last Modified: This field specifies the date and time on which the request initiator user has last modified the content of the resource.
(viii) Location: It is a type of response header. It specifies the location of the resource that was requested and is recognized by the URI.
For Example Location: http://www.education.com/http/http.htm
(ix) Server: This field is also a response header field and specifies the software that is used by the originating server to manage the request. It contains information about the software subtype as well.
For Example Server: Apache/4.2.2 (Linux)
(x) Message Body: A message body consists of data from the HTTP request server like images, videos, attachments of files, etc.
For Example, we have shown a small substance of the message body:
<html> <body> <h1>good morning, India@</h1> </body> </html>
The format of request that is sent by the HTTP client to an HTTP server has the following substances:
- Request line
- Header field followed by CRLF.
- An empty line.
- The message body is sometimes selective.
The request method is case sensitive and in several requests, URI is implemented to perform the action. Some of the commands include GET, POST, PUT, DELETE, CONNECT, OPTIONS, etc.
Also check =>> Best FREE HTTP/HTTPS Proxies
Below given is the example of the request message in which the HTTP requests to fetch the morning.htm page from the web server streaming on www.google.com.
GET /morning.htm HTTP/1.1
Once the HTTP server receives the request from the client, it analyses it and reverts to HTTP response messages.
The Response message has the following substances:
- Header field
- An empty line
- The message body, is sometimes selective.
The version used is 1.1 and the status code is a 3-digit numeral.
The description of the various codes used is as follows:
|2xx||The action is successfully performed and accepted|
|4xx||Client error and request can’t be fulfilled|
|5xx||Server error and server is failed to process the request|
Example of Request Message: HTTP response to fetch morning.htm page from the web page Google.com is
HTTP/1.1 200 OK
Server: Apache/4.4.16 (win64)
Last modified: Wed, 19 Sep 2018 00:20:20 GMT
<html> <body> <h1>morning, good@</h1> </body> </html>
DHCP (Dynamic Host Configuration Protocol)
It is an application layer protocol of the TCP/IP protocol suite.
It is used for managing various networking systems by allocating the IP addresses, subnet mask, default gateway, and other relating routing information to the host devices dynamically, so that the process becomes self-operating and the IP addresses will be allocated to various network devices automatically without any manual interference.
It is deployed in LAN as well as in WAN networks. DHCP follows the client-server architecture model of communication. It is a connection-less protocol based on UDP. Port 67 is used by the server as the destination port and port 68 is used by the client host.
The DHCP server allows the network devices to request IP addresses and other relevant data automatically from the ISP and thus lowering the need for manual configuration done by the network administrator.
In DHCP, the server maintains the unique pool of IP addresses, and data regarding the configuration structure of the clients and assigns the IP addresses from the address pool.
The clients having DHCP feature enabled, broadcast the discovery message to the DHCP server when they first connect to a network and request configuration data for the network with which they are connected. The DHCP server acknowledges the request and responds to it with the desired IP details with an offer message.
But the IP addresses provided by the server are for a particular time period only and they are also known as a lease, and the allocated IP is valid only for that period. If the session still persists, then the DHCP client again requests for the IP, but this time the DHCP server may allocate a new set of IPs as per the set policies.
In the response message, the client replies with a DHCP request message for the offered IP addresses. After the server receives the DHCP request message, it completes the communication process by sending an acknowledgment message flag. In ACK, it forwards the lease period of the IP and the configuration details requested by the client host.
The DHCP server maintains the database of all the IP addresses assigned to several networking systems. To avoid the chances of assigning the same IP pool again and again to two different networking systems it uses MAC addresses and maintains the database for uniquely allocating the IP pools.
The problem with this protocol is that it is not a secure protocol to use as there is no authenticating process involved in the communication process. Thus the IP pool assigned by using this protocol is easily vulnerable to virus attacks and hacking.
POP (Post office Protocol)
The communication system in the olden days was extremely different. The postman used to deliver us the emails sent by our friends and family situated at remote end locations. In the same way, the POP is used in modern-day computer networking systems by the e-mail client systems to retrieve e-mail from the servers.
POP3 is the most popular version used for this purpose. To access the remote end mailbox, the POP facilitates mail download and deletes the options to the local client. Usually, the client retrieves the emails from the server using POP and after saving them on the client PCs, it deletes them from the server.
For encrypted communication, the POP3 connects itself with the server by employing transport layer security (TSL) or secure sockets layer (SSL) on TCP port 995.
The available messages in the inbox in the POP session are recognized by a message number or exceptional identifier allocated to the message by the server.
From the below screenshots of Microsoft outlook, we can see how settings are done for the incoming server using POP3 to retrieve emails.
Outlook Configuration Step-1:
Outlook Configuration Step-2:
Outlook Configuration Step-3:
From this tutorial, we have understood the importance of the application layer protocols in computer networking systems as we are directly or indirectly using them in each and every step while using the Internet, surfing various links, sending or receiving e-mails, etc.
Recommended Reading =>> URL vs URI – Key Differences