HyperText Transfer Protocol (HTTP) Flashcards
HTTP is stateless, what does that mean?
The server does not know the previous HTTP request
In HTTP everything is sent and received in…
Clear text
HTTPS
HTTP over a secured TLS connection (HTTPS)
HTTP request content
HTTP Method -> GET, PUT, PATCH, POST, DELETE
Target -> URL
Protocol Version -> HTTP/1.1, HTTP/2
Headers -> meta information
Body -> data
HTTP Request Header Fields
Accept -> what kind of response resource type to accept
User-Agent -> the product sending the request
Cookie -> Sends a cookie to the server
Authorization -> Authorization method and credentials…
HTTP Response content
Protocol Version -> HTTP/1.1, HTTP/2
Status Code -> e.g., 200, 404
Status Text -> e.g., OK, Not Found
Headers -> meta information
Body -> e.g., the requested resource or an error page
HTTP Response Header Fields
Age: estimate of seconds since the response was generated
Expires: at what date/time is the response considered “stale” (=outdated)
Allow: list of http methods allowed for this resource
Content-Type: media type of the resource
Set-Cookie: saves a cookie on client side
What does URL stand for?
Uniform Resource Locator
HTTP Methods (Verbs)
9 different kinds of requests
Common:
GET -> request a representation of the specified resource
POST-> submit an entity to the specified resource
PUT-> replaces the target resource with the request payload
PATCH-> apply partial modifications to a resource
DELETE-> Delete the specified resource
HTTP Method Properties
Safe -> Does not cause any side effect on the server(GET)
Idempotent-> the effect on the server is the same, no matter how many times it is executed (DELETE, PUT)
Cacheable-> the response to the request can be stored for future re-use (GET, POST)
HTTP response codes
1xx -> Informational 2xx -> Success 3xx -> Redirection 4xx -> Client error 5xx -> Server error
Cookies
NOT EVIL >:)
Text saved on the client side (in browser)
The server sets the cookie, the client returns it
Can be modified
Can be deleted