Flash cards
Name the six parts a URL can have.
Show the answer
Scheme, host, port, path, query string and fragment.
Which part of a URL is never sent to the server?
Show the answer
The fragment, after the hash sign. The browser uses it to move within the page.
What is the default port for https?
Show the answer
443. For plain http it is 80.
What does DNS do?
Show the answer
It turns a host name into an IP address, so the browser knows which server to connect to.
What is a DNS record's TTL?
Show the answer
Its time to live: how many seconds the answer may be cached before it must be looked up again.
What are the three parts of an HTTP message?
Show the answer
A first line (request line or status line), the headers, and an optional body, separated from the headers by a blank line.
What does it mean that a method is safe?
Show the answer
It only reads and changes nothing on the server, like GET and HEAD.
What does it mean that a method is idempotent?
Show the answer
Sending it several times has the same effect as sending it once, so it can be retried safely. PUT and DELETE are idempotent, POST is not.
What do 4xx and 5xx status codes each mean?
Show the answer
4xx: the request was wrong, such as 404 Not Found. 5xx: the server failed, such as 500 Internal Server Error.
What does 304 Not Modified mean?
Show the answer
The browser's cached copy is still current, so the server sends no body and the cached file is used.
What is the difference between 401 and 403?
Show the answer
401: not logged in, or the token is missing or wrong. 403: logged in, but not allowed to do this.
What does the Content-Type header say?
Show the answer
What the body is, such as text/html, text/css or application/json. The wrong type can stop a file working although it loaded.
Why is HTTP called stateless?
Show the answer
Each request stands alone and the server keeps no memory of earlier requests. Cookies and sessions add that memory.
What do the cookie attributes Secure and HttpOnly do?
Show the answer
Secure: sent only over HTTPS. HttpOnly: scripts in the page cannot read it, so injected scripts cannot steal it.
What is the difference between an absolute and a relative path?
Show the answer
An absolute path starts from the top of the file system. A relative path starts from the folder you are in.
What do two dots mean in a path?
Show the answer
The folder above the current one.
On Windows PowerShell, how do you run the real curl?
Show the answer
Type curl.exe, because in Windows PowerShell plain curl is a shortcut for a different command.