chunk encoding / simple redirect support / -I option
This commit is contained in:
@ -19,7 +19,8 @@ namespace ix
|
||||
{
|
||||
int ws_http_client_main(const std::string& url,
|
||||
const std::string& headers,
|
||||
const std::string& data);
|
||||
const std::string& data,
|
||||
bool headersOnly);
|
||||
|
||||
int ws_ping_pong_main(const std::string& url);
|
||||
|
||||
@ -51,6 +52,7 @@ int main(int argc, char** argv)
|
||||
std::string user;
|
||||
std::string data;
|
||||
std::string headers;
|
||||
bool headersOnly = false;
|
||||
int port = 8080;
|
||||
|
||||
CLI::App* sendApp = app.add_subcommand("send", "Send a file");
|
||||
@ -85,6 +87,7 @@ int main(int argc, char** argv)
|
||||
httpClientApp->add_option("-d", data, "Form data")->join();
|
||||
httpClientApp->add_option("-F", data, "Form data")->join();
|
||||
httpClientApp->add_option("-H", headers, "Header")->join();
|
||||
httpClientApp->add_flag("-I", headersOnly, "Header");
|
||||
|
||||
CLI11_PARSE(app, argc, argv);
|
||||
|
||||
@ -126,7 +129,7 @@ int main(int argc, char** argv)
|
||||
else if (app.got_subcommand("http_client"))
|
||||
{
|
||||
std::cout << "data: " << data << std::endl;
|
||||
return ix::ws_http_client_main(url, headers, data);
|
||||
return ix::ws_http_client_main(url, headers, data, headersOnly);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -67,7 +67,8 @@ namespace ix
|
||||
|
||||
int ws_http_client_main(const std::string& url,
|
||||
const std::string& headersData,
|
||||
const std::string& data)
|
||||
const std::string& data,
|
||||
bool headersOnly)
|
||||
{
|
||||
HttpParameters httpParameters = parsePostParameters(data);
|
||||
WebSocketHttpHeaders headers = parseHeaders(headersData);
|
||||
@ -99,7 +100,10 @@ namespace ix
|
||||
std::cout << "error message: " << errorMsg << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "payload: " << payload << std::endl;
|
||||
if (!headersOnly)
|
||||
{
|
||||
std::cout << "payload: " << payload << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user