forked fromglynos/cpp-netlib
- Notifications
You must be signed in to change notification settings - Fork425
Thread group#590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Thread group#590
Changes from1 commit
Commits
Show all changes
3 commits Select commitHold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
PrevPrevious commit
Removed depenency on boost program_options (replaced with cxxopts, wh…
…ich only depends on C++11).
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commita7d48af2d972dfeeac9b57815764bcf3e3070069
There are no files selected for viewing
3 changes: 3 additions & 0 deletions.gitmodules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletionsCMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletionsdeps/cxxopts
1 change: 1 addition & 0 deletionslibs/network/example/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
48 changes: 18 additions & 30 deletionslibs/network/example/http_client.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -15,48 +15,36 @@ | ||
| #include <string> | ||
| #include <utility> | ||
| #include <iostream> | ||
| #include "cxxopts.hpp" | ||
| int main(int argc, char* argv[]) { | ||
| using namespace boost::network; | ||
| cxxopts::Options options(argv[0], "Allowed options"); | ||
| options.add_options() | ||
| ("h,help", "produce help message") | ||
| ("H,headers", "print headers") | ||
| ("S,status", "print status and message") | ||
| ("s,source", "source URL", cxxopts::value<std::string>()) | ||
| ; | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. That looks really nice! | ||
| options.parse_positional(std::vector<std::string>{"source"}); | ||
| options.parse(argc, argv); | ||
| if (options.count("help")) { | ||
| std::cout << options.help({"", "Group"}) << std::endl; | ||
| return EXIT_SUCCESS; | ||
| } | ||
| if (options.count("source") < 1) { | ||
| std::cout << "Error: Source URL required." << std::endl; | ||
| std::cout << options.help({"", "Group"}) << std::endl; | ||
| return EXIT_FAILURE; | ||
| } | ||
| std::string source = options["source"].as<std::string>(); | ||
| bool show_headers = options.count("headers") ? true : false; | ||
| bool show_status = options.count("status") ? true : false; | ||
| http::client::request request(source); | ||
| http::client::string_type destination_ = host(request); | ||
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.