2012-06-04 16:48:31 +02:00
|
|
|
/*
|
2014-03-30 12:09:21 +02:00
|
|
|
* nghttp2 - HTTP/2 C Library
|
2012-06-04 16:48:31 +02:00
|
|
|
*
|
|
|
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
* a copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
* included in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
|
|
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
#ifndef SHRPX_CONFIG_H
|
|
|
|
#define SHRPX_CONFIG_H
|
|
|
|
|
2012-06-04 20:11:43 +02:00
|
|
|
#include "shrpx.h"
|
|
|
|
|
2012-06-04 16:48:31 +02:00
|
|
|
#include <sys/types.h>
|
2015-05-13 15:30:35 +02:00
|
|
|
#ifdef HAVE_SYS_SOCKET_H
|
2018-06-09 09:21:30 +02:00
|
|
|
# include <sys/socket.h>
|
2015-05-13 15:30:35 +02:00
|
|
|
#endif // HAVE_SYS_SOCKET_H
|
2015-02-22 04:27:51 +01:00
|
|
|
#include <sys/un.h>
|
2015-05-13 15:30:35 +02:00
|
|
|
#ifdef HAVE_NETINET_IN_H
|
2018-06-09 09:21:30 +02:00
|
|
|
# include <netinet/in.h>
|
2015-05-13 15:30:35 +02:00
|
|
|
#endif // HAVE_NETINET_IN_H
|
|
|
|
#ifdef HAVE_ARPA_INET_H
|
2018-06-09 09:21:30 +02:00
|
|
|
# include <arpa/inet.h>
|
2015-05-13 15:30:35 +02:00
|
|
|
#endif // HAVE_ARPA_INET_H
|
2015-05-13 17:17:45 +02:00
|
|
|
#include <cinttypes>
|
2013-11-17 15:52:19 +01:00
|
|
|
#include <cstdio>
|
2013-02-06 15:27:05 +01:00
|
|
|
#include <vector>
|
2014-04-08 15:44:30 +02:00
|
|
|
#include <memory>
|
2015-07-13 14:44:06 +02:00
|
|
|
#include <set>
|
2013-02-06 15:27:05 +01:00
|
|
|
|
|
|
|
#include <openssl/ssl.h>
|
2012-06-04 16:48:31 +02:00
|
|
|
|
2014-12-27 18:59:06 +01:00
|
|
|
#include <ev.h>
|
|
|
|
|
2014-04-04 14:57:47 +02:00
|
|
|
#include <nghttp2/nghttp2.h>
|
|
|
|
|
2015-09-25 19:38:45 +02:00
|
|
|
#include "shrpx_router.h"
|
2021-08-26 07:46:34 +02:00
|
|
|
#if ENABLE_HTTP3
|
|
|
|
# include "shrpx_quic.h"
|
|
|
|
#endif // ENABLE_HTTP3
|
2015-07-14 15:40:33 +02:00
|
|
|
#include "template.h"
|
2016-02-13 14:19:05 +01:00
|
|
|
#include "http2.h"
|
2016-02-21 07:28:11 +01:00
|
|
|
#include "network.h"
|
2016-10-02 10:44:45 +02:00
|
|
|
#include "allocator.h"
|
2015-07-14 15:40:33 +02:00
|
|
|
|
|
|
|
using namespace nghttp2;
|
|
|
|
|
2012-06-04 16:48:31 +02:00
|
|
|
namespace shrpx {
|
|
|
|
|
2014-11-18 16:56:44 +01:00
|
|
|
struct LogFragment;
|
2016-02-21 06:53:06 +01:00
|
|
|
class ConnectBlocker;
|
2016-02-27 11:39:03 +01:00
|
|
|
class Http2Session;
|
2014-11-18 16:56:44 +01:00
|
|
|
|
2017-04-01 08:07:32 +02:00
|
|
|
namespace tls {
|
2013-02-06 15:27:05 +01:00
|
|
|
|
2015-02-02 14:47:12 +01:00
|
|
|
class CertLookupTree;
|
2013-02-06 15:27:05 +01:00
|
|
|
|
2017-04-01 08:07:32 +02:00
|
|
|
} // namespace tls
|
2013-02-06 15:27:05 +01:00
|
|
|
|
2016-03-24 13:05:02 +01:00
|
|
|
constexpr auto SHRPX_OPT_PRIVATE_KEY_FILE =
|
|
|
|
StringRef::from_lit("private-key-file");
|
|
|
|
constexpr auto SHRPX_OPT_PRIVATE_KEY_PASSWD_FILE =
|
|
|
|
StringRef::from_lit("private-key-passwd-file");
|
|
|
|
constexpr auto SHRPX_OPT_CERTIFICATE_FILE =
|
|
|
|
StringRef::from_lit("certificate-file");
|
|
|
|
constexpr auto SHRPX_OPT_DH_PARAM_FILE = StringRef::from_lit("dh-param-file");
|
|
|
|
constexpr auto SHRPX_OPT_SUBCERT = StringRef::from_lit("subcert");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND = StringRef::from_lit("backend");
|
|
|
|
constexpr auto SHRPX_OPT_FRONTEND = StringRef::from_lit("frontend");
|
|
|
|
constexpr auto SHRPX_OPT_WORKERS = StringRef::from_lit("workers");
|
|
|
|
constexpr auto SHRPX_OPT_HTTP2_MAX_CONCURRENT_STREAMS =
|
|
|
|
StringRef::from_lit("http2-max-concurrent-streams");
|
|
|
|
constexpr auto SHRPX_OPT_LOG_LEVEL = StringRef::from_lit("log-level");
|
|
|
|
constexpr auto SHRPX_OPT_DAEMON = StringRef::from_lit("daemon");
|
|
|
|
constexpr auto SHRPX_OPT_HTTP2_PROXY = StringRef::from_lit("http2-proxy");
|
|
|
|
constexpr auto SHRPX_OPT_HTTP2_BRIDGE = StringRef::from_lit("http2-bridge");
|
|
|
|
constexpr auto SHRPX_OPT_CLIENT_PROXY = StringRef::from_lit("client-proxy");
|
|
|
|
constexpr auto SHRPX_OPT_ADD_X_FORWARDED_FOR =
|
|
|
|
StringRef::from_lit("add-x-forwarded-for");
|
|
|
|
constexpr auto SHRPX_OPT_STRIP_INCOMING_X_FORWARDED_FOR =
|
|
|
|
StringRef::from_lit("strip-incoming-x-forwarded-for");
|
|
|
|
constexpr auto SHRPX_OPT_NO_VIA = StringRef::from_lit("no-via");
|
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_HTTP2_READ_TIMEOUT =
|
|
|
|
StringRef::from_lit("frontend-http2-read-timeout");
|
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_READ_TIMEOUT =
|
|
|
|
StringRef::from_lit("frontend-read-timeout");
|
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_WRITE_TIMEOUT =
|
|
|
|
StringRef::from_lit("frontend-write-timeout");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_READ_TIMEOUT =
|
|
|
|
StringRef::from_lit("backend-read-timeout");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_WRITE_TIMEOUT =
|
|
|
|
StringRef::from_lit("backend-write-timeout");
|
|
|
|
constexpr auto SHRPX_OPT_STREAM_READ_TIMEOUT =
|
|
|
|
StringRef::from_lit("stream-read-timeout");
|
|
|
|
constexpr auto SHRPX_OPT_STREAM_WRITE_TIMEOUT =
|
|
|
|
StringRef::from_lit("stream-write-timeout");
|
|
|
|
constexpr auto SHRPX_OPT_ACCESSLOG_FILE = StringRef::from_lit("accesslog-file");
|
|
|
|
constexpr auto SHRPX_OPT_ACCESSLOG_SYSLOG =
|
|
|
|
StringRef::from_lit("accesslog-syslog");
|
|
|
|
constexpr auto SHRPX_OPT_ACCESSLOG_FORMAT =
|
|
|
|
StringRef::from_lit("accesslog-format");
|
|
|
|
constexpr auto SHRPX_OPT_ERRORLOG_FILE = StringRef::from_lit("errorlog-file");
|
|
|
|
constexpr auto SHRPX_OPT_ERRORLOG_SYSLOG =
|
|
|
|
StringRef::from_lit("errorlog-syslog");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_KEEP_ALIVE_TIMEOUT =
|
|
|
|
StringRef::from_lit("backend-keep-alive-timeout");
|
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_HTTP2_WINDOW_BITS =
|
|
|
|
StringRef::from_lit("frontend-http2-window-bits");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_HTTP2_WINDOW_BITS =
|
|
|
|
StringRef::from_lit("backend-http2-window-bits");
|
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_HTTP2_CONNECTION_WINDOW_BITS =
|
|
|
|
StringRef::from_lit("frontend-http2-connection-window-bits");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_HTTP2_CONNECTION_WINDOW_BITS =
|
|
|
|
StringRef::from_lit("backend-http2-connection-window-bits");
|
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_NO_TLS =
|
|
|
|
StringRef::from_lit("frontend-no-tls");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_NO_TLS = StringRef::from_lit("backend-no-tls");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_TLS_SNI_FIELD =
|
|
|
|
StringRef::from_lit("backend-tls-sni-field");
|
|
|
|
constexpr auto SHRPX_OPT_PID_FILE = StringRef::from_lit("pid-file");
|
|
|
|
constexpr auto SHRPX_OPT_USER = StringRef::from_lit("user");
|
|
|
|
constexpr auto SHRPX_OPT_SYSLOG_FACILITY =
|
|
|
|
StringRef::from_lit("syslog-facility");
|
|
|
|
constexpr auto SHRPX_OPT_BACKLOG = StringRef::from_lit("backlog");
|
|
|
|
constexpr auto SHRPX_OPT_CIPHERS = StringRef::from_lit("ciphers");
|
|
|
|
constexpr auto SHRPX_OPT_CLIENT = StringRef::from_lit("client");
|
|
|
|
constexpr auto SHRPX_OPT_INSECURE = StringRef::from_lit("insecure");
|
|
|
|
constexpr auto SHRPX_OPT_CACERT = StringRef::from_lit("cacert");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_IPV4 = StringRef::from_lit("backend-ipv4");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_IPV6 = StringRef::from_lit("backend-ipv6");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_HTTP_PROXY_URI =
|
|
|
|
StringRef::from_lit("backend-http-proxy-uri");
|
|
|
|
constexpr auto SHRPX_OPT_READ_RATE = StringRef::from_lit("read-rate");
|
|
|
|
constexpr auto SHRPX_OPT_READ_BURST = StringRef::from_lit("read-burst");
|
|
|
|
constexpr auto SHRPX_OPT_WRITE_RATE = StringRef::from_lit("write-rate");
|
|
|
|
constexpr auto SHRPX_OPT_WRITE_BURST = StringRef::from_lit("write-burst");
|
|
|
|
constexpr auto SHRPX_OPT_WORKER_READ_RATE =
|
|
|
|
StringRef::from_lit("worker-read-rate");
|
|
|
|
constexpr auto SHRPX_OPT_WORKER_READ_BURST =
|
|
|
|
StringRef::from_lit("worker-read-burst");
|
|
|
|
constexpr auto SHRPX_OPT_WORKER_WRITE_RATE =
|
|
|
|
StringRef::from_lit("worker-write-rate");
|
|
|
|
constexpr auto SHRPX_OPT_WORKER_WRITE_BURST =
|
|
|
|
StringRef::from_lit("worker-write-burst");
|
|
|
|
constexpr auto SHRPX_OPT_NPN_LIST = StringRef::from_lit("npn-list");
|
|
|
|
constexpr auto SHRPX_OPT_TLS_PROTO_LIST = StringRef::from_lit("tls-proto-list");
|
|
|
|
constexpr auto SHRPX_OPT_VERIFY_CLIENT = StringRef::from_lit("verify-client");
|
|
|
|
constexpr auto SHRPX_OPT_VERIFY_CLIENT_CACERT =
|
|
|
|
StringRef::from_lit("verify-client-cacert");
|
|
|
|
constexpr auto SHRPX_OPT_CLIENT_PRIVATE_KEY_FILE =
|
|
|
|
StringRef::from_lit("client-private-key-file");
|
|
|
|
constexpr auto SHRPX_OPT_CLIENT_CERT_FILE =
|
|
|
|
StringRef::from_lit("client-cert-file");
|
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_HTTP2_DUMP_REQUEST_HEADER =
|
|
|
|
StringRef::from_lit("frontend-http2-dump-request-header");
|
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_HTTP2_DUMP_RESPONSE_HEADER =
|
|
|
|
StringRef::from_lit("frontend-http2-dump-response-header");
|
|
|
|
constexpr auto SHRPX_OPT_HTTP2_NO_COOKIE_CRUMBLING =
|
|
|
|
StringRef::from_lit("http2-no-cookie-crumbling");
|
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_FRAME_DEBUG =
|
|
|
|
StringRef::from_lit("frontend-frame-debug");
|
|
|
|
constexpr auto SHRPX_OPT_PADDING = StringRef::from_lit("padding");
|
|
|
|
constexpr auto SHRPX_OPT_ALTSVC = StringRef::from_lit("altsvc");
|
|
|
|
constexpr auto SHRPX_OPT_ADD_REQUEST_HEADER =
|
|
|
|
StringRef::from_lit("add-request-header");
|
|
|
|
constexpr auto SHRPX_OPT_ADD_RESPONSE_HEADER =
|
|
|
|
StringRef::from_lit("add-response-header");
|
|
|
|
constexpr auto SHRPX_OPT_WORKER_FRONTEND_CONNECTIONS =
|
|
|
|
StringRef::from_lit("worker-frontend-connections");
|
|
|
|
constexpr auto SHRPX_OPT_NO_LOCATION_REWRITE =
|
|
|
|
StringRef::from_lit("no-location-rewrite");
|
|
|
|
constexpr auto SHRPX_OPT_NO_HOST_REWRITE =
|
|
|
|
StringRef::from_lit("no-host-rewrite");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_HTTP1_CONNECTIONS_PER_HOST =
|
|
|
|
StringRef::from_lit("backend-http1-connections-per-host");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_HTTP1_CONNECTIONS_PER_FRONTEND =
|
|
|
|
StringRef::from_lit("backend-http1-connections-per-frontend");
|
|
|
|
constexpr auto SHRPX_OPT_LISTENER_DISABLE_TIMEOUT =
|
|
|
|
StringRef::from_lit("listener-disable-timeout");
|
|
|
|
constexpr auto SHRPX_OPT_TLS_TICKET_KEY_FILE =
|
|
|
|
StringRef::from_lit("tls-ticket-key-file");
|
|
|
|
constexpr auto SHRPX_OPT_RLIMIT_NOFILE = StringRef::from_lit("rlimit-nofile");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_REQUEST_BUFFER =
|
|
|
|
StringRef::from_lit("backend-request-buffer");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_RESPONSE_BUFFER =
|
|
|
|
StringRef::from_lit("backend-response-buffer");
|
|
|
|
constexpr auto SHRPX_OPT_NO_SERVER_PUSH = StringRef::from_lit("no-server-push");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_HTTP2_CONNECTIONS_PER_WORKER =
|
|
|
|
StringRef::from_lit("backend-http2-connections-per-worker");
|
|
|
|
constexpr auto SHRPX_OPT_FETCH_OCSP_RESPONSE_FILE =
|
|
|
|
StringRef::from_lit("fetch-ocsp-response-file");
|
|
|
|
constexpr auto SHRPX_OPT_OCSP_UPDATE_INTERVAL =
|
|
|
|
StringRef::from_lit("ocsp-update-interval");
|
|
|
|
constexpr auto SHRPX_OPT_NO_OCSP = StringRef::from_lit("no-ocsp");
|
|
|
|
constexpr auto SHRPX_OPT_HEADER_FIELD_BUFFER =
|
|
|
|
StringRef::from_lit("header-field-buffer");
|
|
|
|
constexpr auto SHRPX_OPT_MAX_HEADER_FIELDS =
|
|
|
|
StringRef::from_lit("max-header-fields");
|
|
|
|
constexpr auto SHRPX_OPT_INCLUDE = StringRef::from_lit("include");
|
|
|
|
constexpr auto SHRPX_OPT_TLS_TICKET_KEY_CIPHER =
|
|
|
|
StringRef::from_lit("tls-ticket-key-cipher");
|
|
|
|
constexpr auto SHRPX_OPT_HOST_REWRITE = StringRef::from_lit("host-rewrite");
|
|
|
|
constexpr auto SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED =
|
|
|
|
StringRef::from_lit("tls-session-cache-memcached");
|
|
|
|
constexpr auto SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED =
|
|
|
|
StringRef::from_lit("tls-ticket-key-memcached");
|
|
|
|
constexpr auto SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_INTERVAL =
|
|
|
|
StringRef::from_lit("tls-ticket-key-memcached-interval");
|
|
|
|
constexpr auto SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_MAX_RETRY =
|
|
|
|
StringRef::from_lit("tls-ticket-key-memcached-max-retry");
|
|
|
|
constexpr auto SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_MAX_FAIL =
|
|
|
|
StringRef::from_lit("tls-ticket-key-memcached-max-fail");
|
|
|
|
constexpr auto SHRPX_OPT_MRUBY_FILE = StringRef::from_lit("mruby-file");
|
|
|
|
constexpr auto SHRPX_OPT_ACCEPT_PROXY_PROTOCOL =
|
|
|
|
StringRef::from_lit("accept-proxy-protocol");
|
|
|
|
constexpr auto SHRPX_OPT_FASTOPEN = StringRef::from_lit("fastopen");
|
|
|
|
constexpr auto SHRPX_OPT_TLS_DYN_REC_WARMUP_THRESHOLD =
|
|
|
|
StringRef::from_lit("tls-dyn-rec-warmup-threshold");
|
|
|
|
constexpr auto SHRPX_OPT_TLS_DYN_REC_IDLE_TIMEOUT =
|
|
|
|
StringRef::from_lit("tls-dyn-rec-idle-timeout");
|
|
|
|
constexpr auto SHRPX_OPT_ADD_FORWARDED = StringRef::from_lit("add-forwarded");
|
|
|
|
constexpr auto SHRPX_OPT_STRIP_INCOMING_FORWARDED =
|
|
|
|
StringRef::from_lit("strip-incoming-forwarded");
|
|
|
|
constexpr auto SHRPX_OPT_FORWARDED_BY = StringRef::from_lit("forwarded-by");
|
|
|
|
constexpr auto SHRPX_OPT_FORWARDED_FOR = StringRef::from_lit("forwarded-for");
|
|
|
|
constexpr auto SHRPX_OPT_REQUEST_HEADER_FIELD_BUFFER =
|
|
|
|
StringRef::from_lit("request-header-field-buffer");
|
|
|
|
constexpr auto SHRPX_OPT_MAX_REQUEST_HEADER_FIELDS =
|
|
|
|
StringRef::from_lit("max-request-header-fields");
|
|
|
|
constexpr auto SHRPX_OPT_RESPONSE_HEADER_FIELD_BUFFER =
|
|
|
|
StringRef::from_lit("response-header-field-buffer");
|
|
|
|
constexpr auto SHRPX_OPT_MAX_RESPONSE_HEADER_FIELDS =
|
|
|
|
StringRef::from_lit("max-response-header-fields");
|
2021-04-02 15:31:15 +02:00
|
|
|
constexpr auto SHRPX_OPT_NO_HTTP2_CIPHER_BLOCK_LIST =
|
|
|
|
StringRef::from_lit("no-http2-cipher-block-list");
|
2016-03-24 13:05:02 +01:00
|
|
|
constexpr auto SHRPX_OPT_NO_HTTP2_CIPHER_BLACK_LIST =
|
|
|
|
StringRef::from_lit("no-http2-cipher-black-list");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_HTTP1_TLS =
|
|
|
|
StringRef::from_lit("backend-http1-tls");
|
|
|
|
constexpr auto SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_TLS =
|
|
|
|
StringRef::from_lit("tls-session-cache-memcached-tls");
|
|
|
|
constexpr auto SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_CERT_FILE =
|
|
|
|
StringRef::from_lit("tls-session-cache-memcached-cert-file");
|
|
|
|
constexpr auto SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_PRIVATE_KEY_FILE =
|
|
|
|
StringRef::from_lit("tls-session-cache-memcached-private-key-file");
|
|
|
|
constexpr auto SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_ADDRESS_FAMILY =
|
|
|
|
StringRef::from_lit("tls-session-cache-memcached-address-family");
|
|
|
|
constexpr auto SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_TLS =
|
|
|
|
StringRef::from_lit("tls-ticket-key-memcached-tls");
|
|
|
|
constexpr auto SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_CERT_FILE =
|
|
|
|
StringRef::from_lit("tls-ticket-key-memcached-cert-file");
|
|
|
|
constexpr auto SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_PRIVATE_KEY_FILE =
|
|
|
|
StringRef::from_lit("tls-ticket-key-memcached-private-key-file");
|
|
|
|
constexpr auto SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_ADDRESS_FAMILY =
|
|
|
|
StringRef::from_lit("tls-ticket-key-memcached-address-family");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_ADDRESS_FAMILY =
|
|
|
|
StringRef::from_lit("backend-address-family");
|
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_HTTP2_MAX_CONCURRENT_STREAMS =
|
|
|
|
StringRef::from_lit("frontend-http2-max-concurrent-streams");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_HTTP2_MAX_CONCURRENT_STREAMS =
|
|
|
|
StringRef::from_lit("backend-http2-max-concurrent-streams");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_CONNECTIONS_PER_FRONTEND =
|
|
|
|
StringRef::from_lit("backend-connections-per-frontend");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_TLS = StringRef::from_lit("backend-tls");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_CONNECTIONS_PER_HOST =
|
|
|
|
StringRef::from_lit("backend-connections-per-host");
|
|
|
|
constexpr auto SHRPX_OPT_ERROR_PAGE = StringRef::from_lit("error-page");
|
2016-05-06 16:10:09 +02:00
|
|
|
constexpr auto SHRPX_OPT_NO_KQUEUE = StringRef::from_lit("no-kqueue");
|
2016-05-21 07:13:57 +02:00
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_HTTP2_SETTINGS_TIMEOUT =
|
|
|
|
StringRef::from_lit("frontend-http2-settings-timeout");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_HTTP2_SETTINGS_TIMEOUT =
|
|
|
|
StringRef::from_lit("backend-http2-settings-timeout");
|
2016-06-04 10:24:54 +02:00
|
|
|
constexpr auto SHRPX_OPT_API_MAX_REQUEST_BODY =
|
|
|
|
StringRef::from_lit("api-max-request-body");
|
2016-06-21 17:13:43 +02:00
|
|
|
constexpr auto SHRPX_OPT_BACKEND_MAX_BACKOFF =
|
|
|
|
StringRef::from_lit("backend-max-backoff");
|
2016-08-26 15:28:09 +02:00
|
|
|
constexpr auto SHRPX_OPT_SERVER_NAME = StringRef::from_lit("server-name");
|
2016-08-31 16:47:15 +02:00
|
|
|
constexpr auto SHRPX_OPT_NO_SERVER_REWRITE =
|
|
|
|
StringRef::from_lit("no-server-rewrite");
|
2016-09-08 15:49:36 +02:00
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_HTTP2_OPTIMIZE_WRITE_BUFFER_SIZE =
|
|
|
|
StringRef::from_lit("frontend-http2-optimize-write-buffer-size");
|
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_HTTP2_OPTIMIZE_WINDOW_SIZE =
|
|
|
|
StringRef::from_lit("frontend-http2-optimize-window-size");
|
2016-09-09 14:05:37 +02:00
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_HTTP2_WINDOW_SIZE =
|
|
|
|
StringRef::from_lit("frontend-http2-window-size");
|
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_HTTP2_CONNECTION_WINDOW_SIZE =
|
|
|
|
StringRef::from_lit("frontend-http2-connection-window-size");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_HTTP2_WINDOW_SIZE =
|
|
|
|
StringRef::from_lit("backend-http2-window-size");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_HTTP2_CONNECTION_WINDOW_SIZE =
|
|
|
|
StringRef::from_lit("backend-http2-connection-window-size");
|
2016-09-12 15:53:02 +02:00
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_HTTP2_ENCODER_DYNAMIC_TABLE_SIZE =
|
|
|
|
StringRef::from_lit("frontend-http2-encoder-dynamic-table-size");
|
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_HTTP2_DECODER_DYNAMIC_TABLE_SIZE =
|
|
|
|
StringRef::from_lit("frontend-http2-decoder-dynamic-table-size");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_HTTP2_ENCODER_DYNAMIC_TABLE_SIZE =
|
|
|
|
StringRef::from_lit("backend-http2-encoder-dynamic-table-size");
|
|
|
|
constexpr auto SHRPX_OPT_BACKEND_HTTP2_DECODER_DYNAMIC_TABLE_SIZE =
|
|
|
|
StringRef::from_lit("backend-http2-decoder-dynamic-table-size");
|
2016-10-08 03:50:28 +02:00
|
|
|
constexpr auto SHRPX_OPT_ECDH_CURVES = StringRef::from_lit("ecdh-curves");
|
2016-10-08 12:03:21 +02:00
|
|
|
constexpr auto SHRPX_OPT_TLS_SCT_DIR = StringRef::from_lit("tls-sct-dir");
|
2016-10-10 15:50:41 +02:00
|
|
|
constexpr auto SHRPX_OPT_BACKEND_CONNECT_TIMEOUT =
|
|
|
|
StringRef::from_lit("backend-connect-timeout");
|
2016-12-10 09:48:28 +01:00
|
|
|
constexpr auto SHRPX_OPT_DNS_CACHE_TIMEOUT =
|
|
|
|
StringRef::from_lit("dns-cache-timeout");
|
2016-12-10 16:50:16 +01:00
|
|
|
constexpr auto SHRPX_OPT_DNS_LOOKUP_TIMEOUT =
|
|
|
|
StringRef::from_lit("dns-lookup-timeout");
|
|
|
|
constexpr auto SHRPX_OPT_DNS_MAX_TRY = StringRef::from_lit("dns-max-try");
|
2016-12-23 03:01:29 +01:00
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_KEEP_ALIVE_TIMEOUT =
|
|
|
|
StringRef::from_lit("frontend-keep-alive-timeout");
|
2017-01-07 15:42:51 +01:00
|
|
|
constexpr auto SHRPX_OPT_PSK_SECRETS = StringRef::from_lit("psk-secrets");
|
2017-01-07 16:24:33 +01:00
|
|
|
constexpr auto SHRPX_OPT_CLIENT_PSK_SECRETS =
|
|
|
|
StringRef::from_lit("client-psk-secrets");
|
2021-04-02 15:31:15 +02:00
|
|
|
constexpr auto SHRPX_OPT_CLIENT_NO_HTTP2_CIPHER_BLOCK_LIST =
|
|
|
|
StringRef::from_lit("client-no-http2-cipher-block-list");
|
2017-01-08 14:33:19 +01:00
|
|
|
constexpr auto SHRPX_OPT_CLIENT_NO_HTTP2_CIPHER_BLACK_LIST =
|
|
|
|
StringRef::from_lit("client-no-http2-cipher-black-list");
|
2017-01-08 14:40:58 +01:00
|
|
|
constexpr auto SHRPX_OPT_CLIENT_CIPHERS = StringRef::from_lit("client-ciphers");
|
2017-01-11 11:27:08 +01:00
|
|
|
constexpr auto SHRPX_OPT_ACCESSLOG_WRITE_EARLY =
|
|
|
|
StringRef::from_lit("accesslog-write-early");
|
2017-02-13 15:34:45 +01:00
|
|
|
constexpr auto SHRPX_OPT_TLS_MIN_PROTO_VERSION =
|
|
|
|
StringRef::from_lit("tls-min-proto-version");
|
|
|
|
constexpr auto SHRPX_OPT_TLS_MAX_PROTO_VERSION =
|
|
|
|
StringRef::from_lit("tls-max-proto-version");
|
2017-02-18 10:23:06 +01:00
|
|
|
constexpr auto SHRPX_OPT_REDIRECT_HTTPS_PORT =
|
|
|
|
StringRef::from_lit("redirect-https-port");
|
2017-02-20 15:36:50 +01:00
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_MAX_REQUESTS =
|
|
|
|
StringRef::from_lit("frontend-max-requests");
|
2017-02-21 14:19:34 +01:00
|
|
|
constexpr auto SHRPX_OPT_SINGLE_THREAD = StringRef::from_lit("single-thread");
|
2017-04-06 12:53:39 +02:00
|
|
|
constexpr auto SHRPX_OPT_SINGLE_PROCESS = StringRef::from_lit("single-process");
|
2017-04-05 15:50:18 +02:00
|
|
|
constexpr auto SHRPX_OPT_NO_ADD_X_FORWARDED_PROTO =
|
|
|
|
StringRef::from_lit("no-add-x-forwarded-proto");
|
|
|
|
constexpr auto SHRPX_OPT_NO_STRIP_INCOMING_X_FORWARDED_PROTO =
|
|
|
|
StringRef::from_lit("no-strip-incoming-x-forwarded-proto");
|
2017-05-18 14:11:10 +02:00
|
|
|
constexpr auto SHRPX_OPT_OCSP_STARTUP = StringRef::from_lit("ocsp-startup");
|
2017-05-25 15:12:54 +02:00
|
|
|
constexpr auto SHRPX_OPT_NO_VERIFY_OCSP = StringRef::from_lit("no-verify-ocsp");
|
2018-02-08 08:51:23 +01:00
|
|
|
constexpr auto SHRPX_OPT_VERIFY_CLIENT_TOLERATE_EXPIRED =
|
|
|
|
StringRef::from_lit("verify-client-tolerate-expired");
|
2018-08-28 10:50:01 +02:00
|
|
|
constexpr auto SHRPX_OPT_IGNORE_PER_PATTERN_MRUBY_ERROR =
|
|
|
|
StringRef::from_lit("ignore-per-pattern-mruby-error");
|
2018-09-08 12:22:30 +02:00
|
|
|
constexpr auto SHRPX_OPT_TLS_NO_POSTPONE_EARLY_DATA =
|
|
|
|
StringRef::from_lit("tls-no-postpone-early-data");
|
2018-05-20 15:54:59 +02:00
|
|
|
constexpr auto SHRPX_OPT_TLS_MAX_EARLY_DATA =
|
|
|
|
StringRef::from_lit("tls-max-early-data");
|
2018-09-09 09:32:34 +02:00
|
|
|
constexpr auto SHRPX_OPT_TLS13_CIPHERS = StringRef::from_lit("tls13-ciphers");
|
|
|
|
constexpr auto SHRPX_OPT_TLS13_CLIENT_CIPHERS =
|
|
|
|
StringRef::from_lit("tls13-client-ciphers");
|
2018-09-09 15:37:22 +02:00
|
|
|
constexpr auto SHRPX_OPT_NO_STRIP_INCOMING_EARLY_DATA =
|
|
|
|
StringRef::from_lit("no-strip-incoming-early-data");
|
2021-08-27 14:34:18 +02:00
|
|
|
constexpr auto SHRPX_OPT_QUIC_BPF_PROGRAM_FILE =
|
|
|
|
StringRef::from_lit("quic-bpf-program-file");
|
|
|
|
constexpr auto SHRPX_OPT_NO_QUIC_BPF = StringRef::from_lit("no-quic-bpf");
|
2021-08-26 13:59:32 +02:00
|
|
|
constexpr auto SHRPX_OPT_HTTP2_ALTSVC = StringRef::from_lit("http2-altsvc");
|
2021-08-27 11:29:06 +02:00
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_HTTP3_READ_TIMEOUT =
|
|
|
|
StringRef::from_lit("frontend-http3-read-timeout");
|
2021-08-27 12:03:06 +02:00
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_QUIC_IDLE_TIMEOUT =
|
|
|
|
StringRef::from_lit("frontend-quic-idle-timeout");
|
2021-08-27 12:16:25 +02:00
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_QUIC_DEBUG_LOG =
|
|
|
|
StringRef::from_lit("frontend-quic-debug-log");
|
2021-08-27 12:57:04 +02:00
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_HTTP3_WINDOW_SIZE =
|
|
|
|
StringRef::from_lit("frontend-http3-window-size");
|
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_HTTP3_CONNECTION_WINDOW_SIZE =
|
|
|
|
StringRef::from_lit("frontend-http3-connection-window-size");
|
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_HTTP3_MAX_WINDOW_SIZE =
|
|
|
|
StringRef::from_lit("frontend-http3-max-window-size");
|
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_HTTP3_MAX_CONNECTION_WINDOW_SIZE =
|
|
|
|
StringRef::from_lit("frontend-http3-max-connection-window-size");
|
2021-08-27 14:11:03 +02:00
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_HTTP3_MAX_CONCURRENT_STREAMS =
|
|
|
|
StringRef::from_lit("frontend-http3-max-concurrent-streams");
|
2021-09-05 14:39:45 +02:00
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_QUIC_EARLY_DATA =
|
|
|
|
StringRef::from_lit("frontend-quic-early-data");
|
2021-09-06 13:06:38 +02:00
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_QUIC_QLOG_DIR =
|
|
|
|
StringRef::from_lit("frontend-quic-qlog-dir");
|
2021-09-12 08:04:54 +02:00
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_QUIC_REQUIRE_TOKEN =
|
|
|
|
StringRef::from_lit("frontend-quic-require-token");
|
2021-09-13 14:35:46 +02:00
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_QUIC_CONGESTION_CONTROLLER =
|
|
|
|
StringRef::from_lit("frontend-quic-congestion-controller");
|
2021-09-21 15:46:32 +02:00
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_QUIC_SERVER_ID =
|
|
|
|
StringRef::from_lit("frontend-quic-server-id");
|
2021-09-22 11:24:50 +02:00
|
|
|
constexpr auto SHRPX_OPT_FRONTEND_QUIC_SECRET_FILE =
|
|
|
|
StringRef::from_lit("frontend-quic-secret-file");
|
2021-09-24 11:01:47 +02:00
|
|
|
constexpr auto SHRPX_OPT_RLIMIT_MEMLOCK = StringRef::from_lit("rlimit-memlock");
|
2016-01-15 15:04:58 +01:00
|
|
|
|
|
|
|
constexpr size_t SHRPX_OBFUSCATED_NODE_LENGTH = 8;
|
2012-08-01 17:06:41 +02:00
|
|
|
|
2016-06-02 17:22:55 +02:00
|
|
|
constexpr char DEFAULT_DOWNSTREAM_HOST[] = "127.0.0.1";
|
|
|
|
constexpr int16_t DEFAULT_DOWNSTREAM_PORT = 80;
|
|
|
|
|
2018-10-16 15:17:37 +02:00
|
|
|
enum class Proto {
|
|
|
|
NONE,
|
|
|
|
HTTP1,
|
|
|
|
HTTP2,
|
2021-08-16 08:11:18 +02:00
|
|
|
HTTP3,
|
2018-10-16 15:17:37 +02:00
|
|
|
MEMCACHED,
|
|
|
|
};
|
2013-02-22 13:54:07 +01:00
|
|
|
|
2018-10-16 15:25:42 +02:00
|
|
|
enum class SessionAffinity {
|
2016-06-09 15:35:59 +02:00
|
|
|
// No session affinity
|
2018-10-16 15:25:42 +02:00
|
|
|
NONE,
|
2016-06-09 15:35:59 +02:00
|
|
|
// Client IP affinity
|
2018-10-16 15:25:42 +02:00
|
|
|
IP,
|
2017-10-25 17:45:22 +02:00
|
|
|
// Cookie based affinity
|
2018-10-16 15:25:42 +02:00
|
|
|
COOKIE,
|
2017-10-25 17:45:22 +02:00
|
|
|
};
|
|
|
|
|
2018-10-16 15:33:44 +02:00
|
|
|
enum class SessionAffinityCookieSecure {
|
2017-11-21 14:24:38 +01:00
|
|
|
// Secure attribute of session affinity cookie is determined by the
|
|
|
|
// request scheme.
|
2018-10-16 15:33:44 +02:00
|
|
|
AUTO,
|
2017-11-21 14:24:38 +01:00
|
|
|
// Secure attribute of session affinity cookie is always set.
|
2018-10-16 15:33:44 +02:00
|
|
|
YES,
|
2017-11-21 14:24:38 +01:00
|
|
|
// Secure attribute of session affinity cookie is always unset.
|
2018-10-16 15:33:44 +02:00
|
|
|
NO,
|
2017-11-21 14:24:38 +01:00
|
|
|
};
|
|
|
|
|
2017-10-25 17:45:22 +02:00
|
|
|
struct AffinityConfig {
|
|
|
|
// Type of session affinity.
|
2018-10-16 15:25:42 +02:00
|
|
|
SessionAffinity type;
|
2017-10-25 17:45:22 +02:00
|
|
|
struct {
|
|
|
|
// Name of a cookie to use.
|
|
|
|
StringRef name;
|
|
|
|
// Path which a cookie is applied to.
|
|
|
|
StringRef path;
|
2017-11-21 14:24:38 +01:00
|
|
|
// Secure attribute
|
2018-10-16 15:33:44 +02:00
|
|
|
SessionAffinityCookieSecure secure;
|
2017-10-25 17:45:22 +02:00
|
|
|
} cookie;
|
2016-06-09 15:35:59 +02:00
|
|
|
};
|
|
|
|
|
2016-01-15 15:04:58 +01:00
|
|
|
enum shrpx_forwarded_param {
|
|
|
|
FORWARDED_NONE = 0,
|
|
|
|
FORWARDED_BY = 0x1,
|
|
|
|
FORWARDED_FOR = 0x2,
|
|
|
|
FORWARDED_HOST = 0x4,
|
|
|
|
FORWARDED_PROTO = 0x8,
|
|
|
|
};
|
|
|
|
|
2018-10-16 15:54:36 +02:00
|
|
|
enum class ForwardedNode {
|
|
|
|
OBFUSCATED,
|
|
|
|
IP,
|
2016-01-15 15:04:58 +01:00
|
|
|
};
|
|
|
|
|
2014-04-08 15:28:50 +02:00
|
|
|
struct AltSvc {
|
2021-08-26 13:59:32 +02:00
|
|
|
StringRef protocol_id, host, origin, service, params;
|
2014-04-08 15:28:50 +02:00
|
|
|
|
|
|
|
uint16_t port;
|
|
|
|
};
|
|
|
|
|
2018-10-17 01:38:55 +02:00
|
|
|
enum class UpstreamAltMode {
|
2016-06-16 16:30:35 +02:00
|
|
|
// No alternative mode
|
2018-10-17 01:38:55 +02:00
|
|
|
NONE,
|
2016-06-16 16:30:35 +02:00
|
|
|
// API processing mode
|
2018-10-17 01:38:55 +02:00
|
|
|
API,
|
2016-06-16 17:00:37 +02:00
|
|
|
// Health monitor mode
|
2018-10-17 01:38:55 +02:00
|
|
|
HEALTHMON,
|
2016-06-16 16:30:35 +02:00
|
|
|
};
|
|
|
|
|
2016-02-07 09:51:53 +01:00
|
|
|
struct UpstreamAddr {
|
2021-08-23 14:40:24 +02:00
|
|
|
// The unique index of this address.
|
|
|
|
size_t index;
|
2016-01-31 11:41:56 +01:00
|
|
|
// The frontend address (e.g., FQDN, hostname, IP address). If
|
2016-10-02 14:22:02 +02:00
|
|
|
// |host_unix| is true, this is UNIX domain socket path. This must
|
|
|
|
// be NULL terminated string.
|
|
|
|
StringRef host;
|
2016-01-31 11:41:56 +01:00
|
|
|
// For TCP socket, this is <IP address>:<PORT>. For IPv6 address,
|
|
|
|
// address is surrounded by square brackets. If socket is UNIX
|
|
|
|
// domain socket, this is "localhost".
|
2016-10-02 14:22:02 +02:00
|
|
|
StringRef hostport;
|
2016-01-31 11:41:56 +01:00
|
|
|
// frontend port. 0 if |host_unix| is true.
|
|
|
|
uint16_t port;
|
|
|
|
// For TCP socket, this is either AF_INET or AF_INET6. For UNIX
|
|
|
|
// domain socket, this is 0.
|
|
|
|
int family;
|
2016-06-16 16:30:35 +02:00
|
|
|
// Alternate mode
|
2018-10-17 01:38:55 +02:00
|
|
|
UpstreamAltMode alt_mode;
|
2016-01-31 11:41:56 +01:00
|
|
|
// true if |host| contains UNIX domain socket path.
|
|
|
|
bool host_unix;
|
2016-03-23 15:56:09 +01:00
|
|
|
// true if TLS is enabled.
|
|
|
|
bool tls;
|
2017-04-16 16:47:10 +02:00
|
|
|
// true if SNI host should be used as a host when selecting backend
|
|
|
|
// server.
|
|
|
|
bool sni_fwd;
|
2017-01-03 04:47:03 +01:00
|
|
|
// true if client is supposed to send PROXY protocol v1 header.
|
|
|
|
bool accept_proxy_protocol;
|
2021-08-16 08:11:18 +02:00
|
|
|
bool quic;
|
2016-01-31 11:41:56 +01:00
|
|
|
int fd;
|
|
|
|
};
|
|
|
|
|
2016-02-27 15:24:14 +01:00
|
|
|
struct DownstreamAddrConfig {
|
2016-12-04 15:43:41 +01:00
|
|
|
// Resolved address if |dns| is false
|
2015-07-26 18:41:10 +02:00
|
|
|
Address addr;
|
2015-02-22 09:12:00 +01:00
|
|
|
// backend address. If |host_unix| is true, this is UNIX domain
|
2016-10-02 10:44:45 +02:00
|
|
|
// socket path. This must be NULL terminated string.
|
|
|
|
StringRef host;
|
2016-03-14 15:53:10 +01:00
|
|
|
// <HOST>:<PORT>. This does not treat 80 and 443 specially. If
|
|
|
|
// |host_unix| is true, this is "localhost".
|
2016-10-02 10:44:45 +02:00
|
|
|
StringRef hostport;
|
2016-04-29 07:42:18 +02:00
|
|
|
// hostname sent as SNI field
|
2016-10-02 10:44:45 +02:00
|
|
|
StringRef sni;
|
2019-01-19 03:12:05 +01:00
|
|
|
// name of group which this address belongs to.
|
|
|
|
StringRef group;
|
2016-04-09 14:58:08 +02:00
|
|
|
size_t fall;
|
|
|
|
size_t rise;
|
2019-01-19 03:12:05 +01:00
|
|
|
// weight of this address inside a weight group. Its range is [1,
|
|
|
|
// 256], inclusive.
|
|
|
|
uint32_t weight;
|
|
|
|
// weight of the weight group. Its range is [1, 256], inclusive.
|
|
|
|
uint32_t group_weight;
|
2016-05-24 16:36:43 +02:00
|
|
|
// Application protocol used in this group
|
2018-10-16 15:17:37 +02:00
|
|
|
Proto proto;
|
2015-02-22 09:12:00 +01:00
|
|
|
// backend port. 0 if |host_unix| is true.
|
2014-12-06 10:31:46 +01:00
|
|
|
uint16_t port;
|
2015-02-22 09:12:00 +01:00
|
|
|
// true if |host| contains UNIX domain socket path.
|
|
|
|
bool host_unix;
|
2016-05-24 16:36:43 +02:00
|
|
|
bool tls;
|
2016-12-04 15:43:41 +01:00
|
|
|
// true if dynamic DNS is enabled
|
|
|
|
bool dns;
|
2018-01-08 10:08:01 +01:00
|
|
|
// true if :scheme pseudo header field should be upgraded to secure
|
|
|
|
// variant (e.g., "https") when forwarding request to a backend
|
|
|
|
// connected by TLS connection.
|
|
|
|
bool upgrade_scheme;
|
2021-08-13 14:20:08 +02:00
|
|
|
// true if a request should not be forwarded to a backend.
|
|
|
|
bool dnf;
|
2014-12-06 10:31:46 +01:00
|
|
|
};
|
|
|
|
|
2016-07-06 15:31:28 +02:00
|
|
|
// Mapping hash to idx which is an index into
|
|
|
|
// DownstreamAddrGroupConfig::addrs.
|
|
|
|
struct AffinityHash {
|
|
|
|
AffinityHash(size_t idx, uint32_t hash) : idx(idx), hash(hash) {}
|
|
|
|
|
|
|
|
size_t idx;
|
|
|
|
uint32_t hash;
|
|
|
|
};
|
|
|
|
|
2016-02-27 15:24:14 +01:00
|
|
|
struct DownstreamAddrGroupConfig {
|
|
|
|
DownstreamAddrGroupConfig(const StringRef &pattern)
|
2018-10-16 15:25:42 +02:00
|
|
|
: pattern(pattern),
|
|
|
|
affinity{SessionAffinity::NONE},
|
2019-09-21 06:45:20 +02:00
|
|
|
redirect_if_not_tls(false),
|
2021-09-05 17:12:04 +02:00
|
|
|
dnf{false},
|
2019-09-21 06:45:20 +02:00
|
|
|
timeout{} {}
|
2015-09-25 19:38:45 +02:00
|
|
|
|
2016-10-02 10:44:45 +02:00
|
|
|
StringRef pattern;
|
2018-08-21 14:11:07 +02:00
|
|
|
StringRef mruby_file;
|
2016-02-27 15:24:14 +01:00
|
|
|
std::vector<DownstreamAddrConfig> addrs;
|
2016-07-06 15:31:28 +02:00
|
|
|
// Bunch of session affinity hash. Only used if affinity ==
|
2018-10-16 15:25:42 +02:00
|
|
|
// SessionAffinity::IP.
|
2016-07-06 15:31:28 +02:00
|
|
|
std::vector<AffinityHash> affinity_hash;
|
2017-10-25 17:45:22 +02:00
|
|
|
// Cookie based session affinity configuration.
|
|
|
|
AffinityConfig affinity;
|
2017-02-18 10:23:06 +01:00
|
|
|
// true if this group requires that client connection must be TLS,
|
|
|
|
// and the request must be redirected to https URI.
|
|
|
|
bool redirect_if_not_tls;
|
2021-08-13 14:20:08 +02:00
|
|
|
// true if a request should not be forwarded to a backend.
|
|
|
|
bool dnf;
|
2018-09-30 05:23:34 +02:00
|
|
|
// Timeouts for backend connection.
|
|
|
|
struct {
|
|
|
|
ev_tstamp read;
|
|
|
|
ev_tstamp write;
|
|
|
|
} timeout;
|
2015-07-09 19:52:11 +02:00
|
|
|
};
|
|
|
|
|
2015-01-07 16:01:09 +01:00
|
|
|
struct TicketKey {
|
2015-07-17 18:49:20 +02:00
|
|
|
const EVP_CIPHER *cipher;
|
|
|
|
const EVP_MD *hmac;
|
|
|
|
size_t hmac_keylen;
|
|
|
|
struct {
|
|
|
|
// name of this ticket configuration
|
2015-07-26 19:12:07 +02:00
|
|
|
std::array<uint8_t, 16> name;
|
2015-07-17 18:49:20 +02:00
|
|
|
// encryption key for |cipher|
|
2015-07-26 19:12:07 +02:00
|
|
|
std::array<uint8_t, 32> enc_key;
|
2015-07-17 18:49:20 +02:00
|
|
|
// hmac key for |hmac|
|
2015-07-26 19:12:07 +02:00
|
|
|
std::array<uint8_t, 32> hmac_key;
|
2015-07-17 18:49:20 +02:00
|
|
|
} data;
|
2015-01-07 16:01:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct TicketKeys {
|
|
|
|
~TicketKeys();
|
|
|
|
std::vector<TicketKey> keys;
|
|
|
|
};
|
|
|
|
|
2016-10-08 12:03:21 +02:00
|
|
|
struct TLSCertificate {
|
|
|
|
TLSCertificate(StringRef private_key_file, StringRef cert_file,
|
|
|
|
std::vector<uint8_t> sct_data)
|
|
|
|
: private_key_file(std::move(private_key_file)),
|
|
|
|
cert_file(std::move(cert_file)),
|
|
|
|
sct_data(std::move(sct_data)) {}
|
|
|
|
|
|
|
|
StringRef private_key_file;
|
|
|
|
StringRef cert_file;
|
|
|
|
std::vector<uint8_t> sct_data;
|
|
|
|
};
|
|
|
|
|
2021-08-26 07:46:34 +02:00
|
|
|
#ifdef ENABLE_HTTP3
|
2021-09-22 11:24:50 +02:00
|
|
|
struct QUICKeyingMaterial {
|
|
|
|
std::array<uint8_t, SHRPX_QUIC_SECRET_RESERVEDLEN> reserved;
|
|
|
|
std::array<uint8_t, SHRPX_QUIC_SECRETLEN> secret;
|
|
|
|
std::array<uint8_t, SHRPX_QUIC_SALTLEN> salt;
|
|
|
|
std::array<uint8_t, SHRPX_QUIC_CID_ENCRYPTION_KEYLEN> cid_encryption_key;
|
|
|
|
// Identifier of this keying material. Only the first 2 bits are
|
|
|
|
// used.
|
|
|
|
uint8_t id;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct QUICKeyingMaterials {
|
|
|
|
std::vector<QUICKeyingMaterial> keying_materials;
|
2021-08-26 07:46:34 +02:00
|
|
|
};
|
|
|
|
#endif // ENABLE_HTTP3
|
|
|
|
|
2016-01-17 14:51:40 +01:00
|
|
|
struct HttpProxy {
|
|
|
|
Address addr;
|
|
|
|
// host in http proxy URI
|
2016-10-02 15:27:40 +02:00
|
|
|
StringRef host;
|
2016-01-17 14:51:40 +01:00
|
|
|
// userinfo in http proxy URI, not percent-encoded form
|
2016-10-02 15:27:40 +02:00
|
|
|
StringRef userinfo;
|
2016-01-18 09:00:20 +01:00
|
|
|
// port in http proxy URI
|
2016-01-17 14:51:40 +01:00
|
|
|
uint16_t port;
|
|
|
|
};
|
|
|
|
|
2016-01-18 06:21:09 +01:00
|
|
|
struct TLSConfig {
|
|
|
|
// RFC 5077 Session ticket related configurations
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
Address addr;
|
|
|
|
uint16_t port;
|
2016-02-14 12:59:10 +01:00
|
|
|
// Hostname of memcached server. This is also used as SNI field
|
|
|
|
// if TLS is enabled.
|
2016-10-02 14:22:02 +02:00
|
|
|
StringRef host;
|
2016-02-13 10:17:11 +01:00
|
|
|
// Client private key and certificate for authentication
|
2016-10-02 14:22:02 +02:00
|
|
|
StringRef private_key_file;
|
|
|
|
StringRef cert_file;
|
2016-01-18 06:21:09 +01:00
|
|
|
ev_tstamp interval;
|
|
|
|
// Maximum number of retries when getting TLS ticket key from
|
|
|
|
// mamcached, due to network error.
|
|
|
|
size_t max_retry;
|
|
|
|
// Maximum number of consecutive error from memcached, when this
|
|
|
|
// limit reached, TLS ticket is disabled.
|
|
|
|
size_t max_fail;
|
2016-02-13 10:45:23 +01:00
|
|
|
// Address family of memcached connection. One of either
|
|
|
|
// AF_INET, AF_INET6 or AF_UNSPEC.
|
|
|
|
int family;
|
2016-02-13 10:17:11 +01:00
|
|
|
bool tls;
|
2016-01-18 06:21:09 +01:00
|
|
|
} memcached;
|
2016-10-02 15:08:51 +02:00
|
|
|
std::vector<StringRef> files;
|
2016-01-18 06:21:09 +01:00
|
|
|
const EVP_CIPHER *cipher;
|
|
|
|
// true if --tls-ticket-key-cipher is used
|
|
|
|
bool cipher_given;
|
|
|
|
} ticket;
|
|
|
|
|
|
|
|
// Session cache related configurations
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
Address addr;
|
|
|
|
uint16_t port;
|
2016-02-14 12:59:10 +01:00
|
|
|
// Hostname of memcached server. This is also used as SNI field
|
|
|
|
// if TLS is enabled.
|
2016-10-02 14:22:02 +02:00
|
|
|
StringRef host;
|
2016-02-12 16:20:38 +01:00
|
|
|
// Client private key and certificate for authentication
|
2016-10-02 14:22:02 +02:00
|
|
|
StringRef private_key_file;
|
|
|
|
StringRef cert_file;
|
2016-02-13 10:45:23 +01:00
|
|
|
// Address family of memcached connection. One of either
|
|
|
|
// AF_INET, AF_INET6 or AF_UNSPEC.
|
|
|
|
int family;
|
2016-02-11 14:56:45 +01:00
|
|
|
bool tls;
|
2016-01-18 06:21:09 +01:00
|
|
|
} memcached;
|
|
|
|
} session_cache;
|
|
|
|
|
|
|
|
// Dynamic record sizing configurations
|
|
|
|
struct {
|
|
|
|
size_t warmup_threshold;
|
|
|
|
ev_tstamp idle_timeout;
|
|
|
|
} dyn_rec;
|
|
|
|
|
|
|
|
// OCSP realted configurations
|
|
|
|
struct {
|
|
|
|
ev_tstamp update_interval;
|
2016-10-02 14:22:02 +02:00
|
|
|
StringRef fetch_ocsp_response_file;
|
2016-01-18 06:21:09 +01:00
|
|
|
bool disabled;
|
2017-05-18 14:11:10 +02:00
|
|
|
bool startup;
|
2017-05-25 15:12:54 +02:00
|
|
|
bool no_verify;
|
2016-01-18 06:21:09 +01:00
|
|
|
} ocsp;
|
|
|
|
|
|
|
|
// Client verification configurations
|
|
|
|
struct {
|
|
|
|
// Path to file containing CA certificate solely used for client
|
|
|
|
// certificate validation
|
2016-10-02 14:22:02 +02:00
|
|
|
StringRef cacert;
|
2016-01-18 06:21:09 +01:00
|
|
|
bool enabled;
|
2018-02-08 08:51:23 +01:00
|
|
|
// true if we accept an expired client certificate.
|
|
|
|
bool tolerate_expired;
|
2016-01-18 06:21:09 +01:00
|
|
|
} client_verify;
|
|
|
|
|
2017-01-08 14:25:30 +01:00
|
|
|
// Client (backend connection) TLS configuration.
|
2016-01-18 06:21:09 +01:00
|
|
|
struct {
|
2017-01-08 14:25:30 +01:00
|
|
|
// Client PSK configuration
|
|
|
|
struct {
|
|
|
|
// identity must be NULL terminated string.
|
|
|
|
StringRef identity;
|
|
|
|
StringRef secret;
|
|
|
|
} psk;
|
2016-10-02 14:22:02 +02:00
|
|
|
StringRef private_key_file;
|
|
|
|
StringRef cert_file;
|
2017-01-08 14:40:58 +01:00
|
|
|
StringRef ciphers;
|
2018-09-09 09:32:34 +02:00
|
|
|
StringRef tls13_ciphers;
|
2021-04-02 15:31:15 +02:00
|
|
|
bool no_http2_cipher_block_list;
|
2016-01-18 06:21:09 +01:00
|
|
|
} client;
|
|
|
|
|
2017-01-07 15:42:51 +01:00
|
|
|
// PSK secrets. The key is identity, and the associated value is
|
|
|
|
// its secret.
|
|
|
|
std::map<StringRef, StringRef> psk_secrets;
|
2016-10-08 12:03:21 +02:00
|
|
|
// The list of additional TLS certificate pair
|
|
|
|
std::vector<TLSCertificate> subcerts;
|
2014-06-10 16:15:29 +02:00
|
|
|
std::vector<unsigned char> alpn_prefs;
|
2015-07-20 15:37:26 +02:00
|
|
|
// list of supported NPN/ALPN protocol strings in the order of
|
|
|
|
// preference.
|
2016-10-02 15:19:31 +02:00
|
|
|
std::vector<StringRef> npn_list;
|
2015-07-20 15:37:26 +02:00
|
|
|
// list of supported SSL/TLS protocol strings.
|
2016-10-02 15:21:38 +02:00
|
|
|
std::vector<StringRef> tls_proto_list;
|
2016-10-08 12:03:21 +02:00
|
|
|
std::vector<uint8_t> sct_data;
|
2016-05-07 09:18:58 +02:00
|
|
|
BIO_METHOD *bio_method;
|
2016-01-18 06:21:09 +01:00
|
|
|
// Bit mask to disable SSL/TLS protocol versions. This will be
|
|
|
|
// passed to SSL_CTX_set_options().
|
|
|
|
long int tls_proto_mask;
|
2016-10-02 14:22:02 +02:00
|
|
|
StringRef backend_sni_name;
|
2016-01-18 06:21:09 +01:00
|
|
|
std::chrono::seconds session_timeout;
|
2016-10-02 14:22:02 +02:00
|
|
|
StringRef private_key_file;
|
|
|
|
StringRef private_key_passwd;
|
|
|
|
StringRef cert_file;
|
|
|
|
StringRef dh_param_file;
|
|
|
|
StringRef ciphers;
|
2018-09-09 09:32:34 +02:00
|
|
|
StringRef tls13_ciphers;
|
2016-10-08 03:50:28 +02:00
|
|
|
StringRef ecdh_curves;
|
2016-10-02 14:22:02 +02:00
|
|
|
StringRef cacert;
|
2018-05-20 15:54:59 +02:00
|
|
|
// The maximum amount of 0-RTT data that server accepts.
|
|
|
|
uint32_t max_early_data;
|
2017-02-13 15:34:45 +01:00
|
|
|
// The minimum and maximum TLS version. These values are defined in
|
|
|
|
// OpenSSL header file.
|
|
|
|
int min_proto_version;
|
|
|
|
int max_proto_version;
|
2016-01-18 06:21:09 +01:00
|
|
|
bool insecure;
|
2021-04-02 15:31:15 +02:00
|
|
|
bool no_http2_cipher_block_list;
|
2018-09-08 12:22:30 +02:00
|
|
|
// true if forwarding requests included in TLS early data should not
|
|
|
|
// be postponed until TLS handshake finishes.
|
|
|
|
bool no_postpone_early_data;
|
2016-01-18 06:21:09 +01:00
|
|
|
};
|
|
|
|
|
2021-08-21 12:00:43 +02:00
|
|
|
#ifdef ENABLE_HTTP3
|
2021-08-16 08:11:18 +02:00
|
|
|
struct QUICConfig {
|
2021-08-16 14:43:39 +02:00
|
|
|
struct {
|
2021-08-27 12:03:06 +02:00
|
|
|
struct {
|
|
|
|
ev_tstamp idle;
|
|
|
|
} timeout;
|
|
|
|
struct {
|
|
|
|
bool log;
|
|
|
|
} debug;
|
2021-09-06 13:06:38 +02:00
|
|
|
struct {
|
|
|
|
StringRef dir;
|
|
|
|
} qlog;
|
2021-09-13 14:35:46 +02:00
|
|
|
ngtcp2_cc_algo congestion_controller;
|
2021-09-05 14:39:45 +02:00
|
|
|
bool early_data;
|
2021-09-12 08:04:54 +02:00
|
|
|
bool require_token;
|
2021-09-21 15:46:32 +02:00
|
|
|
std::array<uint8_t, SHRPX_QUIC_SERVER_IDLEN> server_id;
|
2021-09-22 11:24:50 +02:00
|
|
|
StringRef secret_file;
|
2021-08-27 12:03:06 +02:00
|
|
|
} upstream;
|
2021-08-26 07:13:14 +02:00
|
|
|
struct {
|
|
|
|
StringRef prog_file;
|
|
|
|
bool disabled;
|
|
|
|
} bpf;
|
2021-08-16 08:11:18 +02:00
|
|
|
};
|
2021-08-27 12:57:04 +02:00
|
|
|
|
|
|
|
struct Http3Config {
|
|
|
|
struct {
|
2021-08-27 14:11:03 +02:00
|
|
|
size_t max_concurrent_streams;
|
2021-08-27 12:57:04 +02:00
|
|
|
int32_t window_size;
|
|
|
|
int32_t connection_window_size;
|
|
|
|
int32_t max_window_size;
|
|
|
|
int32_t max_connection_window_size;
|
|
|
|
} upstream;
|
|
|
|
};
|
2021-08-21 12:00:43 +02:00
|
|
|
#endif // ENABLE_HTTP3
|
2021-08-16 08:11:18 +02:00
|
|
|
|
2016-03-19 15:41:21 +01:00
|
|
|
// custom error page
|
|
|
|
struct ErrorPage {
|
|
|
|
// not NULL-terminated
|
|
|
|
std::vector<uint8_t> content;
|
2016-03-19 15:49:15 +01:00
|
|
|
// 0 is special value, and it matches all HTTP status code.
|
2016-03-19 15:41:21 +01:00
|
|
|
unsigned int http_status;
|
|
|
|
};
|
|
|
|
|
2016-01-18 09:00:20 +01:00
|
|
|
struct HttpConfig {
|
|
|
|
struct {
|
|
|
|
// obfuscated value used in "by" parameter of Forwarded header
|
|
|
|
// field. This is only used when user defined static obfuscated
|
|
|
|
// string is provided.
|
2016-10-02 14:22:02 +02:00
|
|
|
StringRef by_obfuscated;
|
2016-01-18 09:00:20 +01:00
|
|
|
// bitwise-OR of one or more of shrpx_forwarded_param values.
|
|
|
|
uint32_t params;
|
|
|
|
// type of value recorded in "by" parameter of Forwarded header
|
|
|
|
// field.
|
2018-10-16 15:54:36 +02:00
|
|
|
ForwardedNode by_node_type;
|
2016-01-18 09:00:20 +01:00
|
|
|
// type of value recorded in "for" parameter of Forwarded header
|
|
|
|
// field.
|
2018-10-16 15:54:36 +02:00
|
|
|
ForwardedNode for_node_type;
|
2016-01-18 09:00:20 +01:00
|
|
|
bool strip_incoming;
|
|
|
|
} forwarded;
|
|
|
|
struct {
|
|
|
|
bool add;
|
|
|
|
bool strip_incoming;
|
|
|
|
} xff;
|
2017-04-05 15:50:18 +02:00
|
|
|
struct {
|
|
|
|
bool add;
|
|
|
|
bool strip_incoming;
|
|
|
|
} xfp;
|
2018-09-09 15:37:22 +02:00
|
|
|
struct {
|
|
|
|
bool strip_incoming;
|
|
|
|
} early_data;
|
2016-01-18 06:21:09 +01:00
|
|
|
std::vector<AltSvc> altsvcs;
|
2021-08-26 13:59:32 +02:00
|
|
|
// altsvcs serialized in a wire format.
|
|
|
|
StringRef altsvc_header_value;
|
|
|
|
std::vector<AltSvc> http2_altsvcs;
|
|
|
|
// http2_altsvcs serialized in a wire format.
|
|
|
|
StringRef http2_altsvc_header_value;
|
2016-03-19 15:41:21 +01:00
|
|
|
std::vector<ErrorPage> error_pages;
|
2016-10-02 15:04:04 +02:00
|
|
|
HeaderRefs add_request_headers;
|
|
|
|
HeaderRefs add_response_headers;
|
2016-10-02 14:22:02 +02:00
|
|
|
StringRef server_name;
|
2017-02-18 10:23:06 +01:00
|
|
|
// Port number which appears in Location header field when https
|
|
|
|
// redirect is made.
|
|
|
|
StringRef redirect_https_port;
|
2016-02-06 09:22:23 +01:00
|
|
|
size_t request_header_field_buffer;
|
|
|
|
size_t max_request_header_fields;
|
2016-02-06 04:25:34 +01:00
|
|
|
size_t response_header_field_buffer;
|
|
|
|
size_t max_response_header_fields;
|
2017-02-20 15:36:50 +01:00
|
|
|
size_t max_requests;
|
2016-01-18 09:00:20 +01:00
|
|
|
bool no_via;
|
|
|
|
bool no_location_rewrite;
|
|
|
|
bool no_host_rewrite;
|
2016-08-31 16:47:15 +02:00
|
|
|
bool no_server_rewrite;
|
2016-01-18 09:00:20 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Http2Config {
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
struct {
|
2016-10-02 14:22:02 +02:00
|
|
|
StringRef request_header_file;
|
|
|
|
StringRef response_header_file;
|
2016-01-18 09:00:20 +01:00
|
|
|
FILE *request_header;
|
|
|
|
FILE *response_header;
|
|
|
|
} dump;
|
|
|
|
bool frame_debug;
|
|
|
|
} debug;
|
2016-05-21 07:13:57 +02:00
|
|
|
struct {
|
|
|
|
ev_tstamp settings;
|
|
|
|
} timeout;
|
2016-01-18 09:00:20 +01:00
|
|
|
nghttp2_option *option;
|
2016-06-16 16:30:35 +02:00
|
|
|
nghttp2_option *alt_mode_option;
|
2016-01-18 09:00:20 +01:00
|
|
|
nghttp2_session_callbacks *callbacks;
|
2016-09-12 15:53:02 +02:00
|
|
|
size_t max_concurrent_streams;
|
|
|
|
size_t encoder_dynamic_table_size;
|
|
|
|
size_t decoder_dynamic_table_size;
|
2016-09-09 14:05:37 +02:00
|
|
|
int32_t window_size;
|
|
|
|
int32_t connection_window_size;
|
2016-09-08 15:49:36 +02:00
|
|
|
bool optimize_write_buffer_size;
|
|
|
|
bool optimize_window_size;
|
2016-01-18 09:00:20 +01:00
|
|
|
} upstream;
|
|
|
|
struct {
|
2016-05-21 07:13:57 +02:00
|
|
|
struct {
|
|
|
|
ev_tstamp settings;
|
|
|
|
} timeout;
|
2016-01-18 09:00:20 +01:00
|
|
|
nghttp2_option *option;
|
|
|
|
nghttp2_session_callbacks *callbacks;
|
2016-09-12 15:53:02 +02:00
|
|
|
size_t encoder_dynamic_table_size;
|
|
|
|
size_t decoder_dynamic_table_size;
|
2016-09-09 14:05:37 +02:00
|
|
|
int32_t window_size;
|
|
|
|
int32_t connection_window_size;
|
2016-02-27 16:06:40 +01:00
|
|
|
size_t max_concurrent_streams;
|
2016-01-18 09:00:20 +01:00
|
|
|
} downstream;
|
2016-01-19 08:56:12 +01:00
|
|
|
struct {
|
|
|
|
ev_tstamp stream_read;
|
|
|
|
ev_tstamp stream_write;
|
|
|
|
} timeout;
|
2016-01-18 09:00:20 +01:00
|
|
|
bool no_cookie_crumbling;
|
|
|
|
bool no_server_push;
|
|
|
|
};
|
|
|
|
|
2016-01-18 09:26:27 +01:00
|
|
|
struct LoggingConfig {
|
|
|
|
struct {
|
|
|
|
std::vector<LogFragment> format;
|
2016-10-02 14:22:02 +02:00
|
|
|
StringRef file;
|
2016-01-18 09:26:27 +01:00
|
|
|
// Send accesslog to syslog, ignoring accesslog_file.
|
|
|
|
bool syslog;
|
2017-01-11 11:27:08 +01:00
|
|
|
// Write accesslog when response headers are received from
|
|
|
|
// backend, rather than response body is received and sent.
|
|
|
|
bool write_early;
|
2016-01-18 09:26:27 +01:00
|
|
|
} access;
|
|
|
|
struct {
|
2016-10-02 14:22:02 +02:00
|
|
|
StringRef file;
|
2016-01-18 09:26:27 +01:00
|
|
|
// Send errorlog to syslog, ignoring errorlog_file.
|
|
|
|
bool syslog;
|
|
|
|
} error;
|
|
|
|
int syslog_facility;
|
2019-06-05 14:13:21 +02:00
|
|
|
int severity;
|
2016-01-18 09:26:27 +01:00
|
|
|
};
|
|
|
|
|
2016-01-19 08:56:12 +01:00
|
|
|
struct RateLimitConfig {
|
|
|
|
size_t rate;
|
|
|
|
size_t burst;
|
|
|
|
};
|
|
|
|
|
2016-06-03 12:13:02 +02:00
|
|
|
// Wildcard host pattern routing. We strips left most '*' from host
|
2016-06-10 16:13:40 +02:00
|
|
|
// field. router includes all path patterns sharing the same wildcard
|
2016-06-03 12:13:02 +02:00
|
|
|
// host.
|
|
|
|
struct WildcardPattern {
|
2016-10-02 10:44:45 +02:00
|
|
|
WildcardPattern(const StringRef &host) : host(host) {}
|
2016-06-03 16:52:44 +02:00
|
|
|
|
2016-10-03 15:06:04 +02:00
|
|
|
// This might not be NULL terminated. Currently it is only used for
|
2016-10-02 10:44:45 +02:00
|
|
|
// comparison.
|
|
|
|
StringRef host;
|
2016-06-03 12:13:02 +02:00
|
|
|
Router router;
|
|
|
|
};
|
|
|
|
|
2016-06-11 11:21:37 +02:00
|
|
|
// Configuration to select backend to forward request
|
|
|
|
struct RouterConfig {
|
2016-06-03 12:13:02 +02:00
|
|
|
Router router;
|
2016-06-10 16:13:40 +02:00
|
|
|
// Router for reversed wildcard hosts. Since this router has
|
|
|
|
// wildcard hosts reversed without '*', one should call match()
|
|
|
|
// function with reversed host stripping last character. This is
|
|
|
|
// because we require at least one character must match for '*'.
|
|
|
|
// The index stored in this router is index of wildcard_patterns.
|
|
|
|
Router rev_wildcard_router;
|
2016-06-03 12:13:02 +02:00
|
|
|
std::vector<WildcardPattern> wildcard_patterns;
|
2016-06-11 11:21:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct DownstreamConfig {
|
2016-09-04 16:30:24 +02:00
|
|
|
DownstreamConfig()
|
2016-10-02 10:44:45 +02:00
|
|
|
: balloc(1024, 1024),
|
|
|
|
timeout{},
|
2016-09-04 16:30:24 +02:00
|
|
|
addr_group_catch_all{0},
|
|
|
|
connections_per_host{0},
|
|
|
|
connections_per_frontend{0},
|
|
|
|
request_buffer_size{0},
|
|
|
|
response_buffer_size{0},
|
|
|
|
family{0} {}
|
|
|
|
|
2016-10-02 10:44:45 +02:00
|
|
|
DownstreamConfig(const DownstreamConfig &) = delete;
|
|
|
|
DownstreamConfig(DownstreamConfig &&) = delete;
|
|
|
|
DownstreamConfig &operator=(const DownstreamConfig &) = delete;
|
|
|
|
DownstreamConfig &operator=(DownstreamConfig &&) = delete;
|
|
|
|
|
2016-10-03 15:06:04 +02:00
|
|
|
// Allocator to allocate memory for Downstream configuration. Since
|
|
|
|
// we may swap around DownstreamConfig in arbitrary times with API
|
|
|
|
// calls, we should use their own allocator instead of per Config
|
|
|
|
// allocator.
|
2016-10-02 10:44:45 +02:00
|
|
|
BlockAllocator balloc;
|
2016-06-11 11:21:37 +02:00
|
|
|
struct {
|
|
|
|
ev_tstamp read;
|
|
|
|
ev_tstamp write;
|
|
|
|
ev_tstamp idle_read;
|
2016-10-10 15:50:41 +02:00
|
|
|
ev_tstamp connect;
|
2016-06-21 17:13:43 +02:00
|
|
|
// The maximum backoff while checking health check for offline
|
|
|
|
// backend or while detaching failed backend from load balancing
|
|
|
|
// group temporarily.
|
|
|
|
ev_tstamp max_backoff;
|
2016-06-11 11:21:37 +02:00
|
|
|
} timeout;
|
|
|
|
RouterConfig router;
|
2016-06-03 12:13:02 +02:00
|
|
|
std::vector<DownstreamAddrGroupConfig> addr_groups;
|
|
|
|
// The index of catch-all group in downstream_addr_groups.
|
|
|
|
size_t addr_group_catch_all;
|
|
|
|
size_t connections_per_host;
|
|
|
|
size_t connections_per_frontend;
|
|
|
|
size_t request_buffer_size;
|
|
|
|
size_t response_buffer_size;
|
|
|
|
// Address family of backend connection. One of either AF_INET,
|
|
|
|
// AF_INET6 or AF_UNSPEC. This is ignored if backend connection
|
|
|
|
// is made via Unix domain socket.
|
|
|
|
int family;
|
|
|
|
};
|
|
|
|
|
2016-01-19 08:56:12 +01:00
|
|
|
struct ConnectionConfig {
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
ev_tstamp sleep;
|
|
|
|
} timeout;
|
2016-01-31 11:41:56 +01:00
|
|
|
// address of frontend acceptors
|
2016-02-07 09:51:53 +01:00
|
|
|
std::vector<UpstreamAddr> addrs;
|
2016-01-19 08:56:12 +01:00
|
|
|
int backlog;
|
|
|
|
// TCP fastopen. If this is positive, it is passed to
|
|
|
|
// setsockopt() along with TCP_FASTOPEN.
|
|
|
|
int fastopen;
|
|
|
|
} listener;
|
|
|
|
|
2021-08-21 12:00:43 +02:00
|
|
|
#ifdef ENABLE_HTTP3
|
2021-08-15 05:22:10 +02:00
|
|
|
struct {
|
|
|
|
std::vector<UpstreamAddr> addrs;
|
|
|
|
} quic_listener;
|
2021-08-21 12:00:43 +02:00
|
|
|
#endif // ENABLE_HTTP3
|
2021-08-15 05:22:10 +02:00
|
|
|
|
2016-01-19 08:56:12 +01:00
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
ev_tstamp http2_read;
|
2021-08-27 11:29:06 +02:00
|
|
|
ev_tstamp http3_read;
|
2016-01-19 08:56:12 +01:00
|
|
|
ev_tstamp read;
|
|
|
|
ev_tstamp write;
|
2016-12-23 03:01:29 +01:00
|
|
|
ev_tstamp idle_read;
|
2016-01-19 08:56:12 +01:00
|
|
|
} timeout;
|
|
|
|
struct {
|
|
|
|
RateLimitConfig read;
|
|
|
|
RateLimitConfig write;
|
|
|
|
} ratelimit;
|
|
|
|
size_t worker_connections;
|
2017-01-03 04:47:03 +01:00
|
|
|
// Deprecated. See UpstreamAddr.accept_proxy_protocol.
|
2016-01-19 08:56:12 +01:00
|
|
|
bool accept_proxy_protocol;
|
|
|
|
} upstream;
|
|
|
|
|
2016-06-03 12:13:02 +02:00
|
|
|
std::shared_ptr<DownstreamConfig> downstream;
|
2016-06-02 18:20:49 +02:00
|
|
|
};
|
|
|
|
|
2016-06-04 10:24:54 +02:00
|
|
|
struct APIConfig {
|
|
|
|
// Maximum request body size for one API request
|
|
|
|
size_t max_request_body;
|
2016-06-16 17:09:15 +02:00
|
|
|
// true if at least one of UpstreamAddr has api enabled
|
|
|
|
bool enabled;
|
2016-06-04 10:24:54 +02:00
|
|
|
};
|
|
|
|
|
2016-12-10 09:48:28 +01:00
|
|
|
struct DNSConfig {
|
|
|
|
struct {
|
|
|
|
ev_tstamp cache;
|
2016-12-10 16:50:16 +01:00
|
|
|
ev_tstamp lookup;
|
2016-12-10 09:48:28 +01:00
|
|
|
} timeout;
|
2016-12-10 16:50:16 +01:00
|
|
|
// The number of tries name resolver makes before abandoning
|
|
|
|
// request.
|
|
|
|
size_t max_try;
|
2016-12-10 09:48:28 +01:00
|
|
|
};
|
|
|
|
|
2016-06-02 18:20:49 +02:00
|
|
|
struct Config {
|
2016-10-02 14:22:02 +02:00
|
|
|
Config()
|
|
|
|
: balloc(4096, 4096),
|
|
|
|
downstream_http_proxy{},
|
|
|
|
http{},
|
|
|
|
http2{},
|
|
|
|
tls{},
|
2021-08-21 12:00:43 +02:00
|
|
|
#ifdef ENABLE_HTTP3
|
2021-08-16 08:11:18 +02:00
|
|
|
quic{},
|
2021-08-21 12:00:43 +02:00
|
|
|
#endif // ENABLE_HTTP3
|
2016-10-02 14:22:02 +02:00
|
|
|
logging{},
|
|
|
|
conn{},
|
|
|
|
api{},
|
2016-12-10 09:48:28 +01:00
|
|
|
dns{},
|
2017-02-15 15:23:48 +01:00
|
|
|
config_revision{0},
|
2016-10-02 14:22:02 +02:00
|
|
|
num_worker{0},
|
|
|
|
padding{0},
|
|
|
|
rlimit_nofile{0},
|
2021-09-24 11:01:47 +02:00
|
|
|
rlimit_memlock{0},
|
2016-10-02 14:22:02 +02:00
|
|
|
uid{0},
|
|
|
|
gid{0},
|
|
|
|
pid{0},
|
|
|
|
verbose{false},
|
|
|
|
daemon{false},
|
|
|
|
http2_proxy{false},
|
2017-04-06 12:53:39 +02:00
|
|
|
single_process{false},
|
2017-02-21 14:19:34 +01:00
|
|
|
single_thread{false},
|
2018-08-28 10:50:01 +02:00
|
|
|
ignore_per_pattern_mruby_error{false},
|
2021-08-21 12:00:43 +02:00
|
|
|
ev_loop_flags{0} {
|
|
|
|
}
|
2016-07-31 12:01:29 +02:00
|
|
|
~Config();
|
|
|
|
|
2016-08-25 15:55:12 +02:00
|
|
|
Config(Config &&) = delete;
|
|
|
|
Config(const Config &&) = delete;
|
|
|
|
Config &operator=(Config &&) = delete;
|
|
|
|
Config &operator=(const Config &&) = delete;
|
|
|
|
|
2016-10-03 15:06:04 +02:00
|
|
|
// Allocator to allocate memory for this object except for
|
|
|
|
// DownstreamConfig. Currently, it is used to allocate memory for
|
|
|
|
// strings.
|
2016-10-02 14:22:02 +02:00
|
|
|
BlockAllocator balloc;
|
2016-01-17 14:51:40 +01:00
|
|
|
HttpProxy downstream_http_proxy;
|
2016-01-18 09:00:20 +01:00
|
|
|
HttpConfig http;
|
|
|
|
Http2Config http2;
|
2016-01-18 06:21:09 +01:00
|
|
|
TLSConfig tls;
|
2021-08-21 12:00:43 +02:00
|
|
|
#ifdef ENABLE_HTTP3
|
2021-08-16 08:11:18 +02:00
|
|
|
QUICConfig quic;
|
2021-08-27 12:57:04 +02:00
|
|
|
Http3Config http3;
|
2021-08-21 12:00:43 +02:00
|
|
|
#endif // ENABLE_HTTP3
|
2016-01-18 09:26:27 +01:00
|
|
|
LoggingConfig logging;
|
2016-01-19 08:56:12 +01:00
|
|
|
ConnectionConfig conn;
|
2016-06-04 10:24:54 +02:00
|
|
|
APIConfig api;
|
2016-12-10 09:48:28 +01:00
|
|
|
DNSConfig dns;
|
2016-10-02 14:22:02 +02:00
|
|
|
StringRef pid_file;
|
|
|
|
StringRef conf_path;
|
|
|
|
StringRef user;
|
|
|
|
StringRef mruby_file;
|
2017-02-15 15:23:48 +01:00
|
|
|
// The revision of configuration which is opaque string, and changes
|
|
|
|
// on each configuration reloading. This does not change on
|
|
|
|
// backendconfig API call. This value is returned in health check
|
|
|
|
// as "nghttpx-conf-rev" response header field. The external
|
|
|
|
// program can check this value to know whether reloading has
|
|
|
|
// completed or not.
|
|
|
|
uint64_t config_revision;
|
2012-06-05 18:26:04 +02:00
|
|
|
size_t num_worker;
|
2014-02-11 09:23:22 +01:00
|
|
|
size_t padding;
|
2015-01-10 15:17:48 +01:00
|
|
|
size_t rlimit_nofile;
|
2021-09-24 11:01:47 +02:00
|
|
|
size_t rlimit_memlock;
|
2013-12-06 15:17:38 +01:00
|
|
|
uid_t uid;
|
|
|
|
gid_t gid;
|
2014-11-24 06:34:43 +01:00
|
|
|
pid_t pid;
|
2013-12-06 15:17:38 +01:00
|
|
|
bool verbose;
|
|
|
|
bool daemon;
|
2013-11-04 10:14:05 +01:00
|
|
|
bool http2_proxy;
|
2017-04-06 12:53:39 +02:00
|
|
|
// Run nghttpx in single process mode. With this mode, signal
|
|
|
|
// handling is omitted.
|
|
|
|
bool single_process;
|
2017-02-21 14:19:34 +01:00
|
|
|
bool single_thread;
|
2018-08-28 10:50:01 +02:00
|
|
|
// Ignore mruby compile error for per-pattern mruby script.
|
|
|
|
bool ignore_per_pattern_mruby_error;
|
2016-05-06 16:10:09 +02:00
|
|
|
// flags passed to ev_default_loop() and ev_loop_new()
|
|
|
|
int ev_loop_flags;
|
2012-06-04 16:48:31 +02:00
|
|
|
};
|
|
|
|
|
2014-11-27 15:39:04 +01:00
|
|
|
const Config *get_config();
|
|
|
|
Config *mod_config();
|
2016-07-31 08:57:41 +02:00
|
|
|
// Replaces the current config with given |new_config|. The old config is
|
|
|
|
// returned.
|
2016-07-31 12:01:29 +02:00
|
|
|
std::unique_ptr<Config> replace_config(std::unique_ptr<Config> new_config);
|
2012-06-04 16:48:31 +02:00
|
|
|
void create_config();
|
|
|
|
|
2016-06-04 10:41:06 +02:00
|
|
|
// generated by gennghttpxfun.py
|
|
|
|
enum {
|
|
|
|
SHRPX_OPTID_ACCEPT_PROXY_PROTOCOL,
|
|
|
|
SHRPX_OPTID_ACCESSLOG_FILE,
|
|
|
|
SHRPX_OPTID_ACCESSLOG_FORMAT,
|
|
|
|
SHRPX_OPTID_ACCESSLOG_SYSLOG,
|
2017-01-11 11:27:08 +01:00
|
|
|
SHRPX_OPTID_ACCESSLOG_WRITE_EARLY,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_ADD_FORWARDED,
|
|
|
|
SHRPX_OPTID_ADD_REQUEST_HEADER,
|
|
|
|
SHRPX_OPTID_ADD_RESPONSE_HEADER,
|
|
|
|
SHRPX_OPTID_ADD_X_FORWARDED_FOR,
|
|
|
|
SHRPX_OPTID_ALTSVC,
|
|
|
|
SHRPX_OPTID_API_MAX_REQUEST_BODY,
|
|
|
|
SHRPX_OPTID_BACKEND,
|
|
|
|
SHRPX_OPTID_BACKEND_ADDRESS_FAMILY,
|
2016-10-10 15:50:41 +02:00
|
|
|
SHRPX_OPTID_BACKEND_CONNECT_TIMEOUT,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_BACKEND_CONNECTIONS_PER_FRONTEND,
|
|
|
|
SHRPX_OPTID_BACKEND_CONNECTIONS_PER_HOST,
|
|
|
|
SHRPX_OPTID_BACKEND_HTTP_PROXY_URI,
|
|
|
|
SHRPX_OPTID_BACKEND_HTTP1_CONNECTIONS_PER_FRONTEND,
|
|
|
|
SHRPX_OPTID_BACKEND_HTTP1_CONNECTIONS_PER_HOST,
|
|
|
|
SHRPX_OPTID_BACKEND_HTTP1_TLS,
|
|
|
|
SHRPX_OPTID_BACKEND_HTTP2_CONNECTION_WINDOW_BITS,
|
2016-09-09 14:05:37 +02:00
|
|
|
SHRPX_OPTID_BACKEND_HTTP2_CONNECTION_WINDOW_SIZE,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_BACKEND_HTTP2_CONNECTIONS_PER_WORKER,
|
2016-09-12 15:53:02 +02:00
|
|
|
SHRPX_OPTID_BACKEND_HTTP2_DECODER_DYNAMIC_TABLE_SIZE,
|
|
|
|
SHRPX_OPTID_BACKEND_HTTP2_ENCODER_DYNAMIC_TABLE_SIZE,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_BACKEND_HTTP2_MAX_CONCURRENT_STREAMS,
|
|
|
|
SHRPX_OPTID_BACKEND_HTTP2_SETTINGS_TIMEOUT,
|
|
|
|
SHRPX_OPTID_BACKEND_HTTP2_WINDOW_BITS,
|
2016-09-09 14:05:37 +02:00
|
|
|
SHRPX_OPTID_BACKEND_HTTP2_WINDOW_SIZE,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_BACKEND_IPV4,
|
|
|
|
SHRPX_OPTID_BACKEND_IPV6,
|
|
|
|
SHRPX_OPTID_BACKEND_KEEP_ALIVE_TIMEOUT,
|
2016-06-21 17:13:43 +02:00
|
|
|
SHRPX_OPTID_BACKEND_MAX_BACKOFF,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_BACKEND_NO_TLS,
|
|
|
|
SHRPX_OPTID_BACKEND_READ_TIMEOUT,
|
|
|
|
SHRPX_OPTID_BACKEND_REQUEST_BUFFER,
|
|
|
|
SHRPX_OPTID_BACKEND_RESPONSE_BUFFER,
|
|
|
|
SHRPX_OPTID_BACKEND_TLS,
|
|
|
|
SHRPX_OPTID_BACKEND_TLS_SNI_FIELD,
|
|
|
|
SHRPX_OPTID_BACKEND_WRITE_TIMEOUT,
|
|
|
|
SHRPX_OPTID_BACKLOG,
|
|
|
|
SHRPX_OPTID_CACERT,
|
|
|
|
SHRPX_OPTID_CERTIFICATE_FILE,
|
|
|
|
SHRPX_OPTID_CIPHERS,
|
|
|
|
SHRPX_OPTID_CLIENT,
|
|
|
|
SHRPX_OPTID_CLIENT_CERT_FILE,
|
2017-01-08 14:40:58 +01:00
|
|
|
SHRPX_OPTID_CLIENT_CIPHERS,
|
2017-01-08 14:33:19 +01:00
|
|
|
SHRPX_OPTID_CLIENT_NO_HTTP2_CIPHER_BLACK_LIST,
|
2021-04-02 15:31:15 +02:00
|
|
|
SHRPX_OPTID_CLIENT_NO_HTTP2_CIPHER_BLOCK_LIST,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_CLIENT_PRIVATE_KEY_FILE,
|
|
|
|
SHRPX_OPTID_CLIENT_PROXY,
|
2017-01-07 16:24:33 +01:00
|
|
|
SHRPX_OPTID_CLIENT_PSK_SECRETS,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_CONF,
|
|
|
|
SHRPX_OPTID_DAEMON,
|
|
|
|
SHRPX_OPTID_DH_PARAM_FILE,
|
2016-12-10 09:48:28 +01:00
|
|
|
SHRPX_OPTID_DNS_CACHE_TIMEOUT,
|
2016-12-10 16:50:16 +01:00
|
|
|
SHRPX_OPTID_DNS_LOOKUP_TIMEOUT,
|
|
|
|
SHRPX_OPTID_DNS_MAX_TRY,
|
2016-10-08 03:50:28 +02:00
|
|
|
SHRPX_OPTID_ECDH_CURVES,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_ERROR_PAGE,
|
|
|
|
SHRPX_OPTID_ERRORLOG_FILE,
|
|
|
|
SHRPX_OPTID_ERRORLOG_SYSLOG,
|
|
|
|
SHRPX_OPTID_FASTOPEN,
|
|
|
|
SHRPX_OPTID_FETCH_OCSP_RESPONSE_FILE,
|
|
|
|
SHRPX_OPTID_FORWARDED_BY,
|
|
|
|
SHRPX_OPTID_FORWARDED_FOR,
|
|
|
|
SHRPX_OPTID_FRONTEND,
|
|
|
|
SHRPX_OPTID_FRONTEND_FRAME_DEBUG,
|
|
|
|
SHRPX_OPTID_FRONTEND_HTTP2_CONNECTION_WINDOW_BITS,
|
2016-09-09 14:05:37 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_HTTP2_CONNECTION_WINDOW_SIZE,
|
2016-09-12 15:53:02 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_HTTP2_DECODER_DYNAMIC_TABLE_SIZE,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_HTTP2_DUMP_REQUEST_HEADER,
|
|
|
|
SHRPX_OPTID_FRONTEND_HTTP2_DUMP_RESPONSE_HEADER,
|
2016-09-12 15:53:02 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_HTTP2_ENCODER_DYNAMIC_TABLE_SIZE,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_HTTP2_MAX_CONCURRENT_STREAMS,
|
2016-09-08 15:49:36 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_HTTP2_OPTIMIZE_WINDOW_SIZE,
|
|
|
|
SHRPX_OPTID_FRONTEND_HTTP2_OPTIMIZE_WRITE_BUFFER_SIZE,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_HTTP2_READ_TIMEOUT,
|
|
|
|
SHRPX_OPTID_FRONTEND_HTTP2_SETTINGS_TIMEOUT,
|
|
|
|
SHRPX_OPTID_FRONTEND_HTTP2_WINDOW_BITS,
|
2016-09-09 14:05:37 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_HTTP2_WINDOW_SIZE,
|
2021-08-27 12:57:04 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_HTTP3_CONNECTION_WINDOW_SIZE,
|
2021-08-27 14:11:03 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_HTTP3_MAX_CONCURRENT_STREAMS,
|
2021-08-27 12:57:04 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_HTTP3_MAX_CONNECTION_WINDOW_SIZE,
|
|
|
|
SHRPX_OPTID_FRONTEND_HTTP3_MAX_WINDOW_SIZE,
|
2021-08-27 11:29:06 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_HTTP3_READ_TIMEOUT,
|
2021-08-27 12:57:04 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_HTTP3_WINDOW_SIZE,
|
2016-12-23 03:01:29 +01:00
|
|
|
SHRPX_OPTID_FRONTEND_KEEP_ALIVE_TIMEOUT,
|
2017-02-20 15:36:50 +01:00
|
|
|
SHRPX_OPTID_FRONTEND_MAX_REQUESTS,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_NO_TLS,
|
2021-09-13 14:35:46 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_QUIC_CONGESTION_CONTROLLER,
|
2021-08-27 12:16:25 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_QUIC_DEBUG_LOG,
|
2021-09-05 14:39:45 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_QUIC_EARLY_DATA,
|
2021-08-27 12:03:06 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_QUIC_IDLE_TIMEOUT,
|
2021-09-06 13:06:38 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_QUIC_QLOG_DIR,
|
2021-09-12 08:04:54 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_QUIC_REQUIRE_TOKEN,
|
2021-09-22 11:24:50 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_QUIC_SECRET_FILE,
|
2021-09-21 15:46:32 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_QUIC_SERVER_ID,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_FRONTEND_READ_TIMEOUT,
|
|
|
|
SHRPX_OPTID_FRONTEND_WRITE_TIMEOUT,
|
|
|
|
SHRPX_OPTID_HEADER_FIELD_BUFFER,
|
|
|
|
SHRPX_OPTID_HOST_REWRITE,
|
2021-08-26 13:59:32 +02:00
|
|
|
SHRPX_OPTID_HTTP2_ALTSVC,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_HTTP2_BRIDGE,
|
|
|
|
SHRPX_OPTID_HTTP2_MAX_CONCURRENT_STREAMS,
|
|
|
|
SHRPX_OPTID_HTTP2_NO_COOKIE_CRUMBLING,
|
|
|
|
SHRPX_OPTID_HTTP2_PROXY,
|
2018-08-28 10:50:01 +02:00
|
|
|
SHRPX_OPTID_IGNORE_PER_PATTERN_MRUBY_ERROR,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_INCLUDE,
|
|
|
|
SHRPX_OPTID_INSECURE,
|
|
|
|
SHRPX_OPTID_LISTENER_DISABLE_TIMEOUT,
|
|
|
|
SHRPX_OPTID_LOG_LEVEL,
|
|
|
|
SHRPX_OPTID_MAX_HEADER_FIELDS,
|
|
|
|
SHRPX_OPTID_MAX_REQUEST_HEADER_FIELDS,
|
|
|
|
SHRPX_OPTID_MAX_RESPONSE_HEADER_FIELDS,
|
|
|
|
SHRPX_OPTID_MRUBY_FILE,
|
2017-04-05 15:50:18 +02:00
|
|
|
SHRPX_OPTID_NO_ADD_X_FORWARDED_PROTO,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_NO_HOST_REWRITE,
|
|
|
|
SHRPX_OPTID_NO_HTTP2_CIPHER_BLACK_LIST,
|
2021-04-02 15:31:15 +02:00
|
|
|
SHRPX_OPTID_NO_HTTP2_CIPHER_BLOCK_LIST,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_NO_KQUEUE,
|
|
|
|
SHRPX_OPTID_NO_LOCATION_REWRITE,
|
|
|
|
SHRPX_OPTID_NO_OCSP,
|
2021-08-27 14:34:18 +02:00
|
|
|
SHRPX_OPTID_NO_QUIC_BPF,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_NO_SERVER_PUSH,
|
2016-08-31 16:47:15 +02:00
|
|
|
SHRPX_OPTID_NO_SERVER_REWRITE,
|
2018-09-09 15:37:22 +02:00
|
|
|
SHRPX_OPTID_NO_STRIP_INCOMING_EARLY_DATA,
|
2017-04-05 15:50:18 +02:00
|
|
|
SHRPX_OPTID_NO_STRIP_INCOMING_X_FORWARDED_PROTO,
|
2017-05-25 15:12:54 +02:00
|
|
|
SHRPX_OPTID_NO_VERIFY_OCSP,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_NO_VIA,
|
|
|
|
SHRPX_OPTID_NPN_LIST,
|
2017-05-18 14:11:10 +02:00
|
|
|
SHRPX_OPTID_OCSP_STARTUP,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_OCSP_UPDATE_INTERVAL,
|
|
|
|
SHRPX_OPTID_PADDING,
|
|
|
|
SHRPX_OPTID_PID_FILE,
|
|
|
|
SHRPX_OPTID_PRIVATE_KEY_FILE,
|
|
|
|
SHRPX_OPTID_PRIVATE_KEY_PASSWD_FILE,
|
2017-01-07 15:42:51 +01:00
|
|
|
SHRPX_OPTID_PSK_SECRETS,
|
2021-08-27 14:34:18 +02:00
|
|
|
SHRPX_OPTID_QUIC_BPF_PROGRAM_FILE,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_READ_BURST,
|
|
|
|
SHRPX_OPTID_READ_RATE,
|
2017-02-18 10:23:06 +01:00
|
|
|
SHRPX_OPTID_REDIRECT_HTTPS_PORT,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_REQUEST_HEADER_FIELD_BUFFER,
|
|
|
|
SHRPX_OPTID_RESPONSE_HEADER_FIELD_BUFFER,
|
2021-09-24 11:01:47 +02:00
|
|
|
SHRPX_OPTID_RLIMIT_MEMLOCK,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_RLIMIT_NOFILE,
|
2016-08-26 15:28:09 +02:00
|
|
|
SHRPX_OPTID_SERVER_NAME,
|
2017-04-06 12:53:39 +02:00
|
|
|
SHRPX_OPTID_SINGLE_PROCESS,
|
2017-02-21 14:19:34 +01:00
|
|
|
SHRPX_OPTID_SINGLE_THREAD,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_STREAM_READ_TIMEOUT,
|
|
|
|
SHRPX_OPTID_STREAM_WRITE_TIMEOUT,
|
|
|
|
SHRPX_OPTID_STRIP_INCOMING_FORWARDED,
|
|
|
|
SHRPX_OPTID_STRIP_INCOMING_X_FORWARDED_FOR,
|
|
|
|
SHRPX_OPTID_SUBCERT,
|
|
|
|
SHRPX_OPTID_SYSLOG_FACILITY,
|
|
|
|
SHRPX_OPTID_TLS_DYN_REC_IDLE_TIMEOUT,
|
|
|
|
SHRPX_OPTID_TLS_DYN_REC_WARMUP_THRESHOLD,
|
2018-05-20 15:54:59 +02:00
|
|
|
SHRPX_OPTID_TLS_MAX_EARLY_DATA,
|
2017-02-13 15:34:45 +01:00
|
|
|
SHRPX_OPTID_TLS_MAX_PROTO_VERSION,
|
|
|
|
SHRPX_OPTID_TLS_MIN_PROTO_VERSION,
|
2018-09-08 12:22:30 +02:00
|
|
|
SHRPX_OPTID_TLS_NO_POSTPONE_EARLY_DATA,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_TLS_PROTO_LIST,
|
2016-10-08 12:03:21 +02:00
|
|
|
SHRPX_OPTID_TLS_SCT_DIR,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED,
|
|
|
|
SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED_ADDRESS_FAMILY,
|
|
|
|
SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED_CERT_FILE,
|
|
|
|
SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED_PRIVATE_KEY_FILE,
|
|
|
|
SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED_TLS,
|
|
|
|
SHRPX_OPTID_TLS_TICKET_KEY_CIPHER,
|
|
|
|
SHRPX_OPTID_TLS_TICKET_KEY_FILE,
|
|
|
|
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED,
|
|
|
|
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_ADDRESS_FAMILY,
|
|
|
|
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_CERT_FILE,
|
|
|
|
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_INTERVAL,
|
|
|
|
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_MAX_FAIL,
|
|
|
|
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_MAX_RETRY,
|
|
|
|
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_PRIVATE_KEY_FILE,
|
|
|
|
SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_TLS,
|
2018-09-09 09:32:34 +02:00
|
|
|
SHRPX_OPTID_TLS13_CIPHERS,
|
|
|
|
SHRPX_OPTID_TLS13_CLIENT_CIPHERS,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_USER,
|
|
|
|
SHRPX_OPTID_VERIFY_CLIENT,
|
|
|
|
SHRPX_OPTID_VERIFY_CLIENT_CACERT,
|
2018-02-08 08:51:23 +01:00
|
|
|
SHRPX_OPTID_VERIFY_CLIENT_TOLERATE_EXPIRED,
|
2016-06-04 10:41:06 +02:00
|
|
|
SHRPX_OPTID_WORKER_FRONTEND_CONNECTIONS,
|
|
|
|
SHRPX_OPTID_WORKER_READ_BURST,
|
|
|
|
SHRPX_OPTID_WORKER_READ_RATE,
|
|
|
|
SHRPX_OPTID_WORKER_WRITE_BURST,
|
|
|
|
SHRPX_OPTID_WORKER_WRITE_RATE,
|
|
|
|
SHRPX_OPTID_WORKERS,
|
|
|
|
SHRPX_OPTID_WRITE_BURST,
|
|
|
|
SHRPX_OPTID_WRITE_RATE,
|
|
|
|
SHRPX_OPTID_MAXIDX,
|
|
|
|
};
|
|
|
|
|
|
|
|
// Looks up token for given option name |name| of length |namelen|.
|
|
|
|
int option_lookup_token(const char *name, size_t namelen);
|
|
|
|
|
2012-08-01 17:06:41 +02:00
|
|
|
// Parses option name |opt| and value |optarg|. The results are
|
2016-06-02 16:59:59 +02:00
|
|
|
// stored into the object pointed by |config|. This function returns 0
|
|
|
|
// if it succeeds, or -1. The |included_set| contains the all paths
|
|
|
|
// already included while processing this configuration, to avoid loop
|
2017-11-30 16:28:36 +01:00
|
|
|
// in --include option. The |pattern_addr_indexer| contains a pair of
|
|
|
|
// pattern of backend, and its index in DownstreamConfig::addr_groups.
|
|
|
|
// It is introduced to speed up loading configuration file with lots
|
|
|
|
// of backends.
|
2016-06-02 16:59:59 +02:00
|
|
|
int parse_config(Config *config, const StringRef &opt, const StringRef &optarg,
|
2017-11-30 16:28:36 +01:00
|
|
|
std::set<StringRef> &included_set,
|
|
|
|
std::map<StringRef, size_t> &pattern_addr_indexer);
|
2012-08-01 17:06:41 +02:00
|
|
|
|
2016-06-04 10:41:06 +02:00
|
|
|
// Similar to parse_config() above, but additional |optid| which
|
|
|
|
// should be the return value of option_lookup_token(opt).
|
|
|
|
int parse_config(Config *config, int optid, const StringRef &opt,
|
2017-11-30 16:28:36 +01:00
|
|
|
const StringRef &optarg, std::set<StringRef> &included_set,
|
|
|
|
std::map<StringRef, size_t> &pattern_addr_indexer);
|
2016-06-04 10:41:06 +02:00
|
|
|
|
2016-07-31 08:57:41 +02:00
|
|
|
// Loads configurations from |filename| and stores them in |config|.
|
|
|
|
// This function returns 0 if it succeeds, or -1. See parse_config()
|
|
|
|
// for |include_set|.
|
|
|
|
int load_config(Config *config, const char *filename,
|
2017-11-30 16:28:36 +01:00
|
|
|
std::set<StringRef> &include_set,
|
|
|
|
std::map<StringRef, size_t> &pattern_addr_indexer);
|
2012-12-03 07:33:04 +01:00
|
|
|
|
2014-04-26 07:56:08 +02:00
|
|
|
// Parses header field in |optarg|. We expect header field is formed
|
|
|
|
// like "NAME: VALUE". We require that NAME is non empty string. ":"
|
|
|
|
// is allowed at the start of the NAME, but NAME == ":" is not
|
|
|
|
// allowed. This function returns pair of NAME and VALUE.
|
2016-10-02 15:04:04 +02:00
|
|
|
HeaderRefs::value_type parse_header(BlockAllocator &balloc,
|
|
|
|
const StringRef &optarg);
|
2014-04-26 07:56:08 +02:00
|
|
|
|
2016-10-02 14:22:02 +02:00
|
|
|
std::vector<LogFragment> parse_log_format(BlockAllocator &balloc,
|
|
|
|
const StringRef &optarg);
|
2014-11-18 16:56:44 +01:00
|
|
|
|
2012-08-01 18:20:18 +02:00
|
|
|
// Returns string for syslog |facility|.
|
2016-03-24 13:05:02 +01:00
|
|
|
StringRef str_syslog_facility(int facility);
|
2012-08-01 18:20:18 +02:00
|
|
|
|
|
|
|
// Returns integer value of syslog |facility| string.
|
2016-03-24 13:05:02 +01:00
|
|
|
int int_syslog_facility(const StringRef &strfacility);
|
2012-08-01 18:20:18 +02:00
|
|
|
|
2014-11-27 15:39:04 +01:00
|
|
|
FILE *open_file_for_write(const char *filename);
|
2014-08-12 18:53:44 +02:00
|
|
|
|
2015-01-07 17:26:30 +01:00
|
|
|
// Reads TLS ticket key file in |files| and returns TicketKey which
|
2015-07-17 18:49:20 +02:00
|
|
|
// stores read key data. The given |cipher| and |hmac| determine the
|
|
|
|
// expected file size. This function returns TicketKey if it
|
2015-01-07 17:26:30 +01:00
|
|
|
// succeeds, or nullptr.
|
|
|
|
std::unique_ptr<TicketKeys>
|
2016-10-02 15:08:51 +02:00
|
|
|
read_tls_ticket_key_file(const std::vector<StringRef> &files,
|
2015-07-17 18:49:20 +02:00
|
|
|
const EVP_CIPHER *cipher, const EVP_MD *hmac);
|
2015-01-07 17:26:30 +01:00
|
|
|
|
2021-09-22 11:24:50 +02:00
|
|
|
#ifdef ENABLE_HTTP3
|
|
|
|
std::shared_ptr<QUICKeyingMaterials>
|
|
|
|
read_quic_secret_file(const StringRef &path);
|
|
|
|
#endif // ENABLE_HTTP3
|
|
|
|
|
2016-02-28 13:35:26 +01:00
|
|
|
// Returns string representation of |proto|.
|
2018-10-16 15:17:37 +02:00
|
|
|
StringRef strproto(Proto proto);
|
2016-02-28 13:35:26 +01:00
|
|
|
|
2016-06-02 17:22:55 +02:00
|
|
|
int configure_downstream_group(Config *config, bool http2_proxy,
|
|
|
|
bool numeric_addr_only,
|
|
|
|
const TLSConfig &tlsconf);
|
|
|
|
|
|
|
|
int resolve_hostname(Address *addr, const char *hostname, uint16_t port,
|
|
|
|
int family, int additional_flags = 0);
|
|
|
|
|
2012-06-04 16:48:31 +02:00
|
|
|
} // namespace shrpx
|
|
|
|
|
|
|
|
#endif // SHRPX_CONFIG_H
|