An Overview of HTTP and OSI Model

dilshan ukwattage
7 min readMay 17, 2021

--

What is HTTP

The Hypertext Transfer Protocol (HTTP) is an application layer protocol designed to transfer information between networked devices. HTTP is the foundation of data communication for the World Wide Web(WWW). WWW is about communication between web clients and servers Communication between client computers and web servers is done by sending HTTP Requests and receiving HTTP Responses.

Evolution of HTTP

Evolution of HTTP

HTTP/0.9

The initial version of HTTP had no version number and it has been later called 0.9 to differentiate it from the later versions. Features of the HTTP /0.9 are,

  1. Very simple
  2. Only GET requests were supported
  3. The response had to be a HTML document.
  4. Only a file path and name could appear in a GET request

HTTP/1.0

Features of the HTTP /1.0 are,

  1. The notion of HTTP headers has been introduced
  2. Simple caching
  3. Versioning information is now sent within each request (HTTP/1.0 is appended to the GET line)

HTTP /1.1

Features of HTTP /1.1,

  1. Multiple request and response can be have per one connection.
  2. Pipelining has been added, allowing to send a second request before the answer for the first one is fully transmitted, lowering the latency of the communication.
  3. Chunked responses are now also supported.
  4. Additional cache control mechanisms have been introduced.

Before HTTP/ 1.1 introduced both HTTP /0.9 and HTTP/ 1.0 we need to reestablished the TCP connection before each and every request. which means only one request and response per connection. So if we need to send another request we need to reestablished the TCP connection.

TCP connection establishment(Three way handshake)

Three way handshake HTTP /1.0 vs 1.1

HTTP 1.0 vs 1.1

HTTP Status Codes

HTTP response status codes indicate whether a specific HTTP request has been successfully completed. Responses are grouped in five classes.

  1. Informational responses (100–199)
  2. Successful responses (200–299)
  3. Redirects (300–399)
  4. Client errors (400–499)
  5. Server errors (500–599)

What is OSI Model

The open systems interconnection (OSI) model is a conceptual model created by the International Organization for Standardization describes seven layers that computer systems use to communicate over a network.

Hint: To remember these 7 Layers we can use the below sentence. The starting letter of each word represent a layer.

Please Do Not Throw Sausage Pizza Away.

Application Layer

The application layer is the top layer of the OSI model and it used by end-user software such as web browsers and email clients. These applications produce the data, which has to be transferred over the network. application layer provides protocols that allow software to send and receive information and present meaningful data to users. A few examples of application layer protocols are Hypertext Transfer Protocol (HTTP), File Transfer Protocol (FTP), Post Office Protocol (POP), Simple Mail Transfer Protocol (SMTP), and Domain Name System (DNS).

Presentation Layer

This layer is primarily responsible for preparing data so that it can be used by the application layer.

The functions of the presentation layer are :

  1. Translation : For example, ASCII to EBCDIC.
  2. Encryption/ Decryption : Data encryption translates the data into secure format that hide the true meaning.
  3. Compression: Reduces the number of bits that need to be transmitted on the network.

Session Layer

Session layer responsible for opening and closing communication between the two devices. The time between when the communication is opened and closed is known as the session.

The functions of the session layer are :

  1. Session establishment, maintenance and termination: It is responsible for opening sessions, ensuring they remain open and functional while data is being transferred, and closing them when communication ends.
  2. Synchronization : Session layer allows a process to add checkpoints which are considered as synchronization points into the data. These synchronization point help to identify the error so that the data is re-synchronized properly, and ends of the messages are not cut prematurely and data loss is avoided.
  3. Dialog Controller : The session layer allows two systems to start communication with each other in half-duplex or full-duplex.

Transport Layer

Transport layer is responsible for end-to-end communication between the two devices. The transport layer takes data transferred in the session layer and breaks it into “segments” on the transmitting end. The data in the transport layer is referred to as Segments. Transport layer is known as heart of the OSI model. The transport layer also provides the acknowledgement of the successful data transmission and re-transmits the data if an error is found.

The main functionalities of this layer are,

1.Segmentation and Reassembly: This layer accepts the message from the (session) layer , breaks the message into smaller units . Each of the segment produced has a header associated with it. The transport layer at the destination station reassembles the message.

2.Floor control

Floor control done by sending data at a rate that matches the connection speed of the receiving device. Because sometimes sender has a fast connection but receiver has a slow connection.

3. Error control

Error control done by on the receiving end by ensuring that the data received is complete or not, if not, requesting it again.

Transmission Control protocol(TCP) and User datagram Protocol UDP are the most common used protocols in the transport layer.

TCP is a connection-oriented protocol, whereas UDP is a connectionless protocol. The speed for TCP is slower while the speed of UDP is faster. TCP uses handshake protocol like SYN, SYN-ACK, ACK while UDP uses no handshake protocols.

Network Layer

The network layer has two main functions. One is breaking up segments into network packets, and reassembling the packets on the receiving end. The other is routing packets by discovering the best path across a physical network.

  1. Routing: The network layer protocols determine which route is suitable from source to destination. (best path)
  2. Logical Addressing: In order to identify each device on internetwork uniquely, network layer defines an addressing scheme. The sender & receiver’s IP address are placed in the header by network layer. Such an address distinguishes each device uniquely and universally.

Data link Layer

The data link layer establishes and terminates a connection between two physically-connected nodes on a network. The main function of the data link layer is to make sure data transfer is error-free from one node to another, over the physical layer. It breaks up packets into frames and sends them from source to destination. (divided into frames depending on the frame size of NIC(Network Interface Card)).

Data Link Layer is divided into two sub layers :

  1. Logical Link Control (LLC)

What LLC basically does is identifies network protocols, performs error checking and synchronizes frames.

2.Media Access Control (MAC)

Media Access Control(MAC) uses MAC addresses to connect devices and define permissions to transmit and receive data.

The functions of the data Link layer are :

  1. Framing: Framing is a function of the data link layer. It provides a way for a sender to transmit a set of bits that are meaningful to the receiver. This can be accomplished by attaching special bit patterns to the beginning and end of the frame.
  2. Physical addressing: After creating frames, Data link layer adds physical addresses (MAC address) of sender and/or receiver in the header of each frame.
  3. Error control: provides the mechanism of error control in which it detects and retransmits damaged or lost frames.
  4. Flow Control: The data rate must be constant on both sides else the data may get corrupted thus, (Because sometimes sender has a fast connection but receiver has a slow connection) flow control coordinates that amount of data that can be sent before receiving acknowledgement.
  5. Access control: Decides which device has control over the link at a given time when a single communication channel is shared by multiple device.

Data Link layer is handled by the NIC (Network Interface Card) and device drivers of host machines. Switch & Bridge are Data Link Layer devices.

Physical Layer

physical layer includes the physical equipment involved in the data transfer, such as the cables, switches or even wireless communication. It is responsible for the actual physical connection between the devices. This is also the layer where the data gets converted into a bit stream, which is a string of 1s and 0s. The physical layer of both devices must also agree on a signal convention so that the 1s can be distinguished from the 0s on both devices.

Summarize

References

https://www.cloudflare.com/learning/ddos/glossary/open-systems-interconnection-model-osi/

--

--

dilshan ukwattage
dilshan ukwattage

Written by dilshan ukwattage

Software Engineer at IFS R&D International (Pvt) Ltd

No responses yet