HTTP
What is HTTP?
HTTP is a plain agreement written as text. A request has a method, an address, and headers. A response has a status code, headers, and sometimes a body. The first simple form came out in 1991. The main lines in use now are HTTP/1.1 and HTTP/2. HTTP/3 carries the same conversation on another transport. HTTPS is the encrypted path of the same rule. The SSL page says that separately.
What is HTTP used for?
HTTP is for carrying a page, an image, JSON, and a file. A browser, a phone app, and a server read the same rule.
- Opening a page
- Sending a form
- Getting JSON from an API
- Downloading a file
What can you do with HTTP?
With HTTP you ask for an address and receive a status. 200 says it was found, 404 says the address is not there, and 500 says the server's own error. GET is for reading. POST is for sending new data. HTTP itself does not store data in a table.
Is HTTP hard to learn?
Opening one address is easy. The difficulty is choosing the method. Do not delete or pay with GET, because that request can be repeated or called ahead of time. Carrying a secret in a header and mixing up the address also sit here.
Advantages and limits
Advantage: every side knows the same rule, the text can be read, and the status says the reason shortly. Limit: old HTTP does not encrypt. Encryption is the job of HTTPS. HTTP is not the good look of a page. The look is in HTML and CSS.
Basic ideas
A request and a response are a pair. The method says what you want done. The status is the short number of the result.
- GET reads
- POST sends
- 200 was received
- 404 means the address is missing
A short example
These are the first lines of a simple request that reads the front page. The Host header says which site is meant.
GET / HTTP/1.1 Host: nibrascode.com
Common questions
- Are HTTP and HTTPS the same? The rule is the same. HTTPS encrypts that path.
- Does GET delete data? No. GET is for reading. Deleting and paying use another method.
- Is HTTP a programming language? No. It is the writing rule of a request and a response.