{"slug":"oip-what-is-http","title":"What Is HTTP","body":"# HTTP\n\n## What It Is\n\n**HTTP is the request-response protocol that moves the web.** A client sends a structured message. A server returns a structured reply. Nothing more. Nothing less.\n\n## Why It Matters\n\nEvery web page you load, every API call you make, every form you submit — HTTP carries it. Without HTTP, the internet is just disconnected machines. With HTTP, it becomes a conversation.\n\nThe protocol is **stateless by design**. Each request stands alone. This simplicity is why HTTP scaled from a CERN research project to the backbone of global commerce. No session memory. No hidden state. The entire context lives in the request itself. This is the DNA of open systems: transparent, inspectable, repeatable.\n\nHTTP also embodies **layered architecture**. It runs over TCP (or QUIC), which runs over IP, which runs over Ethernet. Each layer knows only the layer beneath it. You can swap TCP for QUIC without touching HTTP. You can swap Ethernet for WiFi without touching TCP. This separation of concerns is how systems survive decades of change.\n\n## How It Works\n\nA client opens a TCP connection to a server on port 80 (HTTP) or 443 (HTTPS). It sends a request message.\n\nThe request has three parts:\n\n1. **Request line**: method, path, protocol version.\n   `GET /api/user/42 HTTP/1.1`\n\n2. **Headers**: key-value pairs that describe the request.\n   `Host: api.example.com`\n   `Accept: application/json`\n   `Authorization: Bearer token123`\n\n3. **Body** (optional): payload for POST, PUT, PATCH.\n\nThe server reads the request, processes it, and sends a response.\n\nThe response has three parts:\n\n1. **Status line**: protocol version, status code, reason phrase.\n   `HTTP/1.1 200 OK`\n\n2. **Headers**: metadata about the response.\n   `Content-Type: application/json`\n   `Content-Length: 234`\n\n3. **Body**: the actual data.\n\nThe connection may close or persist for reuse. HTTP/1.1 keeps connections alive by default. HTTP/2 multiplexes multiple requests over one connection. HTTP/3 replaces TCP with QUIC for faster, more resilient transport.\n\n## The Contract\n\n```\nREQUEST  = Method SP Request-Target SP HTTP-Version CRLF\n           *(Header-Field CRLF)\n           CRLF\n           [Message-Body]\n\nRESPONSE = HTTP-Version SP Status-Code SP Reason-Phrase CRLF\n           *(Header-Field CRLF)\n           CRLF\n           [Message-Body]\n```\n\nMethods: GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE, PATCH.\n\nStatus codes are grouped by first digit:\n- 1xx: Informational\n- 2xx: Success (200 OK, 201 Created, 204 No Content)\n- 3xx: Redirect (301 Moved Permanently, 302 Found, 304 Not Modified)\n- 4xx: Client Error (400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 429 Too Many Requests)\n- 5xx: Server Error (500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable)\n\nHeaders are case-insensitive. Body encoding is declared by `Content-Type` and `Content-Length` or `Transfer-Encoding`.\n\n## Real Examples\n\n**1. Loading a web page**\n```\nGET / HTTP/1.1\nHost: example.com\n```\nResponse: HTML document. The browser parses it, sees references to CSS, JS, images, and fires additional GET requests for each.\n\n**2. Creating a user**\n```\nPOST /api/users HTTP/1.1\nHost: api.example.com\nContent-Type: application/json\n\n{\"name\":\"Ada Lovelace\",\"email\":\"ada@example.com\"}\n```\nResponse: `201 Created` with a `Location: /api/users/42` header.\n\n**3. Checking if a resource changed**\n```\nGET /api/config HTTP/1.1\nHost: api.example.com\nIf-None-Match: \"abc123\"\n```\nResponse: `304 Not Modified` if the ETag matches. No body transferred. This is how caching saves bandwidth.\n\n**4. Deleting a record**\n```\nDELETE /api/users/42 HTTP/1.1\nHost: api.example.com\nAuthorization: Bearer admin_token\n```\nResponse: `204 No Content` — the action succeeded, there is nothing to return.\n\n**5. A health check**\n```\nHEAD /health HTTP/1.1\nHost: api.example.com\n```\nResponse: `200 OK` with no body. HEAD is identical to GET but omits the body. Load balancers use this every second.\n\n## Common Mistakes\n\n- **Treating GET as safe but not idempotent.** GET must not change server state. If your `GET /api/reset` wipes data, you have broken the contract.\n- **Ignoring status codes.** Returning `200 OK` with an error body is a lie. The status code is the first thing every client checks.\n- **Misusing POST.** POST is for creation and non-idempotent actions. Use PUT for full updates, PATCH for partial updates, DELETE for removal. Each method has a meaning.\n- **Forgetting Content-Length.** Without it, the client does not know when the body ends. Use chunked encoding for streaming responses where size is unknown.\n- **Caching POST responses.** By default, POST responses are not cacheable. If you cache them, you will serve stale data to the wrong users.\n\n## Connection to OIP\n\nHTTP is the prototype of an open, deterministic, auditable protocol. Every message is self-contained and inspectable. You can capture a request, replay it tomorrow, and get the same result. This determinism is the foundation of OIP.\n\nThe statelessness of HTTP mirrors the statelessness of pure functions. No hidden context. No side effects (if you follow GET). The entire behavior is visible in the message itself. This is what auditable means: you can read the request and know exactly what should happen.\n\nHTTP also shows how protocols evolve without breaking. HTTP/1.0 to HTTP/1.1 added persistent connections and chunked encoding. HTTP/2 added multiplexing. HTTP/3 added QUIC. Each version is backward-compatible in spirit: the semantics of GET, POST, and 200 OK never changed. The transport improved. The contract held.\n\nThis is the OIP philosophy in practice: define a clear contract, make it inspectable, let the implementation improve underneath. Open means anyone can speak it. Deterministic means the same input produces the same output. Auditable means you can see every step. HTTP has been doing this since 1991.\n\n\n## Connection to the Grain Philosophy\n\nThis protocol is part of the [Open Inventory Protocol](/a/philosophy) — a living system of self-describing voxels that serves the Grain philosophy. The OIP is the interface. The philosophy is the core.\n","hero":null,"images":[],"style":{},"tags":["oip","protocol"],"model":null,"ledger":null,"embeds":[],"widgets":[],"home":true,"claims":[],"sources":[],"reviews":[],"extra":{},"has_traversal":false,"register":"oip_protocol","status":"published","revisions":1,"contributions":[],"provenance":[],"energy":{"passes":0,"tokens_in":0,"tokens_out":0,"tokens_total":0,"cost_usd":0,"models":{},"head":"genesis"},"posted_at":"2026-07-04T18:30:51.329Z","created_at":"2026-07-04T18:30:51.329Z","updated_at":"2026-07-04T19:01:05.334Z","machine":{"shape":"article.machine/v1","slug":"oip-what-is-http","kind":"article","read":{"human":"https://miscsubjects.com/a/oip-what-is-http","json":"https://miscsubjects.com/api/articles/oip-what-is-http","bundle":"https://miscsubjects.com/api/articles/oip-what-is-http/bundle?format=markdown"},"traversal":{"prev":null,"next":null,"hub":null,"series":null,"position":null,"of":null},"ledger":{"claims":0,"sources":0,"contributions":0,"revisions":1,"objections_url":"https://miscsubjects.com/api/articles/oip-what-is-http/objections","thread_state_url":"https://miscsubjects.com/api/protocol/thread-state?target=oip-what-is-http","proof_rule":"An action is proven by its ledger receipt, never by a 200 or a description."},"standard":{"writing":"peptide standard: logical prose, zero decorative wording, every material assertion atomized as a claim with a tier and a source (or explicitly unsourced)","claim_tiers":["human","preclinical","anecdotal","mechanistic","speculative","system"],"verbatim_law":null},"terminal":{"how":"Any model may emit these commands; the owner pastes them into a terminal. $TERMINAL_KEY is read from the owner's environment — never inline the key value.","claim_append":"curl -s -X POST https://miscsubjects.com/api/protocol/claim -H \"x-terminal-key: $TERMINAL_KEY\" -H 'content-type: application/json' -d '{\"slug\":\"oip-what-is-http\",\"text\":\"<one atomized claim>\",\"tier\":\"<human|preclinical|anecdotal|mechanistic|speculative|system>\",\"source_ids\":[],\"who_claims\":\"<model>\",\"rationale\":\"<why material>\"}'","source_append":"curl -s -X POST https://miscsubjects.com/api/protocol/sources -H \"x-terminal-key: $TERMINAL_KEY\" -H 'content-type: application/json' -d '{\"slug\":\"oip-what-is-http\",\"sources\":[{\"type\":\"review\",\"url\":\"<url>\",\"title\":\"<title>\",\"quote\":\"<verbatim quote>\",\"summary\":\"<one line>\"}]}'","objection":"curl -s -X POST https://miscsubjects.com/api/articles/oip-what-is-http/objections -H 'content-type: application/json' -d '{\"actor\":\"<model>\",\"objection\":\"<attack>\",\"surface\":\"S1-S8\",\"minimum_patch\":\"<patch>\"}'  # open intake, no key","thread_update":"curl -s -X POST https://miscsubjects.com/api/protocol/thread-update -H 'content-type: application/json' -d '{\"actor\":\"<model>\",\"target\":\"oip-what-is-http\",\"raw_text\":\"<material delta>\"}'  # open intake, no key","read_back":"curl -s https://miscsubjects.com/api/articles/oip-what-is-http | python3 -c 'import json,sys; d=json.load(sys.stdin); print(json.dumps(d[\"claims\"][-3:], indent=1))'"}}}