diff options
author | David Kalnischkies <david@kalnischkies.de> | 2016-07-31 18:05:56 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2016-08-10 23:19:44 +0200 |
commit | 30060442025824c491f58887ca7369f3c572fa57 (patch) | |
tree | be5a114540fe297adf3c1bf9c167d8b8c627575b /methods/http_main.cc | |
parent | 4bba5a88d0f6afde4414b586b64c48a4851d5324 (diff) |
implement generic config fallback for methods
The https method implemented for a long while now a hardcoded fallback
to the same options in http, which, while it works, is rather inflexible
if we want to allow the methods to use another name to change their
behavior slightly, like apt-transport-tor does to https – most of the
diff being s#https#tor#g which then fails to do the full circle
fallthrough tor -> https -> http for https sources. With this config
infrastructure this could be implemented now.
Diffstat (limited to 'methods/http_main.cc')
-rw-r--r-- | methods/http_main.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/methods/http_main.cc b/methods/http_main.cc index fa183ddb3..1e56044b7 100644 --- a/methods/http_main.cc +++ b/methods/http_main.cc @@ -5,11 +5,13 @@ #include "http.h" -int main() +int main(int, const char *argv[]) { // ignore SIGPIPE, this can happen on write() if the socket // closes the connection (this is dealt with via ServerDie()) signal(SIGPIPE, SIG_IGN); - - return HttpMethod().Loop(); + std::string Binary = flNotDir(argv[0]); + if (Binary.find('+') == std::string::npos && Binary != "http") + Binary.append("+http"); + return HttpMethod(std::move(Binary)).Loop(); } |