clang-format-5.0

This commit is contained in:
Tatsuhiro Tsujikawa 2017-11-23 14:19:12 +09:00
parent fee3151fd2
commit ff200bfcf3
33 changed files with 167 additions and 154 deletions

View File

@ -70,7 +70,9 @@
#define NGHTTP2_MAX_PADLEN 256
/* Union of extension frame payload */
typedef union { nghttp2_ext_altsvc altsvc; } nghttp2_ext_frame_payload;
typedef union {
nghttp2_ext_altsvc altsvc;
} nghttp2_ext_frame_payload;
void nghttp2_frame_pack_frame_hd(uint8_t *buf, const nghttp2_frame_hd *hd);

View File

@ -211,7 +211,9 @@ typedef struct {
#define HD_MAP_SIZE 128
typedef struct { nghttp2_hd_entry *table[HD_MAP_SIZE]; } nghttp2_hd_map;
typedef struct {
nghttp2_hd_entry *table[HD_MAP_SIZE];
} nghttp2_hd_map;
struct nghttp2_hd_deflater {
nghttp2_hd_context ctx;

View File

@ -35,7 +35,9 @@
/* Implementation of priority queue */
typedef struct { size_t index; } nghttp2_pq_entry;
typedef struct {
size_t index;
} nghttp2_pq_entry;
typedef struct {
/* The pointer to the pointer to the item stored */

View File

@ -36,7 +36,9 @@ typedef struct nghttp2_queue_cell {
struct nghttp2_queue_cell *next;
} nghttp2_queue_cell;
typedef struct { nghttp2_queue_cell *front, *back; } nghttp2_queue;
typedef struct {
nghttp2_queue_cell *front, *back;
} nghttp2_queue;
void nghttp2_queue_init(nghttp2_queue *queue);
void nghttp2_queue_free(nghttp2_queue *queue);

View File

@ -548,9 +548,8 @@ static int session_new(nghttp2_session **session_ptr,
if (nghttp2_enable_strict_preface) {
nghttp2_inbound_frame *iframe = &(*session_ptr)->iframe;
if (server &&
((*session_ptr)->opt_flags & NGHTTP2_OPTMASK_NO_RECV_CLIENT_MAGIC) ==
0) {
if (server && ((*session_ptr)->opt_flags &
NGHTTP2_OPTMASK_NO_RECV_CLIENT_MAGIC) == 0) {
iframe->state = NGHTTP2_IB_READ_CLIENT_MAGIC;
iframe->payloadleft = NGHTTP2_CLIENT_MAGIC_LEN;
} else {
@ -5602,8 +5601,8 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
iframe->max_niv =
iframe->frame.hd.length / NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH + 1;
iframe->iv = nghttp2_mem_malloc(
mem, sizeof(nghttp2_settings_entry) * iframe->max_niv);
iframe->iv = nghttp2_mem_malloc(mem, sizeof(nghttp2_settings_entry) *
iframe->max_niv);
if (!iframe->iv) {
return NGHTTP2_ERR_NOMEM;

View File

@ -366,8 +366,9 @@ static void check_queued(nghttp2_stream *stream) {
}
}
if (queued == 0) {
fprintf(stderr, "stream(%p)=%d, stream->queued == 1, and "
"!stream_active(), but no descendants is queued\n",
fprintf(stderr,
"stream(%p)=%d, stream->queued == 1, and "
"!stream_active(), but no descendants is queued\n",
stream, stream->stream_id);
assert(0);
}
@ -378,9 +379,10 @@ static void check_queued(nghttp2_stream *stream) {
}
} else {
if (stream_active(stream) || !nghttp2_pq_empty(&stream->obq)) {
fprintf(stderr, "stream(%p) = %d, stream->queued == 0, but "
"stream_active(stream) == %d and "
"nghttp2_pq_size(&stream->obq) = %zu\n",
fprintf(stderr,
"stream(%p) = %d, stream->queued == 0, but "
"stream_active(stream) == %d and "
"nghttp2_pq_size(&stream->obq) = %zu\n",
stream, stream->stream_id, stream_active(stream),
nghttp2_pq_size(&stream->obq));
assert(0);

View File

@ -2156,7 +2156,7 @@ int HttpServer::run() {
}
SSL_CTX_set_tmp_ecdh(ssl_ctx, ecdh);
EC_KEY_free(ecdh);
// #endif // OPENSSL_VERSION_NUBMER < 0x10002000L
// #endif // OPENSSL_VERSION_NUBMER < 0x10002000L
#endif // OPENSSL_NO_EC

View File

@ -273,6 +273,6 @@ ByteRef make_byte_ref(BlockAllocator &alloc, size_t size) {
return {dst, size};
}
} // namespace aria2
} // namespace nghttp2
#endif // ALLOCATOR_H

View File

@ -155,7 +155,7 @@ void print_nv(nghttp2_nv *nva, size_t nvlen) {
print_nv(nva);
}
}
} // namelen
} // namespace
void print_timer() {
auto millis = get_timer();
@ -327,8 +327,9 @@ void print_frame(print_type ptype, const nghttp2_frame *frame) {
break;
case NGHTTP2_GOAWAY:
print_frame_attr_indent();
fprintf(outfile, "(last_stream_id=%d, error_code=%s(0x%02x), "
"opaque_data(%u)=[%s])\n",
fprintf(outfile,
"(last_stream_id=%d, error_code=%s(0x%02x), "
"opaque_data(%u)=[%s])\n",
frame->goaway.last_stream_id,
nghttp2_http2_strerror(frame->goaway.error_code),
frame->goaway.error_code,

View File

@ -140,4 +140,4 @@ const bool priority_spec::valid() const { return valid_; }
} // namespace client
} // namespace asio_http2
} // nghttp2
} // namespace nghttp2

View File

@ -756,4 +756,4 @@ void session_impl::read_timeout(const boost::posix_time::time_duration &t) {
} // namespace client
} // namespace asio_http2
} // nghttp2
} // namespace nghttp2

View File

@ -45,8 +45,9 @@ session_tls_impl::~session_tls_impl() {}
void session_tls_impl::start_connect(tcp::resolver::iterator endpoint_it) {
auto self = std::static_pointer_cast<session_tls_impl>(shared_from_this());
boost::asio::async_connect(
socket(), endpoint_it, [self](const boost::system::error_code &ec,
tcp::resolver::iterator endpoint_it) {
socket(), endpoint_it,
[self](const boost::system::error_code &ec,
tcp::resolver::iterator endpoint_it) {
if (self->stopped()) {
return;
}

View File

@ -169,6 +169,6 @@ private:
} // namespace server
} // namespace asio_http2
} // namespace nghttp
} // namespace nghttp2
#endif // ASIO_SERVER_HTTP2_HANDLER_H

View File

@ -1828,12 +1828,10 @@ Options:
-c, --clients=<N>
Number of concurrent clients. With -r option, this
specifies the maximum number of connections to be made.
Default: )"
<< config.nclients << R"(
Default: )" << config.nclients << R"(
-t, --threads=<N>
Number of native threads.
Default: )"
<< config.nthreads << R"(
Default: )" << config.nthreads << R"(
-i, --input-file=<PATH>
Path of a file with multiple URIs are separated by EOLs.
This option will disable URIs getting from command-line.
@ -1859,8 +1857,7 @@ Options:
(2**<N>)-1. For SPDY, if <N> is strictly less than 16,
this option is ignored. Otherwise 2**<N> is used for
SPDY.
Default: )"
<< config.connection_window_bits << R"(
Default: )" << config.connection_window_bits << R"(
-H, --header=<HEADER>
Add/Override a header to the requests.
--ciphers=<SUITE>
@ -1880,8 +1877,7 @@ Options:
Available protocols: )";
#endif // !HAVE_SPDYLAY
out << NGHTTP2_CLEARTEXT_PROTO_VERSION_ID << R"( and
)"
<< NGHTTP2_H1_1 << R"(
)" << NGHTTP2_H1_1 << R"(
Default: )"
<< NGHTTP2_CLEARTEXT_PROTO_VERSION_ID << R"(
-d, --data=<PATH>
@ -1964,8 +1960,7 @@ Options:
NPN. The parameter must be delimited by a single comma
only and any white spaces are treated as a part of
protocol string.
Default: )"
<< DEFAULT_NPN_LIST << R"(
Default: )" << DEFAULT_NPN_LIST << R"(
--h1 Short hand for --npn-list=http/1.1
--no-tls-proto=http/1.1, which effectively force
http/1.1 for both http and https URI.
@ -1993,8 +1988,7 @@ Options:
The <DURATION> argument is an integer and an optional unit (e.g., 1s
is 1 second and 500ms is 500 milliseconds). Units are h, m, s or ms
(hours, minutes, seconds and milliseconds, respectively). If a unit
is omitted, a second is used as unit.)"
<< std::endl;
is omitted, a second is used as unit.)" << std::endl;
}
} // namespace
@ -2762,14 +2756,14 @@ int main(int argc, char **argv) {
finished in )"
<< util::format_duration(duration) << ", " << rps << " req/s, "
<< util::utos_funit(bps) << R"(B/s
requests: )" << stats.req_todo
<< " total, " << stats.req_started << " started, " << stats.req_done
<< " done, " << stats.req_status_success << " succeeded, "
<< stats.req_failed << " failed, " << stats.req_error
<< " errored, " << stats.req_timedout << R"( timeout
status codes: )"
<< stats.status[2] << " 2xx, " << stats.status[3] << " 3xx, "
<< stats.status[4] << " 4xx, " << stats.status[5] << R"( 5xx
requests: )" << stats.req_todo << " total, "
<< stats.req_started << " started, " << stats.req_done << " done, "
<< stats.req_status_success << " succeeded, " << stats.req_failed
<< " failed, " << stats.req_error << " errored, "
<< stats.req_timedout << R"( timeout
status codes: )" << stats.status[2] << " 2xx, "
<< stats.status[3] << " 3xx, " << stats.status[4] << " 4xx, "
<< stats.status[5] << R"( 5xx
traffic: )" << util::utos_funit(stats.bytes_total)
<< "B (" << stats.bytes_total << ") total, "
<< util::utos_funit(stats.bytes_head) << "B (" << stats.bytes_head
@ -2777,12 +2771,12 @@ traffic: )" << util::utos_funit(stats.bytes_total)
<< "%), " << util::utos_funit(stats.bytes_body) << "B ("
<< stats.bytes_body << R"() data
min max mean sd +/- sd
time for request: )"
<< std::setw(10) << util::format_duration(ts.request.min) << " "
<< std::setw(10) << util::format_duration(ts.request.max) << " "
<< std::setw(10) << util::format_duration(ts.request.mean) << " "
<< std::setw(10) << util::format_duration(ts.request.sd)
<< std::setw(9) << util::dtos(ts.request.within_sd) << "%"
time for request: )" << std::setw(10)
<< util::format_duration(ts.request.min) << " " << std::setw(10)
<< util::format_duration(ts.request.max) << " " << std::setw(10)
<< util::format_duration(ts.request.mean) << " " << std::setw(10)
<< util::format_duration(ts.request.sd) << std::setw(9)
<< util::dtos(ts.request.within_sd) << "%"
<< "\ntime for connect: " << std::setw(10)
<< util::format_duration(ts.connect.min) << " " << std::setw(10)
<< util::format_duration(ts.connect.max) << " " << std::setw(10)

