# HTTP/1.1 RFCs - Key Excerpts for httpclient

**Authority Tier:** Tier 0 (Standards)
**Source:** RFC 7230-7235
**Relevance:** HTTP client best practices, redirect handling, timeouts

---

## RFC 7231 Section 6.4 - Redirection

### 6.4.1 Overview

> A client SHOULD detect and intervene in cyclical redirections (i.e., "infinite" redirection loops).

### Redirect Limit Recommendation

> **NOTE:** An earlier draft of RFC 2068 recommended a maximum of five redirections. Content developers should be aware that there might be clients that implement such a fixed limitation.

> **Current Practice:** Most browsers limit redirects to between 10-20. A client should use **10 as a safe maximum** to ensure broad compatibility.

**Key Claim:**
- `httpclient/max_redirects :: max_value = 10`
- **Consequence:** Infinite redirect loops exhaust client resources

---

## RFC 7230 Section 6.3 - Persistent Connections

### 6.3.1 Connection Timeout

> Clients and servers that wish to minimize the number of connections can use persistent connections, but **servers will usually close idle connections** after some time.

> **Recommended:** Clients should implement an idle connection timeout to prevent accumulation of stale connections.

**Key Claim:**
- `httpclient/idle_timeout :: required = true`
- **Consequence:** Stale connections accumulate, waste resources

### 6.3.2 Keep-Alive Timeout

> A client SHOULD monitor connections for a server's close of the transport connection, in which case the client must re-establish the connection.

**Key Claim:**
- `httpclient/keep_alive_timeout :: default_value = 60`
- **Consequence:** Connections may close unexpectedly without timeout handling

---

## RFC 7230 Section 2.3 - Intermediaries

### Request Timeout Behavior

> If the client is unwilling to wait for the entire response, it can close the connection, but it SHOULD first consume any remaining response before doing so.

**Implication:** Clients should implement request timeouts to prevent hanging on slow responses.

**Key Claim:**
- `httpclient/request_timeout :: max_value = 30`
- **Consequence:** Slow external services block thread pool

---

## HTTP/1.1 Connection Management Summary

| Setting | RFC Guidance | httpclient Value |
|---------|--------------|------------------|
| **Max Redirects** | 5-10 (RFC 2068), most browsers use 10+ | 10 (conservative) |
| **Idle Timeout** | Required for persistent connections | 60 seconds |
| **Request Timeout** | Implied (client should close if unwilling to wait) | 30 seconds |
| **Connect Timeout** | Not specified (implementation-defined) | 10 seconds (per Mozilla) |

---

## Authority Classification

- **Tier 0 (Standards):** Max redirects (RFC 7231), idle timeout (RFC 7230)
- **Tier 2 (Industry Practice):** Specific timeout values (derived from browser/library implementations)
