Http Flashcards
Which HTTP-Methods exist?
GET - Retrieve
HEAD - Retrieve without Response-Body
POST - Action / write
PUT - Action / write
PUT - Action / write (most of the time single values)
DELETE - Remove
PURGE - Removing objects from cache?!
OPTIONS - Describe communication options for target object
TRACE - Testing trace to resource
CONNECT - Establish tunnel to the server
How can the maximum count of redirections can be customized for a request?
$response = $client->request('GET', 'https://...', [ // 0 means to not follow any redirect 'max_redirects' => 0, ]);
How can the used BASE_URI be randomized for an HTTP-Client?
Why would we do that?
$response = $client->request('GET', 'some-page', [ 'base_uri' => [ [ // a single random URI from this array will be used for the first request 'https://example.com/a/', 'https://example.com/b/', ], // non-nested base URIs are used in order 'https://example.com/c/', ], ]);
Could be done to distribute the load to different nodes.
HTTP 100
Continue
HTTP 101
Switch protocol
HTTP 200
OK
HTTP 201
Created
HTTP 202
Accepted
HTTP 203
Non-Authoritative Information
HTTP 204
Empty Response
HTTP 205
Reset content (Server fulfilled request, client should reload view)
HTTP 300
Multiple Choices (target resource has multiple representations, client can choose)
HTTP 301
Moved Permanently (new route is in Location-Header, so client will be redirected)
HTTP 302
Found (Target resource temporarily located under different location)
HTTP 307
Temporary redirect to another location
HTTP 400
Bad Request (bad syntax, exceeds limitations etc)
HTTP 401
Unauthorized
HTTP 403
Forbidden
HTTP 404
Resource not found
HTTP 405
Method not allowed (E.g. when POST is requested but not allowed)
HTTP 406
Not acceptable
HTTP 408
Request timeout
HTTP 413
Payload too large
HTTP 415
Unsupported media type