View File

@ -1624,9 +1624,9 @@ StringRef path_join(BlockAllocator &balloc, const StringRef &base_path,
const StringRef &base_query, const StringRef &rel_path,
const StringRef &rel_query) {
auto res = make_byte_ref(
balloc,
std::max(static_cast<size_t>(1), base_path.size()) + rel_path.size() + 1 +
std::max(base_query.size(), rel_query.size()) + 1);
balloc, std::max(static_cast<size_t>(1), base_path.size()) +
rel_path.size() + 1 +
std::max(base_query.size(), rel_query.size()) + 1);
auto p = res.base;
if (rel_path.empty()) {

View File

@ -48,7 +48,9 @@
namespace nghttp2 {
typedef struct { int dump_header_table; } inflate_config;
typedef struct {
int dump_header_table;
} inflate_config;
static inflate_config config;

View File

@ -89,7 +89,11 @@ enum {
namespace {
constexpr auto anchors = std::array<Anchor, 5>{{
{3, 0, 201}, {5, 0, 101}, {7, 0, 1}, {9, 7, 1}, {11, 3, 1},
{3, 0, 201},
{5, 0, 101},
{7, 0, 1},
{9, 7, 1},
{11, 3, 1},
}};
} // namespace

View File

@ -174,8 +174,7 @@ Options:
--mime-types-file=<PATH>
Path to file that contains MIME media types and the
extensions that represent them.
Default: )"
<< config.mime_types_file << R"(
Default: )" << config.mime_types_file << R"(
--no-content-length
Don't send content-length header field.
--version Display version information and exit.

View File

@ -1890,8 +1890,7 @@ Connections:
Performance:
-n, --workers=<N>
Set the number of worker threads.
Default: )"
<< config->num_worker << R"(
Default: )" << config->num_worker << R"(
--single-thread
Run everything in one thread inside the worker process.
This feature is provided for better debugging
@ -2073,8 +2072,7 @@ SSL/TLS:
--client-ciphers=<SUITE>
Set allowed cipher list for backend connection. The
format of the string is described in OpenSSL ciphers(1).
Default: )"
<< config->tls.client.ciphers << R"(
Default: )" << config->tls.client.ciphers << R"(
--ecdh-curves=<LIST>
Set supported curve list for frontend connections.
<LIST> is a colon separated list of curve NID or names
@ -2130,8 +2128,8 @@ SSL/TLS:
NPN. The parameter must be delimited by a single comma
only and any white spaces are treated as a part of
protocol string.
Default: )"
<< DEFAULT_NPN_LIST << R"(
Default: )" << DEFAULT_NPN_LIST
<< R"(
--verify-client
Require and verify client certificate.
--verify-client-cacert=<PATH>
@ -2157,12 +2155,13 @@ SSL/TLS:
TLSv1.2 or above. The available versions are:
)"
#ifdef TLS1_3_VERSION
"TLSv1.3, "
"TLSv1.3, "
#endif // TLS1_3_VERSION
"TLSv1.2, TLSv1.1, and TLSv1.0"
R"(
"TLSv1.2, TLSv1.1, and TLSv1.0"
R"(
Default: )"
<< DEFAULT_TLS_MIN_PROTO_VERSION << R"(
<< DEFAULT_TLS_MIN_PROTO_VERSION
<< R"(
--tls-max-proto-version=<VER>
Specify maximum SSL/TLS protocol. The name matching is
done in case-insensitive manner. The versions between
@ -2172,10 +2171,10 @@ SSL/TLS:
message "unknown protocol". The available versions are:
)"
#ifdef TLS1_3_VERSION
"TLSv1.3, "
"TLSv1.3, "
#endif // TLS1_3_VERSION
"TLSv1.2, TLSv1.1, and TLSv1.0"
R"(
"TLSv1.2, TLSv1.1, and TLSv1.0"
R"(
Default: )"
<< DEFAULT_TLS_MAX_PROTO_VERSION << R"(
--tls-ticket-key-file=<PATH>
@ -2531,8 +2530,7 @@ Logging:
Set path to write error log. To reopen file, send USR1
signal to nghttpx. stderr will be redirected to the
error log file unless --errorlog-syslog is used.
Default: )"
<< config->logging.error.file << R"(
Default: )" << config->logging.error.file << R"(
--errorlog-syslog
Send error log to syslog. If this option is used,
--errorlog-file option is ignored.
@ -2664,8 +2662,8 @@ HTTP:
Specify the port number which appears in Location header
field when redirect to HTTPS URI is made due to
"redirect-if-not-tls" parameter in --backend option.
Default: )"
<< config->http.redirect_https_port << R"(
Default: )" << config->http.redirect_https_port
<< R"(
API:
--api-max-request-body=<SIZE>
@ -2744,8 +2742,7 @@ Misc:
Load configuration from <PATH>. Please note that
nghttpx always tries to read the default configuration
file if --conf is not given.
Default: )"
<< config->conf_path << R"(
Default: )" << config->conf_path << R"(
--include=<PATH>
Load additional configurations from <PATH>. File <PATH>
is read when configuration parser encountered this
@ -2763,8 +2760,7 @@ Misc:
The <DURATION> argument is an integer and an optional unit (e.g., 1s
is 1 second and 500ms is 500 milliseconds). Units are h, m, s or ms
(hours, minutes, seconds and milliseconds, respectively). If a unit
is omitted, a second is used as unit.)"
<< std::endl;
is omitted, a second is used as unit.)" << std::endl;
}
} // namespace

