24 using namespace folly;
29 "HTTP method to use. GET or POST are supported");
31 "URL to perform the HTTP method against");
33 "Filename to read from for POST requests");
35 "connect timeout in milliseconds");
37 "Path to trusted CA file");
39 "Path to client certificate file");
41 "Path to client private key file");
42 DEFINE_string(next_protos,
"h2,h2-14,spdy/3.1,spdy/3,http/1.1",
43 "Next protocol string for NPN/ALPN");
45 DEFINE_int32(recv_window, 65536,
"Flow control receive window for h2/spdy");
46 DEFINE_bool(h2c,
true,
"Attempt HTTP/1.1 -> HTTP/2 upgrade");
47 DEFINE_string(headers,
"",
"List of N=V headers separated by ,");
51 gflags::ParseCommandLineFlags(&argc, &argv,
true);
52 google::InitGoogleLogging(argv[0]);
53 google::InstallFailureSignalHandler();
57 URL proxy(FLAGS_proxy);
59 if (FLAGS_http_method !=
"GET" && FLAGS_http_method !=
"POST") {
60 LOG(
ERROR) <<
"http_method must be either GET or POST";
65 if (httpMethod == HTTPMethod::POST) {
67 File f(FLAGS_input_filename);
69 }
catch (
const std::system_error& se) {
70 LOG(
ERROR) <<
"Couldn't open file for POST method";
71 LOG(
ERROR) << se.what();
81 FLAGS_proxy.empty() ?
nullptr : &proxy,
88 if (!FLAGS_proxy.empty()) {
93 LOG(
INFO) <<
"Trying to connect to " <<
addr;
99 std::chrono::milliseconds(HHWheelTimer::DEFAULT_TICK_INTERVAL),
100 AsyncTimeout::InternalEnum::NORMAL,
101 std::chrono::milliseconds(5000))};
103 if (!FLAGS_plaintext_proto.empty()) {
109 curlClient.initializeSsl(
110 FLAGS_ca_path, FLAGS_next_protos, FLAGS_cert_path, FLAGS_key_path);
111 connector.connectSSL(
114 curlClient.getSSLContext(),
116 std::chrono::milliseconds(FLAGS_http_client_connect_timeout),
119 curlClient.getServerName());
121 connector.connect(&evb, addr,
122 std::chrono::milliseconds(FLAGS_http_client_connect_timeout), opts);
static proxygen::HTTPHeaders parseHeaders(const std::string &headersString)
int main(int argc, char *argv[])
folly::Optional< HTTPMethod > stringToMethod(folly::StringPiece method)
const std::string & getHost() const noexcept
void setFlowControlSettings(int32_t recvWindow)
—— Concurrent Priority Queue Implementation ——
std::map< OptionKey, int > OptionMap
DEFINE_int32(http_client_connect_timeout, 1000,"connect timeout in milliseconds")
static const folly::SocketAddress & anyAddress()
void setPlaintextProtocol(const std::string &plaintextProto)
std::unique_ptr< HHWheelTimer, Destructor > UniquePtr
bool isSecure() const noexcept
DEFINE_string(http_method,"GET","HTTP method to use. GET or POST are supported")
uint16_t getPort() const noexcept
DEFINE_bool(h2c, true,"Attempt HTTP/1.1 -> HTTP/2 upgrade")
ThreadPoolListHook * addr