summaryrefslogtreecommitdiffstats
path: root/src/h2load.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/h2load.cc')
-rw-r--r--src/h2load.cc37
1 files changed, 29 insertions, 8 deletions
diff --git a/src/h2load.cc b/src/h2load.cc
index 0f07610..8136a9f 100644
--- a/src/h2load.cc
+++ b/src/h2load.cc
@@ -410,7 +410,7 @@ namespace {
void client_request_timeout_cb(struct ev_loop *loop, ev_timer *w, int revents) {
auto client = static_cast<Client *>(w->data);
- if (client->streams.size() >= (size_t)config.max_concurrent_streams) {
+ if (client->streams.size() >= config.max_concurrent_streams) {
ev_timer_stop(client->worker->loop, w);
return;
}
@@ -582,8 +582,12 @@ int Client::make_socket(addrinfo *addr) {
}
}
- if (ssl && !util::numeric_host(config.host.c_str())) {
- SSL_set_tlsext_host_name(ssl, config.host.c_str());
+ if (ssl) {
+ if (!config.sni.empty()) {
+ SSL_set_tlsext_host_name(ssl, config.sni.c_str());
+ } else if (!util::numeric_host(config.host.c_str())) {
+ SSL_set_tlsext_host_name(ssl, config.host.c_str());
+ }
}
if (config.is_quic()) {
@@ -2301,6 +2305,9 @@ Options:
--max-udp-payload-size=<SIZE>
Specify the maximum outgoing UDP datagram payload size.
--ktls Enable ktls.
+ --sni=<DNSNAME>
+ Send <DNSNAME> in TLS SNI, overriding the host name
+ specified in URI.
-v, --verbose
Output debug information.
--version Display version information and exit.
@@ -2363,6 +2370,7 @@ int main(int argc, char **argv) {
{"max-udp-payload-size", required_argument, &flag, 17},
{"ktls", no_argument, &flag, 18},
{"alpn-list", required_argument, &flag, 19},
+ {"sni", required_argument, &flag, 20},
{nullptr, 0, nullptr, 0}};
int option_index = 0;
auto c = getopt_long(argc, argv,
@@ -2699,6 +2707,10 @@ int main(int argc, char **argv) {
// alpn-list option
config.alpn_list = util::parse_config_str_list(StringRef{optarg});
break;
+ case 20:
+ // --sni
+ config.sni = optarg;
+ break;
}
break;
default:
@@ -2973,6 +2985,15 @@ int main(int argc, char **argv) {
}
}
+#if defined(NGHTTP2_OPENSSL_IS_BORINGSSL) && defined(HAVE_LIBBROTLI)
+ if (!SSL_CTX_add_cert_compression_alg(
+ ssl_ctx, nghttp2::tls::CERTIFICATE_COMPRESSION_ALGO_BROTLI,
+ nghttp2::tls::cert_compress, nghttp2::tls::cert_decompress)) {
+ std::cerr << "SSL_CTX_add_cert_compression_alg failed" << std::endl;
+ exit(EXIT_FAILURE);
+ }
+#endif // NGHTTP2_OPENSSL_IS_BORINGSSL && HAVE_LIBBROTLI
+
std::string user_agent = "h2load nghttp2/" NGHTTP2_VERSION;
Headers shared_nva;
shared_nva.emplace_back(":scheme", config.scheme);
@@ -3079,18 +3100,18 @@ int main(int argc, char **argv) {
#ifndef NOTHREADS
size_t nreqs_per_thread = 0;
- ssize_t nreqs_rem = 0;
+ size_t nreqs_rem = 0;
if (!config.timing_script) {
nreqs_per_thread = config.nreqs / config.nthreads;
nreqs_rem = config.nreqs % config.nthreads;
}
- size_t nclients_per_thread = config.nclients / config.nthreads;
- ssize_t nclients_rem = config.nclients % config.nthreads;
+ auto nclients_per_thread = config.nclients / config.nthreads;
+ auto nclients_rem = config.nclients % config.nthreads;
- size_t rate_per_thread = config.rate / config.nthreads;
- ssize_t rate_per_thread_rem = config.rate % config.nthreads;
+ auto rate_per_thread = config.rate / config.nthreads;
+ auto rate_per_thread_rem = config.rate % config.nthreads;
size_t max_samples_per_thread =
std::max(static_cast<size_t>(256), MAX_SAMPLES / config.nthreads);