h2load: add --connect-to option
This commit is contained in:
parent
1fff737955
commit
df575f968f
|
@ -1563,8 +1563,11 @@ void resolve_host() {
|
||||||
hints.ai_protocol = 0;
|
hints.ai_protocol = 0;
|
||||||
hints.ai_flags = AI_ADDRCONFIG;
|
hints.ai_flags = AI_ADDRCONFIG;
|
||||||
|
|
||||||
rv = getaddrinfo(config.host.c_str(), util::utos(config.port).c_str(), &hints,
|
const auto &resolve_host =
|
||||||
&res);
|
config.connect_to_host.empty() ? config.host : config.connect_to_host;
|
||||||
|
|
||||||
|
rv = getaddrinfo(resolve_host.c_str(), util::utos(config.port).c_str(),
|
||||||
|
&hints, &res);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
std::cerr << "getaddrinfo() failed: " << gai_strerror(rv) << std::endl;
|
std::cerr << "getaddrinfo() failed: " << gai_strerror(rv) << std::endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@ -1979,6 +1982,8 @@ Options:
|
||||||
response time when using one worker thread, but may
|
response time when using one worker thread, but may
|
||||||
appear slightly out of order with multiple threads due
|
appear slightly out of order with multiple threads due
|
||||||
to buffering. Status code is -1 for failed streams.
|
to buffering. Status code is -1 for failed streams.
|
||||||
|
--connect-to=<HOST>
|
||||||
|
Host to connect instead of using the host in <URI>.
|
||||||
-v, --verbose
|
-v, --verbose
|
||||||
Output debug information.
|
Output debug information.
|
||||||
--version Display version information and exit.
|
--version Display version information and exit.
|
||||||
|
@ -2037,6 +2042,7 @@ int main(int argc, char **argv) {
|
||||||
{"encoder-header-table-size", required_argument, &flag, 8},
|
{"encoder-header-table-size", required_argument, &flag, 8},
|
||||||
{"warm-up-time", required_argument, &flag, 9},
|
{"warm-up-time", required_argument, &flag, 9},
|
||||||
{"log-file", required_argument, &flag, 10},
|
{"log-file", required_argument, &flag, 10},
|
||||||
|
{"connect-to", required_argument, &flag, 11},
|
||||||
{nullptr, 0, nullptr, 0}};
|
{nullptr, 0, nullptr, 0}};
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
auto c = getopt_long(argc, argv,
|
auto c = getopt_long(argc, argv,
|
||||||
|
@ -2264,6 +2270,10 @@ int main(int argc, char **argv) {
|
||||||
// --log-file
|
// --log-file
|
||||||
logfile = optarg;
|
logfile = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 11:
|
||||||
|
// --connect-to
|
||||||
|
config.connect_to_host = optarg;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -69,6 +69,7 @@ struct Config {
|
||||||
nghttp2::Headers custom_headers;
|
nghttp2::Headers custom_headers;
|
||||||
std::string scheme;
|
std::string scheme;
|
||||||
std::string host;
|
std::string host;
|
||||||
|
std::string connect_to_host;
|
||||||
std::string ifile;
|
std::string ifile;
|
||||||
std::string ciphers;
|
std::string ciphers;
|
||||||
// length of upload data
|
// length of upload data
|
||||||
|
|
Loading…
Reference in New Issue