NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
curl_h2_pool.h File Reference

HTTP/2 client backed by libcurl + curl_multi (multiplexing). More...

#include <neograph/api.h>
#include <neograph/async/http_client.h>
#include <asio/any_io_executor.hpp>
#include <asio/awaitable.hpp>
#include <memory>
#include <string>
#include <utility>
#include <vector>
Include dependency graph for curl_h2_pool.h:

Go to the source code of this file.

Detailed Description

HTTP/2 client backed by libcurl + curl_multi (multiplexing).

Replaces the per-call connect+TLS pattern of async_post and the single-stream async_post_h2 PoC with libcurl's mature HTTP/2 implementation: connection pool, stream multiplexing, redirect handling, gzip/brotli decoding, and ALPN-driven version pick all come for free. Cloudflare and other anti-bot WAFs trust the curl fingerprint, so no signature-massaging is needed.

Threading: each CurlH2Pool owns one worker thread that drives curl_multi_perform + curl_multi_poll. Caller-side async_post submits a request to the worker via a mutex-protected queue, then suspends on an asio handler that the worker posts back to via asio::post(caller_executor, ...) once the request completes.

Provider-style ownership: SchemaProvider / OpenAIProvider hold one CurlH2Pool for their lifetime — successive completions reuse the same connection cache. The pool itself is thread-safe; multiple caller coroutines on different executors can call async_post concurrently and the worker will multiplex them onto the same underlying TCP when the host matches.

Definition in file curl_h2_pool.h.