diff options
author | Jack Lloyd <[email protected]> | 2017-12-16 13:32:56 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-12-17 14:59:21 -0500 |
commit | 9a314557b1e38c63bcf8a404ebf31248a9402015 (patch) | |
tree | 5099ba8846f9020976785f33e6233829caeb0abe /src/cli/utils.cpp | |
parent | bcfd2761679d79471612bdf7f500b87123c1c6ab (diff) |
Expose timeouts to the HTTP API
Diffstat (limited to 'src/cli/utils.cpp')
-rw-r--r-- | src/cli/utils.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cli/utils.cpp b/src/cli/utils.cpp index 094665a00..161cc24bf 100644 --- a/src/cli/utils.cpp +++ b/src/cli/utils.cpp @@ -218,11 +218,15 @@ BOTAN_REGISTER_COMMAND("rng", RNG); class HTTP_Get final : public Command { public: - HTTP_Get() : Command("http_get url") {} + HTTP_Get() : Command("http_get --redirects=1 --timeout=3000 url") {} void go() override { - output() << Botan::HTTP::GET_sync(get_arg("url")) << "\n"; + const std::string url = get_arg("url"); + const std::chrono::milliseconds timeout(get_arg_sz("timeout")); + const size_t redirects = get_arg_sz("redirects"); + + output() << Botan::HTTP::GET_sync(url, redirects, timeout) << "\n"; } }; |