zeroclaw-labs/zeroclaw · error

HTTP CONNECT proxy response too large

Error message

HTTP CONNECT proxy response too large

What it means

Raised in the HTTP CONNECT tunneling helper: the proxy's response headers did not terminate within the fixed 4096-byte read buffer. A proxy that streams an unbounded or malformed header block trips this guard, which prevents unbounded memory growth while scanning for the end of headers.

Solutions

  1. The proxy sent an oversized CONNECT response; verify you are talking to a real HTTP CONNECT proxy.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/zeroclaw-config/src/schema.rs:10974 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/43e0a9e3405ddc4a. Report an issue: GitHub.

Appendix: source

Thrown at crates/zeroclaw-config/src/schema.rs:10974

                    anyhow::bail!("HTTP CONNECT proxy closed connection before response");
                }
                total += n;
                // Look for end of HTTP headers.
                if let Some(pos) = find_header_end(&buf[..total]) {
                    let status_line = std::str::from_utf8(&buf[..pos])
                        .unwrap_or("")
                        .lines()
                        .next()
                        .unwrap_or("");
                    if !status_line.contains("200") {
                        anyhow::bail!(
                            "HTTP CONNECT proxy returned non-200 response: {status_line}"
                        );
                    }
                    break;
                }
                if total >= buf.len() {
                    anyhow::bail!("HTTP CONNECT proxy response too large");
                }
            }

            BoxedIo(Box::new(tcp))
        }
        scheme => {
            anyhow::bail!("Unsupported proxy scheme '{scheme}' for WebSocket connections");
        }
    };

    // If the target is wss://, wrap in TLS.
    let is_secure = target.scheme() == "wss";
    let stream: BoxedIo = if is_secure {
        let mut root_store = rustls::RootCertStore::empty();
        root_store.extend(webpki_roots::TLS_SERVER_ROOTS.iter().cloned());
        let tls_config = std::sync::Arc::new(
            rustls::ClientConfig::builder()
                .with_root_certificates(root_store)

View on GitHub (pinned to 88bb9c8533)