CPSA ยท Web servers, architecture and protocols
HTTP methods and response codes
GET, POST, PUT, DELETE, OPTIONS, TRACE and the meaning of status code classes.
Key points
- Methods: GET retrieves, POST submits data, PUT replaces, DELETE removes, HEAD returns headers only, OPTIONS asks what is supported, TRACE echoes the request.
- Safe: GET, HEAD, OPTIONS, TRACE. Idempotent: PUT, DELETE.
- Status classes: 1xx informational, 2xx success, 3xx redirection, 4xx client error, 5xx server error.
- Finding: unneeded PUT/DELETE or TRACE enabled.
- Access mapping: 401 not authenticated, 403 refused, 404 not found.
Source: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Methods
Practice questions
Which status code class means the server failed to fulfil a valid request?
- 2xx
- 3xx
- 4xx
- 5xx
Show answer
Answer: D. 5xx
5xx means a server error. 4xx means the client request is at fault, 3xx is redirection and 2xx is success.
Which HTTP methods are idempotent according to the standard semantics?
- PUT
- DELETE
- POST
- PATCH
- CONNECT
Show answer
Answer: A. PUT, B. DELETE
PUT and DELETE are idempotent: repeating them gives the same end state. POST and PATCH are not idempotent, and CONNECT sets up a tunnel.
True or false: a 404 response always proves the resource does not exist.
Show answer
Answer: False
False. Servers may return 404 instead of 403 to hide a resource from unauthorised clients, so 404 does not always prove absence.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

More CPSA topics in this module
- Web server operation, virtual hosting and proxies
- IIS and Apache and their typical flaws
- Tiered web architectures
- HTTPS, SOAP and security-related headers
- HTML and XML
- Server-side and client-side web languages
- Application servers and frameworks
- Server extension interfaces
- Thin and thick web clients, applets and decompilation