What are HTTP and HTTPS, and its Methods?

What are HTTP and HTTPS, and its Methods?

What is HTTP?

The Hypertext Transfer Protocol (HTTP) is an application-layer protocol (set of rules) that enables communications between clients and servers to share each other’s resources.

How does HTTP work?

HTTP works between a client and server as a request-response protocol.

What are HTTP request methods?

HTTP defines a set of request methods to indicate the desired action to be performed for a given resource.

HTTP has 9 request methods but only 5 methods we use the most, these are –

5 most common HTTP methods –

HTTP MethodsDescription
GETUsed to get data from a server.
POSTUsed to send data to a server to create a resource.
PUTUsed to replace the whole data of the target resource with the request payload.
PATCHIt is similar to PUT but is used for partial modification, not to replace whole data.
DELETEObviously, it is used to delete a resource.

👉 Rest of the three methods – HEAD, OPTIONS and TRACE.

(For Developer) Don’t use the GET method when

Don’t use the GET method when you send sensitive information such as passwords and bank details to a server.

Because sensitive data will appear in the URL like the following –

https://example.com/[email protected]&password=john123#2f

What is HTTPS?

Hypertext transfer protocol secure (HTTPS) is the secure version of HTTP, which is encrypted to enhance the security of data transfer between client and server.

HTTPS is not a separate protocol from HTTP. It is simply using TLS/SSL encryption over the HTTP protocol.

So a website that takes sensitive data (such as login or bank details, etc.) from users must use HTTPS.