HTTP 2 (Still working on it...)
I wrote this when I was in the airport when going to Anime Expo early this month... I need sleep... I know I won't finish this unless I post it somewhere
A lot of insert here hahahaListening to these songs:
Stages of HTTP 2 request and response
- Connection and Protocol checks
- Connection Configurations
- Stream initiation
- Request Header
- Data Transmission
- Resource Prioritization
- Server Response and Stream Termination
- Connection Shutdown
Connection and Protocol checks
HTTP 2 supports working without TLS, but since most major browsers want it to improve the default security of the protocol, the TLS handshake step is needed in order to use it.
Insert how the http 2 checks for TLS versions before actually working on the handshake
Client -> Sends ClientHello message, where it will attach ALPN extensions containing the list of protocols it supports on client's side
Server -> Validates the list of protocols that it gets from the client and goes down the priority list to see which one it supports, allowing it to use it to communicate with the client.
In this case let's assume that the ALPN that the client sends contains h2 (HTTP/2) and it is high on the priority list.
Given this, assume that the server also supports h2, it will reply back with ServerHello message that contains the ALPN extension confirming that the h2 extension has been selected.
Which it will move to the standard encrypted key exchange between the client and the server (Note to expand on this later)
The TLS version that HTTP/2 supports is TLS 1.2+
It will also need to send the 24 bytes prefix once this is finished, as this confirms with the server that we want to communicate in HTTP/2.
PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n
Connection Configurations
After the step of the TLS handshake and version determining is finished, it is actually the step to go into the actual HTTP/2 protocol handling.
The first thing that we will need to send from the Client's side will be the settings frame.
The settings frame will be the frame that tells the server what it expects from this communication.
Insert a frame of the HEADER FRAME
Insert a frame of the DATA FRAME
Stream initiation
Client initiating the request -> Odd number for stream identification number
Server initiating the request -> Even number for stream identification number
Each frame of request contains the stream identifier