Skip to content

Commit

Permalink
Use proxy settings during self upgrade.
Browse files Browse the repository at this point in the history
  • Loading branch information
egorpugin committed Feb 14, 2020
1 parent dca1464 commit b286393
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/sw/client/cli/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ int parse_main(int argc, char **argv)

// create main options!
Options options;
// set http settings very early
// needed for self-upgrade feature
setHttpSettings(options);
return setup_main(args, options);
}

Expand Down
9 changes: 7 additions & 2 deletions src/sw/client/common/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,17 @@

#include <cl.llvm.h>

std::unique_ptr<sw::SwContext> createSwContext(const Options &options)
void setHttpSettings(const Options &options)
{
// load proxy settings early
httpSettings.verbose = options.curl_verbose;
httpSettings.ignore_ssl_checks = options.ignore_ssl_checks;
httpSettings.proxy = sw::Settings::get_local_settings().proxy;
}

std::unique_ptr<sw::SwContext> createSwContext(const Options &options)
{
// load proxy settings before ctx
setHttpSettings(options);

auto swctx = std::make_unique<sw::SwContext>(options.storage_dir.empty() ? sw::Settings::get_user_settings().storage_dir : options.storage_dir);
// TODO:
Expand Down
1 change: 1 addition & 0 deletions src/sw/client/common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
struct Options;

std::unique_ptr<sw::SwContext> createSwContext(const Options &);
void setHttpSettings(const Options &);

struct Program
{
Expand Down

0 comments on commit b286393

Please sign in to comment.