h2load: Workaround with clang-3.4

This commit is contained in:
Tatsuhiro Tsujikawa 2015-07-19 18:35:14 +09:00
parent 5dc060c1a2
commit b37716ab6a
1 changed files with 7 additions and 6 deletions

View File

@ -899,14 +899,12 @@ int client_select_next_proto_cb(SSL *ssl, unsigned char **out,
} // namespace
namespace {
template <typename Iterator>
std::vector<std::string> parse_uris(Iterator first, Iterator last) {
// Use std::vector<std::string>::iterator explicitly, without that,
// http_parser_url u{} fails with clang-3.4.
std::vector<std::string> parse_uris(std::vector<std::string>::iterator first,
std::vector<std::string>::iterator last) {
std::vector<std::string> reqlines;
// First URI is treated specially. We use scheme, host and port of
// this URI and ignore those in the remaining URIs if present.
http_parser_url u{};
if (first == last) {
std::cerr << "no URI available" << std::endl;
exit(EXIT_FAILURE);
@ -915,6 +913,9 @@ std::vector<std::string> parse_uris(Iterator first, Iterator last) {
auto uri = (*first).c_str();
++first;
// First URI is treated specially. We use scheme, host and port of
// this URI and ignore those in the remaining URIs if present.
http_parser_url u{};
if (http_parser_parse_url(uri, strlen(uri), 0, &u) != 0 ||
!util::has_uri_field(u, UF_SCHEMA) || !util::has_uri_field(u, UF_HOST)) {
std::cerr << "invalid URI: " << uri << std::endl;