Skip to content

HTTP client code #131

Description

@resetius

HTTP client built on existing TRequest / TResponse

Goal

Add an HTTP client implementation to coroio_http, reusing the existing TRequest / TResponse types and HTTP parsing/formatting logic.
Avoid introducing a parallel client-only API.

Design outline

  • HTTP client lives in the same http library as the server.
  • Client and server share:
    • request/response types
    • header parsing/serialization
    • body reading/writing logic
  • Client uses the same async/poller infrastructure as the server.
  • API should feel symmetrical to server-side handling.

Checklist

Core HTTP client

  • Implement HTTP client connection logic (connect + write request + read response)
  • Reuse TRequest for request construction
  • Reuse TResponse for response parsing and body reading
  • Support basic request/response flow (no redirects/proxy in MVP)

Transport / protocol

  • Support HTTP/1.1
  • Handle Content-Length
  • Handle Transfer-Encoding: chunked
  • Respect Connection: close vs keep-alive

API shape

  • Provide a minimal, explicit client entry point (e.g. THttpClient)
  • Allow synchronous-looking coroutine usage (co_await client.Do(request) or similar)
  • Avoid std::function in hot paths

Validation

  • Unit tests for client-side request/response parsing
  • Integration test against local HTTP server (THttpServer)
  • Ensure no behavior duplication with server-side code

Non-goals

  • HTTP/2 or TLS
  • Automatic redirects
  • Cookie or proxy support

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions