What are the existing layers in an HTTP/HTTPS request?

Asked

Viewed 1,138 times

8

I gave a special attention this morning to read some questions and answers here on the site that speak specifically about https/ssl.

Like for example these:

In those two, I saw appearing more than once the terms transport layer and application layer.

I was able to understand something, but I thought it would be interesting to ask a question to see if more details could arise.

I wanted to know

  • Besides the transport layer and application layer, in an http or https request, there is some other layer?

  • What differentiates these layers?

  • Exactly what happens in the transport layer?

  • We could say that a server with Apache and PHP would be the application layer?

1 answer

8


In addition to the transport layer and application layer, in an http or https request, there is some other layer?

Actually it’s not quite HTTP or HTTPS that has layers. It’s all the traffic that has layers. This is called OSI model (Open Systems Interconnection) created by this entity that takes care of interconnection standards. It is made official by ISO/IEC 7498-1.

Each layer has a function and a way to be formed. They are (from the highest to the lowest:

  • Application layer - Layer in the host, takes care of dice in what is most apparent to humans, some of them beyond the HTTP, sane FTP, DNS, SMTP, telnet, and each one operates as best suits it to meet the specific need of that application.
  • Presentation layer - Layer in the host, takes care of dice and makes the field medium between the application and the network, generally doing some data conversion, including character encoding, compression and encryption of the data snippets.
  • Session layer - Layer in the host, takes care of dice and maintains a control so that the various stretches of data are considered as a single set of transmission maintaining a continuity of communication. Do not confuse with your application session that does not take care of the communication itself.
  • Transport layer - Layer in the host, takes care of segments or datagrams which manipulates the identification of host and other information to ensure adequate transmission with another host, doing multiplexing, data authentication to provide reliability, etc.
  • Network layer - Media layer, takes care of packets and deals with the location of the points (nodes) that will communicate (route, address, traffic capacity). In general it occurs in the hardware with support of driver.
  • Data link layer - Media layer, takes care of frames so that it is delivered from one point to another in a reliable way. In general only the hardware takes care of this. PPP is one of the most used. Examples are Ethernet and IEEE_802.11.
  • Physical layer - Media layer, takes care of the bits where the transmission takes place as crude as possible, as close to the material medium that maintains the electric current, optical or wave generator. Takes care of voltage, impedance, that sort of thing.

What differentiates these layers?

Roughly everyone has a responsibility and they exchange to provide the best possible solution for a certain general need that is still a lot of more specific needs.

Most of the time the programmer doesn’t need to know these things in detail. Eventually you need to know the application layer if you want to do something more advanced or are building an application that will make use of the bottom layers, for example you are building a web or email server.

There are also cases where communication needs to be a lower level. Who knows you might be creating a new protocol for the application layer. It is not so unusual to program directly on TCP, for example.

Below that usually falls more in those who work with telecommunication.

Not all layers are mandatory, especially the top layers. Obviously if the low ones are missing do not use the OSI model, which I do not know any use.

Exactly what happens in the transport layer?

There are several protocols used in this layer. Today the most used (depends on the criterion) is the TCP, but several others are also used (UDP for example). In general the operating system takes care of forming it, and the upper layers need to ask for it to be assembled and treated properly to then delegate to those who take care of the lower layer.

We could say that a server with Apache and PHP would be the application layer?

PHP certainly has nothing to do with it. Apache is an application that generates traffic and takes care of the information that goes into the application layer, but to say that it would be the layer itself would be wrong. It mounts the HTTP header and what we might consider payload. It’s ironic that Hyper Text Transport Protocol is the application layer.

Note below that there are several headers that are being added in each layer and this "Data", which is the payload.

Camadas OSI

I will not go into detail for the question not to be broad, but specific doubts fit, although some may begin to enter another scope.

  • If the HTTP protocol is an application protocol, therefore from the application layer, and if Apache Server is an HTTP server, therefore interpreting HTTP requests, why isn’t Apache the application layer? In this case where we have an HTTP server, who is the application layer?

  • 1

    If you call Apache application layer you have to call the programming language compiler. One is an agent that handles the other.

  • My question remains: In this case where we have an HTTP server, who is the application layer? In my understanding, Apache receives bytes for a websocket connection, interprets these bytes as text, and interprets this text according to the HTTP protocol (verb, Uri, parameters...). If Apache is the component responsible for interpreting the received data following the HTTP protocol, why is it not the application layer, and in this case what is the component that represents the application?

  • I thought the analogy would be enough. The application layer is the application layer, it doesn’t need to be anything else. She has agents who manipulate her. A compiler does essentially the same thing you said, each with its function, and it is not called a programming language, except by a layman. A meat grinder is meat. An app is not an application layer, it’s just an app. You can click on links and see on Wikipedia if you can understand. There doesn’t make this mess too.

  • Naturally the layer itself is a concept, and a hardware or software component implements the layer functions, representing it (it doesn’t make much sense to "manipulate" a layer). In an HTTP communication, Apache implements the application layer function.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.