What is HTTP (Hypertext Transfer Protocol)?
The application-layer protocol for exchanging HTML, images and data between web browsers and web servers, among others. A client sends a request made up of a method, a URL, headers and a body, and the server returns a response made up of a status code, headers and a body. As a protocol it is stateless, so state such as a login is kept with cookies and similar means. HTTP/1.1 uses a text format and persistent connections, HTTP/2 multiplexes several streams over one TCP connection, and HTTP/3 runs over QUIC on UDP. HTTP protected by TLS is called HTTPS.
Japanese name: HTTP
HTTP (Hypertext Transfer Protocol) appears in 16 practice questions across 3 topics, including Web Technology Basics, Computer Networking Basics, Cloud and Container Basics.
Field: Web Technology Basics
Shape of requests and responses
A request consists of a request line such as "GET /index.html HTTP/1.1", headers such as Host and Accept, a blank line and a body, in that order. A response consists of a status line such as "HTTP/1.1 200 OK", headers such as Content-Type and Cache-Control, and a body. Headers take the form "Name: value" and convey the type of the body, how it may be cached, authentication information, the compression method and so on.
FAQ
What is the difference between HTTP and HTTPS?
HTTPS encrypts HTTP exchanges with TLS and adds tamper detection and server authentication. Requests and responses have the same form as in HTTP, and the default port numbers are 80 for HTTP and 443 for HTTPS. Websites generally use HTTPS to protect passwords and cookies.
How are GET and POST used differently?
GET is the method for retrieving a resource. It is treated as "safe", meaning it does not change the server's state, so browsers and caches may send it repeatedly or store the result. POST is used when the server is asked to process something or register data, as with an order or a post. The query of a GET request goes into the URL and remains in access logs and browsing history, so secret information such as passwords should not be put there.