HTTP - dejanu/linux GitHub Wiki
**Hypertext Transfer Protocol **
Connectionless and Stateless protocol build on top of TCP
Connectionless = the client makes a request and then disconnects from the server and when the response is ready the server re-establish the connection
Stateless = each request/response transaction is treated independently , cookies and sessions are used to track the state, clientul si server-ul stiu unul despre altul pe durata unui request?
HTTP message consist of one ore more headers, each on separate line, followed by a blank line.
HTTP methods:
- GET
- retrieve resource from server;
- does not have a body;
- sends the parameters for the requested resource in the url
eg URL: http://domain.com/search?name=ford&model=car
eg REST url: http://domain.com/search/ford/car
- POST
- create or update resource on server (mostly CREATE);
- the data is send in the body of the HTTP request;
- the parameters can be send in the url query and in the body of the HTTP request;
- "Resend or Leave Page" - browsers do not reissue POST request
- NON-IDEMPOTENT (creates the same resource multiple times, eg contact form)
- idempotent = HTTP method that can be called many times , and has the same outcome each time f(f(x)) = f(x)
- PUT
- create or update resource on server (mostly UPDATE);
- IDEMPOTENT (always returns the same result)
- PATH
- applies partial modification to the resource on the server (takes the fields you gave it and assumes that they are the one to change)
- NON-IDEMPOTENT