A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
relay.h
Go to the documentation of this file.
1/*
2 * Copyright 2026 The A11 Authors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
18#ifndef A11_NET_HTTP_RELAY_H_
19#define A11_NET_HTTP_RELAY_H_
20
21#include <functional>
22#include <memory>
23#include <string>
24#include <string_view>
25
26#include <absl/time/time.h>
27
29#include "a11/net/http2.h"
30
31namespace a11::net {
37using HttpRelayObserver = std::function<absl::Status(
38 std::string_view event, const HttpResponseHead& head,
39 std::string_view data)>;
40
60a11::Task RelayHttp(std::string target, HttpRequest request,
61 std::shared_ptr<Http2ResponseWriter> writer,
63 absl::Time deadline = absl::InfiniteFuture(),
64 HttpRelayObserver observer = {},
65 size_t max_observed_bytes = 8 * 1024 * 1024);
66} // namespace a11::net
67#endif // A11_NET_HTTP_RELAY_H_
Completion values used by every asynchronous A11 operation.
A11's nghttp2 HTTP/2 client, server, and streaming primitives.
Definition action.h:66
std::function< absl::Status(std::string_view event, const HttpResponseHead &head, std::string_view data)> HttpRelayObserver
Observe response headers/body/completion without altering the exchange.
Definition relay.h:39
a11::Task RelayHttp(std::string target, HttpRequest request, std::shared_ptr< Http2ResponseWriter > writer, Http2Options options, absl::Time deadline, HttpRelayObserver observer, size_t max_observed_bytes)
Forward an exchange to an explicit URL without redirects or retries.
Definition relay.cc:130
stores::ChunkStoreReaderOptions options
Definition runtime_streams.cc:31
Body-size limits, buffering thresholds, deadline, TLS, and HTTP protocol negotiation for an HTTP clie...
Definition http2.h:150
A parsed HTTP/2 request: pseudo-headers, fields, and body.
Definition http2.h:90
Status line and headers of an HTTP/2 response, without the body.
Definition http2.h:103
std::string target
Which editor definition syntax is about; every one when empty, which is the default.
Definition main.cc:75