summaryrefslogtreecommitdiff
path: root/src/ttrss_api.cpp
diff options
context:
space:
mode:
authorGravatar Simon Schuster <git@rationality.eu> 2017-07-26 16:46:33 +0200
committerGravatar Simon Schuster <git@rationality.eu> 2017-07-26 21:58:31 +0200
commit678a9db9c5195f3c6f2c74934b45b4cb1b4e4597 (patch)
treedd3a063dea89acd2c0ee69fd046f9a02e592d9f0 /src/ttrss_api.cpp
parentd20cf49a5b83ed209ca08def2629aae669e16b08 (diff)
downloadnewsboat-678a9db9c5195f3c6f2c74934b45b4cb1b4e4597.tar.gz
newsboat-678a9db9c5195f3c6f2c74934b45b4cb1b4e4597.tar.zst
newsboat-678a9db9c5195f3c6f2c74934b45b4cb1b4e4597.zip
TTRSS-API: only set auth_info for "Single" ttrss-mode
Currently, newsbeuter sets the HTTP-Auth parameter for all requests that target the TTRSS-api from the "ttrss-login" and "ttrss-password" config file options. This explicitly provided auth_info takes precedence over optionally provided user-information in libcurl. Therefore the following config settings urls-source "ttrss" ttrss-url "https://htuser:htpasswd@ttrssinstance.example.org" ttrss-login "ttrssuser" ttrss-password "ttrsspasswd" will try to query "trssinstance.example.org" with auth_info "ttrssuser:ttrsspasswd" and consequently fail, while libcurl as such would happily accept the auth info from "ttrss-url" when no explicit auth-info was provided. This commit rectifies this and consequently allows newsbeuter to use multiuser-TTRSS instances which are hosted behind http-basic auth.
Diffstat (limited to '')
-rw-r--r--src/ttrss_api.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/ttrss_api.cpp b/src/ttrss_api.cpp
index d63b70f0..55c0e359 100644
--- a/src/ttrss_api.cpp
+++ b/src/ttrss_api.cpp
@@ -12,7 +12,11 @@ namespace newsbeuter {
ttrss_api::ttrss_api(configcontainer * c) : remote_api(c) {
single = (cfg->get_configvalue("ttrss-mode") == "single");
- auth_info = strprintf::fmt("%s:%s", cfg->get_configvalue("ttrss-login"), cfg->get_configvalue("ttrss-password"));
+ if (single) {
+ auth_info = strprintf::fmt("%s:%s", cfg->get_configvalue("ttrss-login"), cfg->get_configvalue("ttrss-password"));
+ } else {
+ auth_info = "";
+ }
sid = "";
}
@@ -42,7 +46,11 @@ std::string ttrss_api::retrieve_sid() {
args["user"] = single ? "admin" : cred.user.c_str();
args["password"] = cred.pass.c_str();
- auth_info = strprintf::fmt("%s:%s", cred.user, cred.pass);
+ if (single) {
+ auth_info = strprintf::fmt("%s:%s", cred.user, cred.pass);
+ } else {
+ auth_info = "";
+ }
json_object * content = run_op("login", args);
if (content == nullptr)