HTTP & HTTPS Protocols

Sanket SinghSanket Singh
9 min read

While browsing the internet and visiting different websites like a shopping website or your bank’s website have you ever notice that some websites starts with “http://” while other websites start with “https://” . The single “s” may seem you like nothing but, that small “s” represents the significant jump in security, privacy and trust. So, in this article we will deep dive into the concept of HTTP & HTTPS Protocols. So, let’s start the journey !


What is HTTP ?

  • HTTP ( Hypertext Transfer Protocol ) is a communication way through which the client ( your browser ) and the server communicate with each other. It is basically a set of rules the governs how the data is transfer happens between the server and the client.

  • HTTP is operated in the Application Layer of the OSI ( Open Source Interconnect ) model which is commonly used to transmitting the hypermedia such as HTML or documents with hyperlinks.

  • HTTP send data in plain or you can say human readable language, which makes it unsecure for sensitive or critical data transfer( email, passwords etc. ) as attackers can read read the data during the transmission.

  • HTTP is stateless protocol, with no memory of previous interaction with webserver. This means the connection between the client and the server ends after every HTTP transmission or you can say HTTP does not remember anything about us whenever we again visit the website.

Advantages of HTTP

  • HTTP is simple and easy to implement, making it accessible for developers.

  • HTTP is fast because there is no encryption overhead as compared to secured protocols like HTTPS.

  • HTTP supports various types of media like text files, images, videos and other content, making is more flexible than any other protocol.

  • HTTP is suitable for transmitting the data like public files where security is not a concern.

  • HTTP is easy to debug as it stores data in human readable language.

Disadvantages of HTTP

  • There is no guarantee of the data integrity, means data can be altered easily.

  • The attackers can easily alter the data during transmission as data transfer happens in plain text.

  • HTTP does not provide any user authentication.

  • HTTP is unsuitable for transmitting sensitive information like passwords or personal data due to lack of encryption.


What is HTTPS ?

  • HTTPS stands for ( Hypertext Transfer Protocol Secure ) is an secured version of HTTP protocol.

  • HTTPS is an security protocol that encrypts the data send between the client and the server. HTTPS is used to protect the sensitive information like credit card details, passwords and email address.

  • HTTPS is used where there we need to interact with sensitive information like in bank website.

  • HTTPS uses a security layer called TLS ( Transport Security Layer ) also Known as SSL ( Secured Security Layer ) on top of the HTTP to encrypt the data transfer. Modern browser can tell the difference between the HTTP and HTTPS by a special indicator.

Advantages of HTTPS

  • HTTPS keeps data safe while it is being transmitted.

  • HTTPS ensure the data integrity, any error is detected.

  • Protects the website from data attacks like phishing, man-in-the-middle etc.

  • HTTPS verifies the identity of the website before setting up the connection.

Disadvantages of HTTPS

  • Slightly slower due to encryption processes, but performance differences are minimal.

  • Implementing HTTPS on website may be costlier, because we need to buy SSL certificates.

  • If there is any connection issue in HTTPS, your browser will switch to less secure HTTP protocol which is the fallback of the HTTPS protocol.


Key differences between the HTTP and HTTPS ?

FeatureHTTPHTTPS
Data IntegrityIn this No guarantee of data integrity; data can be altered.In this Ensures data integrity; any tampering is detected.
EncryptionIn HTTP Data is transmitted in plain text.In HTTPS Data is encrypted using TLS/SSL.
AuthenticationThere is No server authenticationProvides server authentication
Risk of InterceptionHigh risk of data interceptionLow risk due to encryption preventing data from being easily intercepted.
Security IndicatorsNo visible indicators, users may show warnings for non-secure sites.Visible padlock icon and “https” in the URL to indicate security.
PerformanceGenerally faster due to the lack of encryption overhead.Slightly slower due to encryption processes, but performance differences are minimal.
Use CasesSuitable for non-sensitive and public information.Essential for sensitive transactions such as online banking, shopping, and login pages.
CostFree to implement, no certificates required.Requires an SSL/TLS certificate, which may have a cost (though many are now free via providers like Let’s Encrypt)

Common HTTPS Status Codes: What do they Mean ?

When the client request the something from server, the server send status codes in response to the clients’ request and tell whether the request is successful or not. These are divided into five segments which are following as:

