%-encode username/password in greader plugin, provide content-type for http/post in ClientLogin method

This commit is contained in:
Martin Rotter 2021-05-20 08:01:19 +02:00
parent e07c695b95
commit 9beb4dda8a
3 changed files with 12 additions and 3 deletions

View File

@ -30,7 +30,7 @@
<url type="donation">https://martinrotter.github.io/donate/</url>
<content_rating type="oars-1.1" />
<releases>
<release version="3.9.2" date="2021-05-19"/>
<release version="3.9.2" date="2021-05-20"/>
</releases>
<content_rating type="oars-1.0">
<content_attribute id="violence-cartoon">none</content_attribute>

View File

@ -360,6 +360,11 @@ void Application::restoreDatabaseSettings(bool restore_database, bool restore_se
}
void Application::parseCmdArgumentsFromOtherInstance(const QString& message) {
if (message.isEmpty()) {
qDebugNN << LOGSEC_CORE << "No execution message received from other app instances.";
return;
}
qDebugNN << LOGSEC_CORE
<< "Received"
<< QUOTE_W_SPACE(message)

View File

@ -379,13 +379,17 @@ QNetworkReply::NetworkError GreaderNetwork::clientLogin(const QNetworkProxy& pro
QString full_url = generateFullUrl(Operations::ClientLogin);
auto timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt();
QByteArray output;
QByteArray args = QSL("Email=%1&Passwd=%2").arg(username(), password()).toUtf8();
QByteArray args = QSL("Email=%1&Passwd=%2").arg(QString::fromLocal8Bit(QUrl::toPercentEncoding(username())),
QString::fromLocal8Bit(QUrl::toPercentEncoding(password()))).toLocal8Bit();
auto network_result = NetworkFactory::performNetworkOperation(full_url,
timeout,
args,
output,
QNetworkAccessManager::Operation::PostOperation,
{},
{ {
QSL(HTTP_HEADERS_CONTENT_TYPE).toLocal8Bit(),
QSL("application/x-www-form-urlencoded").toLocal8Bit()
} },
false,
{},
{},