04 Protocol 1: HTTP - LIttleAncientForestKami/shiny-octo-doodle GitHub Wiki
ℹ️
|
History note
|
💡
|
allows to fork reading paths by linking documents. |
🔥
|
allows the improvement of its request and response (via gateway, proxy, or a tunnel) |
ℹ️
|
https://en.wikipedia.org/wiki/Hypertext - take a look at history |
HyperText is a way to link and access information of various kinds as a web of nodes in which the user can browse at will. Potentially, HyperText provides a single user-interface to many large classes of stored information such as reports, notes, data-bases, computer documentation and on-line systems help. We propose the implementation of a simple scheme to incorporate several different servers of machine-stored information already available at CERN, including an analysis of the requirements for information access needs by experiments… A program which provides access to the hypertext world we call a browser.
-
Stateless
-
Request - Response
-
client requests
-
server responds
-
-
application layer protocol
-
defaults:
-
port: 80
-
underlying protocol: TCP/IP
-
-
hostname in the request is case insensitive
- Stateless protocol
-
after connection is broken, no information about it remains.
- HTTP session
-
series of request and response in http is called as a session in HTTP
❗
|
About URLs
Whatever can be requested by using HTTP protocol is identified and reached via a type of URI(Uniform Resource Identifier) called URL(Uniform Resource Locator).
![]()
![]() |
- GET
-
params passed in URI / address bar, can be conditional with
If-Modified-Since
header - HEAD
-
heads up resource! Info about you required. Similar to GET, but without the message body. It’s used to retrieve the server headers for a particular resource, generally to check if the resource has changed, via timestamps.
- POST
-
all forms submit posts. Submitting data from client to server in a request body.
- PUT
-
takes data from client to server, usually to create / update entities.
- DELETE
-
requests resource removal, for privileged users
- OPTIONS
-
options and requirements information in given comm channel. Used to retrieve the server capabilities. On the client-side, it can be used to modify the request based on what the server can support.
- TRACE
-
diagnostic for comm channel. Used to retrieve the hops that a request takes to round trip from the server. Each intermediate proxy or gateway would inject its IP or DNS name into the
Via
header field. - CONNECT
-
connect me up, proxy!
🔥
|
CONNECT is implemented based on expired protocol draft from 1999… :-/ |
- PATCH
-
update part of data with patch client sends
ℹ️
|
Four important HTTP methods are GET , POST , PUT and DELETE . For some time only first two were commonly handled.
|
Wikipedia is good enough source for this: has headers, their fields, examples and limitations.
ℹ️
|
Information codes, 1xx |
Code | In words | Meaning or resource returned |
---|---|---|
100 |
Continue |
Please continue sending the query |
101 |
Switching Protocols |
Change of protocols |
110 |
Connection Timed Out |
Server did not answer for too long |
111 |
Connection refused |
Server refused connecting |
💡
|
Success codes, 2xx |
Code | In words | Meaning or resource returned |
---|---|---|
200 |
OK |
Most often answer, returns requested resource |
201 |
Created |
Sent document was saved on server |
202 |
Accepted |
Query is being served |
203 |
Non-Authoritative Information |
Information created from local or external copies, not exact answer from the server |
204 |
No Content |
Nothing to return, server did what was asked of it |
205 |
Reset Content |
Server did it’s job, client should refresh now |
206 |
Partial Content |
Server did part of the query, returned |
🔥
|
Redirect codes, 3xx |
Code | In words | Meaning or resource returned |
---|---|---|
300 |
Multiple choices |
Server may reply with location that can tell what to choose, more than one way to serve query |
301 |
Moved permanently |
Resource changed URI, adjust yours |
302 |
Found |
Usual redirect, requested resource is now available (temporarily) at different URI |
303 |
See Other |
Usual redirect for POST requests, but also can be used instead of 200. Why?? |
304 |
Not Modified |
?? |
305 |
Use Proxy |
Resource is available only via Proxy given in |
306 |
Switch Proxy |
Unused but reserved for older protocol versions |
307 |
Temporary Redirect |
?? and how it differs from Found?? |
310 |
Too Many Redirects |
as it says |
|
Client error codes, 4xx |
Code | In words | Meaning or resource returned |
---|---|---|
400 |
Bad Request |
Wrong request syntax, server won’t handle it |
401 |
Unauthorized |
Server demands authorization, none / wrong was given |
402 |
Payment Required |
Unused, reserved for future |
403 |
Forbidden |
Request understood yet configuration forbids handling it |
404 |
Not Found |
!302 - server found nothing under URL and nothing that indicates something was / should have been there |
405 |
Method Not Allowed |
We don’t want POSTs/GETs/others in this town (if kind, you’ll get allowed methods in response) |
406 |
Not Acceptable |
?? |
407 |
Proxy Authentication Required |
401 for proxy |
408 |
Request Timeout |
Client did NOT send request to server in appropriate (for server? for whom?) time |
409 |
Conflict |
Request can’t be met as there’s conflict with current resource state. Returned when server suspects client may re-send corrected request. Response optionally (recommended) contains info helping the client with request correction |
410 |
Gone |
Removed or deleted resources should reply like that. New URI for this resource is not given, client should not ask for this |
411 |
Length required |
Header |
412 |
Precondition Failed |
Some conditions (at least one) set in request cannot be met |
413 |
Request Entity Too Large |
Total request length too long due to it. Most likely POST form problem |
414 |
Request-URI Too Long |
GET with too many params? URI too long to process |
415 |
Unsupported Media Type |
Server won’t handle requests it cannot understand |
416 |
Requested Range Not Satisfiable |
Byte range in request cannot be applied to given resource |
417 |
Expectation Failed |
Header |
418 |
I’m a teapot |
as it says |

❗
|
Server error codes, 5xx |
Code |
In words |
Meaning or resource returned |
500 |
Internal Server Error |
Usual response when something unexpected happened on the server side and it failed handling our request |
501 |
Not Implemented |
Returned when unknown request type is received |
502 |
Bad Gateway |
Gateway got incorrect answer from server and can’t handle client’s request |
503 |
Service Unavailable |
Overloaded reserver can’t handle request |
504 |
Gateway Timeout |
Gateway did not get reply in given time (DNS waits include) |
505 |
HTTP Version Not Supported |
as it says |
506 |
Variant Also Negotiates (RFC 2295) |
irrelevant for our needs |
507 |
Insufficient Storage (WebDAV; RFC 4918) |
irrelevant for us |
508 |
Loop Detected (WebDAV; RFC 5842) |
irrelevant for us |
510 |
Not Extended (RFC 2774) |
as it says |
511 |
Network Authentication Required (RFC 6585) |
Intended for proxy gateways or accepting regs prior to surfing |
Not every code is done by every server!

This is also incomplete list: http://httpstatus.es/ https://www.addedbytes.com/articles/for-beginners/http-status-codes/

Try viewing them. Choose for example http://datascienceretreat.com/ and try viewing the HTTP between your browser and the page’s server.
Can you name any?
Why would you say these are inadequacies?
Do you know any mechanism for overcoming them?
Write down points you learned.
Questions?