API calls and HTTP Status codes. Why you shouldn't use status 200 for… | by  Jose I Santa Cruz G | ITNEXT

1xx - Information

  • It means the request has been received and is continuing the process. It is just like when you go to a shop and tell the shopkeeper i wanted that thing and shopkeeper says “ Hold on, I’ll give you “ .

  • Example :-

    • 100 Continue :- It means the server has received the request headers and client should continue to send the request body.

    • 101 Switching Protocols :- The requester has asked the server to change the protocol and server has agreed to do so.

2xx - Success

  • The 2xx - Success code means that the request send by the client was executed successful and the client received the expected information. That means, you got same thing what you are asking from the shopkeeper.

  • Example :-

    • 200 Ok :- This means the request was successful but the request response depend upon the request method. This is most commonly used status code.

    • 200 Accepted :- This means the request was successfully fulfilled, resulting in creation of new resources.

    • 204 No Content :- The server successfully processed the request, and is not returning any content.

3xx - Redirection

  • The 3xx - Redirection status code means that you have been redirected and for completion of request the client must take some additional steps.

  • Example :-

    • 300 Multiple Choices :- 300 status code means that the request has multiple possible responses and the client/user has to choose one.

    • 301 Moved Permanently :- The 301 Moved Permanently response code means that the target resource has been assigned a new permanent URL

4xx - Client Errors

  • This 4xx - Client Errors status code is intended for situations in which the error seems to have been caused by the client.

  • Example :-

    • 400 Bad Request :- 400 bad request status code means that server cannot understand the request by the client due to invalid syntax.

    • 401 Unauthorized :- 401 Unauthorized status code means that the request has not been applied because the server requires user authentication.

    • 404 Not Found :- 404 Not found status code means that the requested resource could not be found but may be available in the future.

    • 408 Request Timeout :- The 408 Request Timeout status code means that the server did not receive a complete request in the time that it prepared to wait.

5xx - Server Errors

  • A 5xx Server error status code means that while the request appears to be valid, the server could not complete the request.

  • Example :-

    • 501 Not Implemented :- The 501 Not Implemented response code means that the request can not be handled because it is not supported by the server.

    • 502 bad gateway :- The 502 Bad Gateway response code means that the server received an invalid response while working as a gateway to handle the response.

    • 505 HTTP Version Not Supported :- The server does not support the HTTP version used in the request.


HTTP methods and Their Use Cases

HTTP methods, also known as HTTP request methods or the HTTP verbs, are the methods that are used to request or modify a resource on the server by the client. Some common HTTP methods are following as :

  • GET

    • The GET method request the representation of specified resource. Basically, it is used to get data from specific resource .

    • Use case :- The GET request is used when we searching information or fetching web pages or loading images, videos or data in browser.

  • POST

    • The POST method request is used to submit the data to server for processing or for storage. The data is sent the request body. POST is useful in sending large amount of data or sensitive information.

    • Use Case :- Used when we are doing login or registration on the website.

  • PUT

    • The PUT method request is used to Update or replace a resource on the specified URL or you can say server. PUT also creates the new resource if the requested resource doesn’t exist.

    • Use Case :- Used when we are performing tasks like profile update or overwriting a file.

  • DELETE

    • The DELETE method request is used when we have to remove the particular resource at the specified URL.

    • Use Case :- Used when we performing actions like deleting account or canceling subscription.

  • HEAD

    • The HEAD method request is similar to the GET request but, it only retrieves the response headers not the body of the response.

    • Use Case :- Used to Check whether the requested resource is exist or not.

  • PATCH

    • The PATCH method request is used to update the resource partially according to the request. Only the field specified in the request body is get updated.

    • Use case :- Used when while we are only updating a particular section from the profile.

  • CONNECT

    • The CONNECT method request is used to establish a tunnel for communication to the server through an HTTP Proxy.

    • Use case :- CONNECT is used to secure communication between a client and a server.

These are some commonly used HTTP methods to send request to the server for particular operation.


Conclusion

So, in this article we learn all the basics and important information about HTTP & HTTPS. What are these ? why they are used ? The understanding of this concept will help you know more deep about how the internet works. So, that’s it ! Thanks for reading my article. Feel free for any suggestions in the comment section. If you wanted more articles from my side please subscribe the newsletter from below.

0
Subscribe to my newsletter

Read articles from Sanket Singh directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sanket Singh
Sanket Singh