35#ifndef A11_NET_SERVER_HEADERS_H_
36#define A11_NET_SERVER_HEADERS_H_
41#include <absl/status/status.h>
71 std::string
allow_headers =
"content-type, accept, authorization, x-a11-*";
87 [[nodiscard]] absl::Status
Validate()
const;
121 [[nodiscard]] absl::Status
Validate()
const;
159 std::string_view method);
A11's nghttp2 HTTP/2 client, server, and streaming primitives.
std::vector< std::pair< std::string, std::string > > HttpHeaders
An ordered list of (name, value) HTTP/2 header fields.
Definition http2.h:70
HttpHeaders CorsHeaders(const CorsOptions &options)
The cross-origin headers for options, and nothing else.
Definition server_headers.cc:129
constexpr std::string_view kServerHeaderValue
Value of the Server header A11's HTTP surfaces send.
Definition server_headers.h:48
void ApplyCorsHeaders(const CorsOptions &options, HttpHeaders *absl_nonnull headers)
Adds the cross-origin headers for options to headers.
Definition server_headers.cc:99
@ kStream
One long-lived request body carrying every outbound message.
bool IsPreflight(const CorsOptions &options, std::string_view method)
Whether method is a CORS preflight this policy should answer.
Definition server_headers.cc:163
CachePolicy
How a response may be cached, which differs by what it is.
Definition server_headers.h:98
@ kVolatile
A document that may change at any time. no-cache: use it, but ask first.
@ kUnset
Say nothing, and leave caching to whatever default applies.
void ApplyServerHeaders(const ServerHeaderOptions &options, CachePolicy cache, HttpHeaders *absl_nonnull headers)
Adds the headers every response from an A11 server carries.
Definition server_headers.cc:135
Cross-origin policy for an A11 HTTP surface.
Definition server_headers.h:62
int max_age_seconds
Access-Control-Max-Age in seconds; 0 omits it.
Definition server_headers.h:84
std::string allow_origin
Access-Control-Allow-Origin. * admits any page.
Definition server_headers.h:66
absl::Status Validate() const
Definition server_headers.cc:71
std::string allow_headers
Access-Control-Allow-Headers.
Definition server_headers.h:71
bool enabled
Whether cross-origin headers are sent at all.
Definition server_headers.h:64
std::string expose_headers
Access-Control-Expose-Headers: what a page may read off the response.
Definition server_headers.h:81
std::string allow_methods
Access-Control-Allow-Methods. Every method A11's routes use.
Definition server_headers.h:68