diff --git a/lib/nghttp2_frame.h b/lib/nghttp2_frame.h index 891289f6..35ca214a 100644 --- a/lib/nghttp2_frame.h +++ b/lib/nghttp2_frame.h @@ -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); diff --git a/lib/nghttp2_hd.h b/lib/nghttp2_hd.h index 87f335d5..760bfbc3 100644 --- a/lib/nghttp2_hd.h +++ b/lib/nghttp2_hd.h @@ -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; diff --git a/lib/nghttp2_pq.h b/lib/nghttp2_pq.h index bd97ca35..71cf96a1 100644 --- a/lib/nghttp2_pq.h +++ b/lib/nghttp2_pq.h @@ -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 */ diff --git a/lib/nghttp2_queue.h b/lib/nghttp2_queue.h index d872b07b..c7eb753c 100644 --- a/lib/nghttp2_queue.h +++ b/lib/nghttp2_queue.h @@ -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); diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 9cbe61dd..d6761727 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -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; diff --git a/lib/nghttp2_stream.c b/lib/nghttp2_stream.c index 8dee6ef6..eccd3174 100644 --- a/lib/nghttp2_stream.c +++ b/lib/nghttp2_stream.c @@ -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); diff --git a/src/HttpServer.cc b/src/HttpServer.cc index 55b3a727..b3e35ef7 100644 --- a/src/HttpServer.cc +++ b/src/HttpServer.cc @@ -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 diff --git a/src/allocator.h b/src/allocator.h index 029219aa..32a74260 100644 --- a/src/allocator.h +++ b/src/allocator.h @@ -273,6 +273,6 @@ ByteRef make_byte_ref(BlockAllocator &alloc, size_t size) { return {dst, size}; } -} // namespace aria2 +} // namespace nghttp2 #endif // ALLOCATOR_H diff --git a/src/app_helper.cc b/src/app_helper.cc index 214a46f0..e61c5793 100644 --- a/src/app_helper.cc +++ b/src/app_helper.cc @@ -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, diff --git a/src/asio_client_session.cc b/src/asio_client_session.cc index 8c4a8742..e142dedc 100644 --- a/src/asio_client_session.cc +++ b/src/asio_client_session.cc @@ -140,4 +140,4 @@ const bool priority_spec::valid() const { return valid_; } } // namespace client } // namespace asio_http2 -} // nghttp2 +} // namespace nghttp2 diff --git a/src/asio_client_session_impl.cc b/src/asio_client_session_impl.cc index 025254b4..16f91fa9 100644 --- a/src/asio_client_session_impl.cc +++ b/src/asio_client_session_impl.cc @@ -756,4 +756,4 @@ void session_impl::read_timeout(const boost::posix_time::time_duration &t) { } // namespace client } // namespace asio_http2 -} // nghttp2 +} // namespace nghttp2 diff --git a/src/asio_client_session_tls_impl.cc b/src/asio_client_session_tls_impl.cc index 4ac2ca13..f1c21330 100644 --- a/src/asio_client_session_tls_impl.cc +++ b/src/asio_client_session_tls_impl.cc @@ -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(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; } diff --git a/src/asio_server_http2_handler.h b/src/asio_server_http2_handler.h index 2f19f6d5..12064499 100644 --- a/src/asio_server_http2_handler.h +++ b/src/asio_server_http2_handler.h @@ -169,6 +169,6 @@ private: } // namespace server } // namespace asio_http2 -} // namespace nghttp +} // namespace nghttp2 #endif // ASIO_SERVER_HTTP2_HANDLER_H diff --git a/src/h2load.cc b/src/h2load.cc index 74708d2e..66f54b98 100644 --- a/src/h2load.cc +++ b/src/h2load.cc @@ -1828,12 +1828,10 @@ Options: -c, --clients= 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= Number of native threads. - Default: )" - << config.nthreads << R"( + Default: )" << config.nthreads << R"( -i, --input-file= 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**)-1. For SPDY, if is strictly less than 16, this option is ignored. Otherwise 2** is used for SPDY. - Default: )" - << config.connection_window_bits << R"( + Default: )" << config.connection_window_bits << R"( -H, --header=
Add/Override a header to the requests. --ciphers= @@ -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= @@ -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 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) diff --git a/src/http2.cc b/src/http2.cc index 5203a4d5..d672bb46 100644 --- a/src/http2.cc +++ b/src/http2.cc @@ -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(1), base_path.size()) + rel_path.size() + 1 + - std::max(base_query.size(), rel_query.size()) + 1); + balloc, std::max(static_cast(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()) { diff --git a/src/inflatehd.cc b/src/inflatehd.cc index 9140e054..4f9bf5a0 100644 --- a/src/inflatehd.cc +++ b/src/inflatehd.cc @@ -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; diff --git a/src/nghttp.cc b/src/nghttp.cc index 514454c1..7c29b3ce 100644 --- a/src/nghttp.cc +++ b/src/nghttp.cc @@ -89,7 +89,11 @@ enum { namespace { constexpr auto anchors = std::array{{ - {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 diff --git a/src/nghttpd.cc b/src/nghttpd.cc index b26aea2f..c7b64b53 100644 --- a/src/nghttpd.cc +++ b/src/nghttpd.cc @@ -174,8 +174,7 @@ Options: --mime-types-file= 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. diff --git a/src/shrpx.cc b/src/shrpx.cc index 468d8b48..c660b1f2 100644 --- a/src/shrpx.cc +++ b/src/shrpx.cc @@ -1890,8 +1890,7 @@ Connections: Performance: -n, --workers= 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= 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= Set supported curve list for frontend connections. 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= @@ -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= 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= @@ -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= @@ -2744,8 +2742,7 @@ Misc: Load configuration from . 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= Load additional configurations from . File is read when configuration parser encountered this @@ -2763,8 +2760,7 @@ Misc: The 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 diff --git a/src/shrpx_api_downstream_connection.cc b/src/shrpx_api_downstream_connection.cc index 34f5eaa5..39db4a9a 100644 --- a/src/shrpx_api_downstream_connection.cc +++ b/src/shrpx_api_downstream_connection.cc @@ -38,12 +38,14 @@ namespace { const std::array &apis() { static const auto apis = new std::array{{ 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 &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 diff --git a/src/shrpx_client_handler.cc b/src/shrpx_client_handler.cc index 750acee1..f52f0c4f 100644 --- a/src/shrpx_client_handler.cc +++ b/src/shrpx_client_handler.cc @@ -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, }); } diff --git a/src/shrpx_config.cc b/src/shrpx_config.cc index 0bd43896..04d89c34 100644 --- a/src/shrpx_config.cc +++ b/src/shrpx_config.cc @@ -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=,;no-tls, " - "backend=,;;proto=h2;tls"; + LOG(ERROR) << opt + << ": deprecated. Use frontend=,;no-tls, " + "backend=,;;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; diff --git a/src/shrpx_connect_blocker.h b/src/shrpx_connect_blocker.h index 4ccd6a1f..1ebe7890 100644 --- a/src/shrpx_connect_blocker.h +++ b/src/shrpx_connect_blocker.h @@ -81,6 +81,6 @@ private: bool offline_; }; -} // namespace +} // namespace shrpx #endif // SHRPX_CONNECT_BLOCKER_H diff --git a/src/shrpx_connection_handler.cc b/src/shrpx_connection_handler.cc index cf078a12..ca84d53c 100644 --- a/src/shrpx_connection_handler.cc +++ b/src/shrpx_connection_handler.cc @@ -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); diff --git a/src/shrpx_log.cc b/src/shrpx_log.cc index 89559cab..d43b6fab 100644 --- a/src/shrpx_log.cc +++ b/src/shrpx_log.cc @@ -402,11 +402,10 @@ void upstream_accesslog(const std::vector &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; diff --git a/src/shrpx_log.h b/src/shrpx_log.h index 6185b95a..ea77fbc5 100644 --- a/src/shrpx_log.h +++ b/src/shrpx_log.h @@ -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) \ diff --git a/src/shrpx_router_test.cc b/src/shrpx_router_test.cc index d2858c18..9a93e718 100644 --- a/src/shrpx_router_test.cc +++ b/src/shrpx_router_test.cc @@ -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) { diff --git a/src/shrpx_tls.cc b/src/shrpx_tls.cc index 653d74dc..d69a67ed 100644 --- a/src/shrpx_tls.cc +++ b/src/shrpx_tls.cc @@ -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 &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 &all_ssl_ctx, , nb #endif // HAVE_NEVERBLEED - ); + ); all_ssl_ctx.push_back(ssl_ctx); @@ -1731,7 +1731,7 @@ setup_server_ssl_context(std::vector &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( diff --git a/src/shrpx_tls.h b/src/shrpx_tls.h index 52745b08..a368dabf 100644 --- a/src/shrpx_tls.h +++ b/src/shrpx_tls.h @@ -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 &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); diff --git a/src/shrpx_worker_process.cc b/src/shrpx_worker_process.cc index d8329b5f..f760ad7e 100644 --- a/src/shrpx_worker_process.cc +++ b/src/shrpx_worker_process.cc @@ -67,7 +67,7 @@ void drop_privileges( #ifdef HAVE_NEVERBLEED neverbleed_t *nb #endif // HAVE_NEVERBLEED - ) { +) { std::array 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); diff --git a/src/tls.h b/src/tls.h index 8aa618d5..aca38022 100644 --- a/src/tls.h +++ b/src/tls.h @@ -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 diff --git a/tests/failmalloc_test.c b/tests/failmalloc_test.c index cb4dc846..a7ac2f06 100644 --- a/tests/failmalloc_test.c +++ b/tests/failmalloc_test.c @@ -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; diff --git a/tests/nghttp2_session_test.c b/tests/nghttp2_session_test.c index 0cf765fa..f2756aad 100644 --- a/tests/nghttp2_session_test.c +++ b/tests/nghttp2_session_test.c @@ -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);