View File

@ -38,12 +38,14 @@ namespace {
const std::array<APIEndpoint, 2> &apis() {
static const auto apis = new std::array<APIEndpoint, 2>{{
APIEndpoint{
StringRef::from_lit("/api/v1beta1/backendconfig"), true,
StringRef::from_lit("/api/v1beta1/backendconfig"),
true,
(1 << API_METHOD_POST) | (1 << API_METHOD_PUT),
&APIDownstreamConnection::handle_backendconfig,
},
APIEndpoint{
StringRef::from_lit("/api/v1beta1/configrevision"), true,
StringRef::from_lit("/api/v1beta1/configrevision"),
true,
(1 << API_METHOD_GET),
&APIDownstreamConnection::handle_configrevision,
},
@ -56,7 +58,8 @@ const std::array<APIEndpoint, 2> &apis() {
namespace {
// The method string. This must be same order of APIMethod.
constexpr StringRef API_METHOD_STRING[] = {
StringRef::from_lit("GET"), StringRef::from_lit("POST"),
StringRef::from_lit("GET"),
StringRef::from_lit("POST"),
StringRef::from_lit("PUT"),
};
} // namespace

View File

@ -1257,9 +1257,15 @@ void ClientHandler::write_accesslog(Downstream *downstream) {
upstream_accesslog(
config->logging.access.format,
LogSpec{
downstream, ipaddr_, alpn_, sni_, conn_.tls.ssl,
downstream,
ipaddr_,
alpn_,
sni_,
conn_.tls.ssl,
std::chrono::high_resolution_clock::now(), // request_end_time
port_, faddr_->port, config->pid,
port_,
faddr_->port,
config->pid,
});
}

View File

@ -2673,14 +2673,16 @@ int parse_config(Config *config, int optid, const StringRef &opt,
<< SHRPX_OPT_FRONTEND;
return 0;
case SHRPX_OPTID_BACKEND_NO_TLS:
LOG(WARN) << opt << ": deprecated. backend connection is not encrypted by "
"default. See also "
LOG(WARN) << opt
<< ": deprecated. backend connection is not encrypted by "
"default. See also "
<< SHRPX_OPT_BACKEND_TLS;
return 0;
case SHRPX_OPTID_BACKEND_TLS_SNI_FIELD:
LOG(WARN) << opt << ": deprecated. Use sni keyword in --backend option. "
"For now, all sni values of all backends are "
"overridden by the given value "
LOG(WARN) << opt
<< ": deprecated. Use sni keyword in --backend option. "
"For now, all sni values of all backends are "
"overridden by the given value "
<< optarg;
config->tls.backend_sni_name = make_string_ref(config->balloc, optarg);
@ -2791,8 +2793,9 @@ int parse_config(Config *config, int optid, const StringRef &opt,
return 0;
case SHRPX_OPTID_CLIENT:
LOG(ERROR) << opt << ": deprecated. Use frontend=<addr>,<port>;no-tls, "
"backend=<addr>,<port>;;proto=h2;tls";
LOG(ERROR) << opt
<< ": deprecated. Use frontend=<addr>,<port>;no-tls, "
"backend=<addr>,<port>;;proto=h2;tls";
return -1;
case SHRPX_OPTID_INSECURE:
config->tls.insecure = util::strieq_l("yes", optarg);
@ -2887,8 +2890,9 @@ int parse_config(Config *config, int optid, const StringRef &opt,
return 0;
}
case SHRPX_OPTID_TLS_PROTO_LIST: {
LOG(WARN) << opt << ": deprecated. Use tls-min-proto-version and "
"tls-max-proto-version instead.";
LOG(WARN) << opt
<< ": deprecated. Use tls-min-proto-version and "
"tls-max-proto-version instead.";
auto list = util::split_str(optarg, ',');
config->tls.tls_proto_list.resize(list.size());
for (size_t i = 0; i < list.size(); ++i) {
@ -3513,8 +3517,9 @@ int parse_config(Config *config, int optid, const StringRef &opt,
case SHRPX_OPTID_REDIRECT_HTTPS_PORT: {
auto n = util::parse_uint(optarg);
if (n == -1 || n < 0 || n > 65535) {
LOG(ERROR) << opt << ": bad value. Specify an integer in the range [0, "
"65535], inclusive";
LOG(ERROR) << opt
<< ": bad value. Specify an integer in the range [0, "
"65535], inclusive";
return -1;
}
config->http.redirect_https_port = optarg;

View File

@ -81,6 +81,6 @@ private:
bool offline_;
};
} // namespace
} // namespace shrpx
#endif // SHRPX_CONNECT_BLOCKER_H

View File

@ -207,12 +207,12 @@ int ConnectionHandler::create_single_worker() {
,
nb_.get()
#endif // HAVE_NEVERBLEED
);
);
auto cl_ssl_ctx = tls::setup_downstream_client_ssl_context(
#ifdef HAVE_NEVERBLEED
nb_.get()
#endif // HAVE_NEVERBLEED
);
);
if (cl_ssl_ctx) {
all_ssl_ctx_.push_back(cl_ssl_ctx);
@ -258,12 +258,12 @@ int ConnectionHandler::create_worker_thread(size_t num) {
,
nb_.get()
#endif // HAVE_NEVERBLEED
);
);
auto cl_ssl_ctx = tls::setup_downstream_client_ssl_context(
#ifdef HAVE_NEVERBLEED
nb_.get()
#endif // HAVE_NEVERBLEED
);
);
if (cl_ssl_ctx) {
all_ssl_ctx_.push_back(cl_ssl_ctx);

View File

@ -402,11 +402,10 @@ void upstream_accesslog(const std::vector<LogFragment> &lfv,
? req.authority
: config->http2_proxy
? construct_absolute_request_uri(balloc, req)
: req.path.empty()
? req.method == HTTP_OPTIONS
? StringRef::from_lit("*")
: StringRef::from_lit("-")
: req.path;
: req.path.empty() ? req.method == HTTP_OPTIONS
? StringRef::from_lit("*")
: StringRef::from_lit("-")
: req.path;
auto p = std::begin(buf);
auto last = std::end(buf) - 2;

View File

@ -62,9 +62,9 @@ using namespace nghttp2;
// Upstream log
#define ULOG(SEVERITY, UPSTREAM) \
(shrpx::Log(SEVERITY, __FILE__, __LINE__) \
<< "[UPSTREAM:" << UPSTREAM << "]" \
" ")
(shrpx::Log(SEVERITY, __FILE__, __LINE__) << "[UPSTREAM:" << UPSTREAM \
<< "]" \
" ")
// Downstream log
#define DLOG(SEVERITY, DOWNSTREAM) \

View File

@ -105,41 +105,32 @@ void test_shrpx_router_match_wildcard(void) {
router.add_route(p.pattern, p.idx, p.wildcard);
}
CU_ASSERT(0 ==
router.match(StringRef::from_lit("nghttp2.org"),
StringRef::from_lit("/")));
CU_ASSERT(0 == router.match(StringRef::from_lit("nghttp2.org"),
StringRef::from_lit("/")));
CU_ASSERT(1 ==
router.match(StringRef::from_lit("nghttp2.org"),
StringRef::from_lit("/a")));
CU_ASSERT(1 == router.match(StringRef::from_lit("nghttp2.org"),
StringRef::from_lit("/a")));
CU_ASSERT(1 ==
router.match(StringRef::from_lit("nghttp2.org"),
StringRef::from_lit("/charlie")));
CU_ASSERT(1 == router.match(StringRef::from_lit("nghttp2.org"),
StringRef::from_lit("/charlie")));
CU_ASSERT(2 ==
router.match(StringRef::from_lit("nghttp2.org"),
StringRef::from_lit("/alpha")));
CU_ASSERT(2 == router.match(StringRef::from_lit("nghttp2.org"),
StringRef::from_lit("/alpha")));
CU_ASSERT(2 ==
router.match(StringRef::from_lit("nghttp2.org"),
StringRef::from_lit("/alpha/")));
CU_ASSERT(2 == router.match(StringRef::from_lit("nghttp2.org"),
StringRef::from_lit("/alpha/")));
CU_ASSERT(3 ==
router.match(StringRef::from_lit("nghttp2.org"),
StringRef::from_lit("/alpha/b")));
CU_ASSERT(3 == router.match(StringRef::from_lit("nghttp2.org"),
StringRef::from_lit("/alpha/b")));
CU_ASSERT(4 ==
router.match(StringRef::from_lit("nghttp2.org"),
StringRef::from_lit("/bravo")));
CU_ASSERT(4 == router.match(StringRef::from_lit("nghttp2.org"),
StringRef::from_lit("/bravo")));
CU_ASSERT(5 ==
router.match(StringRef::from_lit("nghttp2.org"),
StringRef::from_lit("/bravocharlie")));
CU_ASSERT(5 == router.match(StringRef::from_lit("nghttp2.org"),
StringRef::from_lit("/bravocharlie")));
CU_ASSERT(5 ==
router.match(StringRef::from_lit("nghttp2.org"),
StringRef::from_lit("/bravo/")));
CU_ASSERT(5 == router.match(StringRef::from_lit("nghttp2.org"),
StringRef::from_lit("/bravo/")));
}
void test_shrpx_router_match_prefix(void) {

View File

@ -745,7 +745,7 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file,
,
neverbleed_t *nb
#endif // HAVE_NEVERBLEED
) {
) {
auto ssl_ctx = SSL_CTX_new(SSLv23_server_method());
if (!ssl_ctx) {
LOG(FATAL) << ERR_error_string(ERR_get_error(), nullptr);
@ -1041,8 +1041,8 @@ SSL_CTX *create_ssl_client_context(
SSL_CTX_set_options(ssl_ctx, ssl_opts | tlsconf.tls_proto_mask);
SSL_CTX_set_session_cache_mode(
ssl_ctx, SSL_SESS_CACHE_CLIENT | SSL_SESS_CACHE_NO_INTERNAL_STORE);
SSL_CTX_set_session_cache_mode(ssl_ctx, SSL_SESS_CACHE_CLIENT |
SSL_SESS_CACHE_NO_INTERNAL_STORE);
SSL_CTX_sess_set_new_cb(ssl_ctx, tls_session_client_new_cb);
if (nghttp2::tls::ssl_ctx_set_proto_versions(
@ -1698,7 +1698,7 @@ setup_server_ssl_context(std::vector<SSL_CTX *> &all_ssl_ctx,
,
neverbleed_t *nb
#endif // HAVE_NEVERBLEED
) {
) {
auto config = get_config();
if (!upstream_tls_enabled(config->conn)) {
@ -1713,7 +1713,7 @@ setup_server_ssl_context(std::vector<SSL_CTX *> &all_ssl_ctx,
,
nb
#endif // HAVE_NEVERBLEED
);
);
all_ssl_ctx.push_back(ssl_ctx);
@ -1731,7 +1731,7 @@ setup_server_ssl_context(std::vector<SSL_CTX *> &all_ssl_ctx,
,
nb
#endif // HAVE_NEVERBLEED
);
);
all_ssl_ctx.push_back(ssl_ctx);
if (cert_lookup_tree_add_ssl_ctx(cert_tree, indexed_ssl_ctx, ssl_ctx) ==
@ -1748,7 +1748,7 @@ SSL_CTX *setup_downstream_client_ssl_context(
#ifdef HAVE_NEVERBLEED
neverbleed_t *nb
#endif // HAVE_NEVERBLEED
) {
) {
auto &tlsconf = get_config()->tls;
return create_ssl_client_context(

View File

@ -86,7 +86,7 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file,
,
neverbleed_t *nb
#endif // HAVE_NEVERBLEED
);
);
// Create client side SSL_CTX. This does not configure ALPN settings.
// |next_proto_select_cb| is for NPN.
@ -215,14 +215,14 @@ setup_server_ssl_context(std::vector<SSL_CTX *> &all_ssl_ctx,
,
neverbleed_t *nb
#endif // HAVE_NEVERBLEED
);
);
// Setups client side SSL_CTX.
SSL_CTX *setup_downstream_client_ssl_context(
#ifdef HAVE_NEVERBLEED
neverbleed_t *nb
#endif // HAVE_NEVERBLEED
);
);
// Sets ALPN settings in |SSL| suitable for HTTP/2 use.
void setup_downstream_http2_alpn(SSL *ssl);

View File

@ -67,7 +67,7 @@ void drop_privileges(
#ifdef HAVE_NEVERBLEED
neverbleed_t *nb
#endif // HAVE_NEVERBLEED
) {
) {
std::array<char, STRERROR_BUFSIZE> errbuf;
auto config = get_config();
@ -539,7 +539,7 @@ int worker_process_event_loop(WorkerProcessConfig *wpconf) {
#ifdef HAVE_NEVERBLEED
nb
#endif // HAVE_NEVERBLEED
);
);
ev_io ipcev;
ev_io_init(&ipcev, ipc_readcb, wpconf->ipc_fd, EV_READ);

View File

@ -75,7 +75,7 @@ constexpr char DEFAULT_CIPHER_LIST[] =
constexpr auto NGHTTP2_TLS_MIN_VERSION = TLS1_VERSION;
#ifdef TLS1_3_VERSION
constexpr auto NGHTTP2_TLS_MAX_VERSION = TLS1_3_VERSION;
#else // !TLS1_3_VERSION
#else // !TLS1_3_VERSION
constexpr auto NGHTTP2_TLS_MAX_VERSION = TLS1_2_VERSION;
#endif // !TLS1_3_VERSION

View File

@ -267,8 +267,10 @@ static void run_nghttp2_session_recv(void) {
nghttp2_frame frame;
nghttp2_bufs bufs;
nghttp2_nv nv[] = {
MAKE_NV(":method", "GET"), MAKE_NV(":scheme", "https"),
MAKE_NV(":authority", "example.org"), MAKE_NV(":path", "/"),
MAKE_NV(":method", "GET"),
MAKE_NV(":scheme", "https"),
MAKE_NV(":authority", "example.org"),
MAKE_NV(":path", "/"),
};
nghttp2_settings_entry iv[2];
my_user_data ud;

View File

@ -81,8 +81,10 @@ typedef struct {
} my_user_data;
static const nghttp2_nv reqnv[] = {
MAKE_NV(":method", "GET"), MAKE_NV(":path", "/"),
MAKE_NV(":scheme", "https"), MAKE_NV(":authority", "localhost"),
MAKE_NV(":method", "GET"),
MAKE_NV(":path", "/"),
MAKE_NV(":scheme", "https"),
MAKE_NV(":authority", "localhost"),
};
static const nghttp2_nv resnv[] = {
@ -5876,9 +5878,8 @@ void test_nghttp2_submit_altsvc(void) {
len = nghttp2_session_mem_send(session, &data);
CU_ASSERT(len ==
NGHTTP2_FRAME_HDLEN + 2 + sizeof(origin) - 1 + sizeof(field_value) -
1);
CU_ASSERT(len == NGHTTP2_FRAME_HDLEN + 2 + sizeof(origin) - 1 +
sizeof(field_value) - 1);
nghttp2_frame_unpack_frame_hd(&hd, data);