HTTP messages are requests and responses.

Request example

GET /account HTTP/1.1
Host: example.test
Accept: text/html

A request includes a method, path, version, headers and sometimes a body. Common methods include GET, POST, PUT, PATCH and DELETE.

Response example

HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8

<h1>Account</h1>

Common status groups are:

  • 2xx success.
  • 3xx redirection.
  • 4xx client-side error or denied request.
  • 5xx server error.

Headers can control caching, content interpretation and browser security behavior. Treat every request value as untrusted, even when it comes from a hidden form field or client-side script.

06 · Web Security

Continue learning

Back to Smartphone Academy