HTTP
Published: 2022-09-19 12:04:43

1.What is HTTP?
- HyperTextTransferProtocol.
- It is the Communication between the Client & WebServer.
- It takes Requests and Returns Response from server.
- It returns Headers and Body with Every Request.
- It is Stateless means every request is independent(at its 
  core means without cookies.It doesn`t remember anything).

2.What is HTTPS?
- HyperTextTransferProtocolSecure.
- It Encrypts the data in between the transactions(request and   response).
- Data is Encrypted using SSL/TLS.

   - SSL stands for Secured Socket Layer.
   - TLS  stands for Transport Security Layer.
- Security will be provided by installing an SSL/TLS 
  certificate on webhost.

3.What are HTTP METHODS?
- When a request is made to server there is a method attached to it.For different purposes different methods will be used.

- GET request:
      
 It mainly used to Fetch data from server like loading a HTML page,loading Json data ,xml data etc...

 - POST request:
      
 It used to when adding data to server or posting/sending data to server.

      
 Unlike Get request it doesn`t show the request in URL.
 
 - PUT request:

      
 It used to update the data on the server

 - DELETE request:

      
 It used to delete the data on the server


4.What Are HTTP Header Fields?

- HTTP header fields are a list of strings sent and received by both the client program and server on every HTTP request and response. These headers are usually invisible to the end-user and are only processed or logged by the server and client applications.

- There are 3 types of header fields: 
       -General header fields
       -Response header fields
       -Request header fields

- General header fields(important Fields in General headers):
      Request URL: URL which is used to make a request
      Request Method:Which HTTP Method is used to make request
      Status Codes: It shows the status of the webpage(It will be explained clearly in the next section)
      Remote Address: IP Address of the computer 
      Referral Policy:It controls how much referrer info should be included with request 

- Response Headers(important Fields in Response headers):
      Server:The info about who host the server
      Set-cookie:The Set-Cookie HTTP response header is used to send a cookie from the server to the user agent, so that the user agent can send it back to the server later. To send multiple cookies, multiple Set-Cookie headers should be sent in the same response. 
      Content-Type:Which type of data is sending from server
      Content-Length:The length of the content
- Request Headers(important Fields in Request headers):
      Cookies:Cookies which sent by request url to Server which are previously stored when server sent them to browser by set-cookies header.
      Accept-xxx:The Support of the browser like accepting encoding of language, Program etc...
      content-type & content-length:Same as response header fields
      Authorization: Sending tokens to Authorize the user.
      User-Agent:The Details of the web-browser of the user.
      Referrer:The Referer header allows a server to identify a page where people are visiting it from.



5.What Are Status Codes?
 An HTTP status code is a message a website's server sends to the browser to indicate whether or not that request can be fulfilled.
 It has some ranges to indicate the website is working or not.
    100-200: INFORMATIONAL
      It indicates Request is recieved and It is processing
    200-300: SUCCESS
      It indicates Request is Successfully recieved,understood and accepted
    300-400: REDIRECT
      It indicates further action must be taken like redirecting
    400-500: CLIENT ERROR
      Request error either requested url is not correct or the request is not in the server
    500-600:SERVER ERROR
      Server Failed to fetch the valid request
 Some Commonly Used Status Codes:
    200 - Ok
    201 - Ok Created
    301 - Moved to New Url
    304 - Not Modified
    400 - Bad Request
    401 - Unauthorized
    404 - Not Found
    500 - Internal Server Error.

6.Difference Between HTTP 1.1 & HTTP 2 ?
   HTTP2 is fast,efficient and more secure than HTTP 1.1
   In HTTP 1.1  HTML , CSS and Script are requested individually and get response individually whereas in Http2 CSS and Script are requested simultaneously and response also fetched simultaneously.
   HTTP2 uses a more advanced compression method called HPACK that eliminates redundant information in HTTP header packets. 

                            --THANK YOU--