Lines Matching defs:std
92 constexpr auto anchors = std::array<Anchor, 5>{{
103 min_header_table_size(std::numeric_limits<uint32_t>::max()),
143 std::cerr << "[ERROR] HTTP/2 protocol was not selected."
145 << std::endl;
150 std::string strip_fragment(const char *raw_uri) {
155 return std::string(raw_uri, len);
159 Request::Request(const std::string &uri, const http_parser_url &u,
216 std::find(std::begin(host), std::end(host), ':') != std::end(host);
238 html_parser = std::make_unique<HtmlParser>(base_uri);
249 std::string Request::make_reqpath() const {
250 std::string path = util::has_uri_field(u, UF_PATH)
264 std::string decode_host(const StringRef &host) {
265 auto zone_start = std::find(std::begin(host), std::end(host), '%');
266 if (zone_start == std::end(host) ||
268 std::string(std::begin(host), zone_start).c_str())) {
272 if (zone_start + 1 == std::end(host)) {
276 if (zone_start + 3 >= std::end(host)) {
284 auto zone_id = util::percent_decode(zone_id_src, std::end(host));
285 auto res = std::string(std::begin(host), zone_start + 1);
377 std::cerr << "[ERROR] nghttp2_submit_data() returned error: "
378 << nghttp2_strerror(error) << std::endl;
409 std::cout << " HTTP Upgrade response" << std::endl;
467 std::string(4_k, '-'));
499 auto nva = std::vector<nghttp2_nv>();
511 std::string trailer_names;
533 std::cerr << "[ERROR] nghttp2_submit_"
536 << std::endl;
543 req->req_nva = std::move(build_headers);
546 auto timer = std::make_unique<ContinueTimer>(client->loop, req);
547 req->continue_timer = std::move(timer);
580 std::cerr << "[ERROR] Timeout" << std::endl;
645 int HttpClient::resolve_host(const std::string &host, uint16_t port) {
655 std::cerr << "[ERROR] getaddrinfo() failed: " << gai_strerror(rv)
656 << std::endl;
660 std::cerr << "[ERROR] No address returned" << std::endl;
688 std::cerr << "[ERROR] SSL_new() failed: "
689 << ERR_error_string(ERR_get_error(), nullptr) << std::endl;
758 for (auto req = std::begin(reqvec); req != std::end(reqvec); ++req) {
793 std::array<uint8_t, 8_k> buf;
821 std::array<struct iovec, 2> iov;
859 std::cerr << "[ERROR] Could not connect to the address "
861 << std::endl;
867 std::cerr << "Trying next address "
869 << std::endl;
881 std::cout << " Connected" << std::endl;
905 htp = std::make_unique<llhttp_t>();
965 std::array<nghttp2_settings_entry, 16> iv;
975 base64::encode(std::begin(settings_payload),
976 std::begin(settings_payload) + settings_payloadlen);
979 std::string req;
984 auto meth = std::find_if(
985 std::begin(config.headers), std::end(config.headers),
988 if (meth == std::end(config.headers)) {
1038 std::cout << " HTTP Upgrade request\n" << req << std::endl;
1044 reqvec[0]->req_nva = std::move(headers);
1066 std::cout.write(reinterpret_cast<const char *>(data), nread);
1070 std::cerr << "[ERROR] Failed to parse HTTP Upgrade response header: "
1072 << llhttp_get_error_reason(htp.get()) << std::endl;
1081 std::cout << std::endl;
1085 std::cerr << "[ERROR] HTTP Upgrade failed" << std::endl;
1092 std::cout << " HTTP Upgrade success" << std::endl;
1134 std::cout << "The negotiated protocol: " << proto << std::endl;
1173 std::cerr << "[ERROR] nghttp2_session_upgrade() returned error: "
1174 << nghttp2_strerror(rv) << std::endl;
1186 std::array<nghttp2_settings_entry, 16> iv;
1251 for (auto i = std::begin(reqvec) + (need_upgrade() && !reqvec[0]->data_prd);
1252 i != std::end(reqvec); ++i) {
1270 std::cerr << "[ERROR] nghttp2_session_mem_recv() returned error: "
1271 << nghttp2_strerror(rv) << std::endl;
1296 std::cerr << "[ERROR] nghttp2_session_send() returned error: "
1297 << nghttp2_strerror(len) << std::endl;
1348 std::cerr << "[WARNING] Certificate verification failed: "
1349 << X509_verify_cert_error_string(verify_res) << std::endl;
1365 std::array<uint8_t, 8_k> buf;
1444 std::stringstream ss;
1451 auto end = std::find(std::begin(host), std::end(host), '%');
1453 ss.write(host.c_str(), end - std::begin(host));
1466 bool HttpClient::add_request(const std::string &uri,
1482 reqvec.push_back(std::make_unique<Request>(uri, u, data_prd, data_length,
1488 timing.system_start_time = std::chrono::system_clock::now();
1538 auto dns_delta = std::chrono::duration_cast<std::chrono::microseconds>(
1543 std::chrono::duration_cast<std::chrono::microseconds>(
1562 std::chrono::duration_cast<
1563 std::chrono::system_clock::duration>(
1567 std::chrono::duration_cast<std::chrono::microseconds>(
1572 std::chrono::duration_cast<std::chrono::microseconds>(
1578 std::chrono::duration_cast<std::chrono::microseconds>(
1752 std::array<uint8_t, MAX_OUTLEN> out;
1764 std::cout.write(reinterpret_cast<const char *>(out.data()), outlen);
1776 std::cout.write(reinterpret_cast<const char *>(data), len);
1789 return std::min(max_payload, frame->hd.length + config.padding);
1884 auto req = std::make_unique<Request>("", u, nullptr, 0, pri_spec);
1891 client->reqvec.push_back(std::move(req));
2064 std::string uri = scheme->value;
2154 std::cerr << "[ERROR] request " << req->uri
2155 << " failed: " << nghttp2_strerror(lib_error_code) << std::endl;
2189 std::chrono::microseconds time;
2194 std::cout << "***** Statistics *****" << std::endl;
2196 std::vector<Request *> reqs;
2204 std::sort(std::begin(reqs), std::end(reqs),
2213 std::cout << R"(
2231 << std::endl;
2235 auto response_end = std::chrono::duration_cast<std::chrono::microseconds>(
2237 auto request_start = std::chrono::duration_cast<std::chrono::microseconds>(
2239 auto total = std::chrono::duration_cast<std::chrono::microseconds>(
2243 std::cout << std::setw(3) << req->stream_id << " " << std::setw(11)
2245 << (pushed ? "*" : " ") << std::setw(11)
2247 << std::setw(8) << util::format_duration(total) << " "
2248 << std::setw(4) << req->status << " " << std::setw(4)
2250 << req->make_reqpath() << std::endl;
2262 std::cout << "[NPN] server offers:" << std::endl;
2266 std::cout << " * ";
2267 std::cout.write(reinterpret_cast<const char *>(&in[i + 1]), in[i]);
2268 std::cout << std::endl;
2283 const std::string &scheme, const std::string &host, uint16_t port,
2284 std::vector<
2285 std::tuple<std::string, nghttp2_data_provider *, int64_t, int32_t>>
2294 std::cerr << "[ERROR] Failed to create SSL_CTX: "
2295 << ERR_error_string(ERR_get_error(), nullptr) << std::endl;
2315 std::cerr << "[WARNING] Could not load system trusted CA certificates: "
2316 << ERR_error_string(ERR_get_error(), nullptr) << std::endl;
2322 std::cerr << "[ERROR] Could not set TLS versions" << std::endl;
2328 std::cerr << "[ERROR] " << ERR_error_string(ERR_get_error(), nullptr)
2329 << std::endl;
2336 std::cerr << "[ERROR] " << ERR_error_string(ERR_get_error(), nullptr)
2337 << std::endl;
2345 std::cerr << "[ERROR] " << ERR_error_string(ERR_get_error(), nullptr)
2346 << std::endl;
2374 nghttp2_priority_spec_init(&pri_spec, dep_stream_id, std::get<3>(req), 0);
2377 client.add_request(std::get<0>(req), std::get<1>(req), std::get<2>(req),
2392 std::cerr << "[ERROR] Could not connect to " << host << ", port " << port
2393 << std::endl;
2417 std::cerr << "Cannot open file " << config.harfile << ". "
2418 << "har file could not be created." << std::endl;
2424 std::cerr << "Some requests were not processed. total="
2426 << std::endl;
2464 std::vector<nghttp2_nv> nva;
2534 std::string prev_scheme;
2535 std::string prev_host;
2553 std::cerr << "[ERROR] Could not create a temporary file in /tmp"
2554 << std::endl;
2558 std::cerr << "[WARNING] failed to unlink temporary file:" << tempfn
2559 << std::endl;
2562 std::array<char, 1_k> buf;
2570 std::cerr << "[ERROR] I/O error while reading from STDIN"
2571 << std::endl;
2578 std::cerr << "[ERROR] I/O error while writing to temporary file"
2579 << std::endl;
2585 std::cerr << "[ERROR] Could not stat temporary file" << std::endl;
2592 std::cerr << "[ERROR] Could not open file " << config.datafile
2593 << std::endl;
2598 std::cerr << "[ERROR] Could not stat file " << config.datafile
2599 << std::endl;
2606 std::vector<
2607 std::tuple<std::string, nghttp2_data_provider *, int64_t, int32_t>>
2617 std::cerr << "[ERROR] Could not parse URI " << uri << std::endl;
2622 std::cerr << "[ERROR] URI " << uri << " does not have scheme part"
2623 << std::endl;
2633 if (communicate(prev_scheme, prev_host, prev_port, std::move(requests),
2640 prev_host = std::move(host);
2647 if (communicate(prev_scheme, prev_host, prev_port, std::move(requests),
2657 void print_version(std::ostream &out) {
2658 out << "nghttp nghttp2/" NGHTTP2_VERSION << std::endl;
2663 void print_usage(std::ostream &out) {
2666 << std::endl;
2671 void print_help(std::ostream &out) {
2793 << std::endl;
2851 std::cerr << "-M: Bad option value: " << optarg << std::endl;
2861 print_help(std::cout);
2866 std::cerr << "-b: Bad option value: " << optarg << std::endl;
2878 std::cerr << "-p: specify the integer in the range ["
2880 << "], inclusive" << std::endl;
2890 std::cerr << "[WARNING]: -r, --har option is ignored because\n"
2891 << "the binary was not compiled with libjansson." << std::endl;
2899 if (config.timeout == std::numeric_limits<double>::infinity()) {
2900 std::cerr << "-t: bad timeout value: " << optarg << std::endl;
2911 std::cerr << "-" << static_cast<char>(c)
2913 << std::endl;
2928 std::cerr << "-H: invalid header: " << optarg << std::endl;
2939 std::cerr << "-H: invalid header - value missing: " << optarg
2940 << std::endl;
2951 std::cerr << "[WARNING]: -a, --get-assets option is ignored because\n"
2952 << "the binary was not compiled with libxml2." << std::endl;
2964 std::cerr << "-m: Bad option value: " << optarg << std::endl;
2973 std::cerr << "-c: Bad option value: " << optarg << std::endl;
2976 if (n > std::numeric_limits<uint32_t>::max()) {
2977 std::cerr << "-c: Value too large. It should be less than or equal to "
2978 << std::numeric_limits<uint32_t>::max() << std::endl;
2982 config.min_header_table_size = std::min(config.min_header_table_size, n);
3011 print_version(std::cout);
3026 std::cerr << "--trailer: invalid header: " << optarg << std::endl;
3037 std::cerr << "--trailer: invalid header - value missing: " << optarg
3038 << std::endl;
3057 std::cerr << "--max-concurrent-streams: Bad option value: " << optarg
3058 << std::endl;
3072 std::cerr << "--encoder-header-table-size: Bad option value: "
3073 << optarg << std::endl;
3076 if (n > std::numeric_limits<uint32_t>::max()) {
3077 std::cerr << "--encoder-header-table-size: Value too large. It "
3079 << std::numeric_limits<uint32_t>::max() << std::endl;
3106 config.weight.insert(std::end(config.weight), argc - optind, weight_to_fill);
3110 std::find_if(std::begin(config.headers), std::end(config.headers),
3112 if (scheme_it != std::end(config.headers)) {
3118 std::find_if(std::begin(config.headers), std::end(config.headers),
3120 if (authority_it == std::end(config.headers)) {
3122 std::find_if(std::begin(config.headers), std::end(config.headers),
3126 if (authority_it != std::end(config.headers)) {
3131 std::cerr << "[ERROR] Could not parse authority in "
3133 << std::endl;