# HTTP Basics

## The Webb

<figure><img src="https://3744219775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUaTnynVhA2CYjsGJT14j%2Fuploads%2FJRZi9rKVCmKBABeeBcgA%2F2023-10-20_14-05.png?alt=media&#x26;token=1982d4e1-f407-4bbd-a466-523927cb228f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3744219775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUaTnynVhA2CYjsGJT14j%2Fuploads%2F7EKuDcfE2NU8GdYNxj9s%2F2023-10-20_14-05_1.png?alt=media&#x26;token=237d880e-653e-41a8-9686-984192fa0f54" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3744219775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUaTnynVhA2CYjsGJT14j%2Fuploads%2FugLksPhtGrwKDOgw7ECe%2F2023-10-20_14-06.png?alt=media&#x26;token=921b1476-6fa8-4735-b147-96132225255b" alt=""><figcaption></figcaption></figure>

## A Web Request

<figure><img src="https://3744219775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUaTnynVhA2CYjsGJT14j%2Fuploads%2FOAYIQU6pobbRrUCrQOe2%2F2023-10-20_14-09.png?alt=media&#x26;token=86c2289e-0431-4347-9211-2fe116996a87" alt=""><figcaption></figcaption></figure>

1. Browser asks DNS for the IP address of **server.com**.
2. Browser connects to TCP port 80/443 of **server.com**.
3. Browser sends a request with:
   1. Action: GET, POST, PUT, DELETE
   2. URL: http://server.com
   3. Headers: language, compression, user-agent.

## HTTP Structure

<figure><img src="https://3744219775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUaTnynVhA2CYjsGJT14j%2Fuploads%2FNEYnNbLsBehB2GdNs7Kz%2F2023-10-20_14-12.png?alt=media&#x26;token=ebf89a49-dc06-465d-adb4-f0ebf8edfb75" alt=""><figcaption></figcaption></figure>

## Multiple Web Requests

<figure><img src="https://3744219775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUaTnynVhA2CYjsGJT14j%2Fuploads%2FtLGrYnSD4GtH3gnk1PXr%2F2023-10-20_14-12_1.png?alt=media&#x26;token=c02e4eae-540e-4693-a9a0-e93455ebb837" alt=""><figcaption></figcaption></figure>

HTTP is stateless by design.

HTTP Requests are independent of each other.

* Each triggering and individual action.
* Usually **tokens** or **cookies** are included in requests/ responses to keep state.
