Commit a53aed96 authored by Volker Krause's avatar Volker Krause

Remove all traces of using Gravatar without transport security

Summary:
This was effectively disabled in the UI already, but code that doesn't
exist also can't accidentally be reactivated :)

Reviewers: #kde_pim, mlaurent

Reviewed By: #kde_pim, mlaurent

Subscribers: mlaurent

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D7408
parent 0448ce09
cmake_minimum_required(VERSION 3.0)
set(PIM_VERSION "5.6.40")
set(PIM_VERSION "5.6.41")
project(gravatar VERSION ${PIM_VERSION})
......
......@@ -57,10 +57,6 @@ void GravatarDownloadPixmapWidgetTest::shouldHaveDefaultValue()
QCheckBox *fallBackGravatar = w.findChild<QCheckBox *>(QStringLiteral("fallbackgravatar"));
QVERIFY(fallBackGravatar);
QVERIFY(!fallBackGravatar->isChecked());
QCheckBox *useHttps = w.findChild<QCheckBox *>(QStringLiteral("usehttps"));
QVERIFY(useHttps);
QVERIFY(!useHttps->isChecked());
}
void GravatarDownloadPixmapWidgetTest::shouldChangeButtonEnableState()
......
......@@ -41,7 +41,6 @@ void GravatarResolvUrlJobTest::shouldHaveDefaultValue()
QCOMPARE(job.useCache(), false);
QCOMPARE(job.useLibravatar(), false);
QCOMPARE(job.fallbackGravatar(), true);
QVERIFY(!job.useHttps());
}
void GravatarResolvUrlJobTest::shouldChangeValue()
......@@ -76,13 +75,6 @@ void GravatarResolvUrlJobTest::shouldChangeValue()
fallBackGravatar = true;
job.setFallbackGravatar(fallBackGravatar);
QCOMPARE(job.fallbackGravatar(), fallBackGravatar);
bool useHttps = false;
job.setUseHttps(useHttps);
QCOMPARE(job.useHttps(), useHttps);
useHttps = true;
job.setUseHttps(useHttps);
QCOMPARE(job.useHttps(), useHttps);
}
void GravatarResolvUrlJobTest::shouldChangeSize()
......@@ -115,10 +107,10 @@ void GravatarResolvUrlJobTest::shouldAddSizeInUrl()
job.setSize(1024);
job.setUseLibravatar(false);
QUrl url = job.generateGravatarUrl(job.useLibravatar());
QCOMPARE(url, QUrl(QStringLiteral("http://www.gravatar.com:80/avatar/89b4e14cf2fc6d426275c019c6dc9de6?d=404&s=1024")));
QCOMPARE(url, QUrl(QStringLiteral("https://secure.gravatar.com:443/avatar/89b4e14cf2fc6d426275c019c6dc9de6?d=404&s=1024")));
job.setUseLibravatar(true);
url = job.generateGravatarUrl(job.useLibravatar());
QCOMPARE(url, QUrl(QStringLiteral("http://cdn.libravatar.org:80/avatar/2726400c3a33ce56c0ff632cbc0474f766d3b36e68819c601fb02954c1681d85?d=404&s=1024")));
QCOMPARE(url, QUrl(QStringLiteral("https://seccdn.libravatar.org:443/avatar/2726400c3a33ce56c0ff632cbc0474f766d3b36e68819c601fb02954c1681d85?d=404&s=1024")));
}
void GravatarResolvUrlJobTest::shouldUseDefaultPixmap()
......@@ -128,7 +120,7 @@ void GravatarResolvUrlJobTest::shouldUseDefaultPixmap()
job.setSize(1024);
job.setUseDefaultPixmap(true);
QUrl url = job.generateGravatarUrl(job.useLibravatar());
QCOMPARE(url, QUrl(QStringLiteral("http://www.gravatar.com:80/avatar/89b4e14cf2fc6d426275c019c6dc9de6?s=1024")));
QCOMPARE(url, QUrl(QStringLiteral("https://secure.gravatar.com:443/avatar/89b4e14cf2fc6d426275c019c6dc9de6?s=1024")));
}
void GravatarResolvUrlJobTest::shouldUseHttps()
......@@ -137,7 +129,6 @@ void GravatarResolvUrlJobTest::shouldUseHttps()
job.setEmail(QStringLiteral("foo@kde.org"));
job.setSize(1024);
job.setUseLibravatar(false);
job.setUseHttps(true);
QUrl url = job.generateGravatarUrl(job.useLibravatar());
QCOMPARE(url, QUrl(QStringLiteral("https://secure.gravatar.com:443/avatar/89b4e14cf2fc6d426275c019c6dc9de6?d=404&s=1024")));
job.setUseLibravatar(true);
......@@ -169,9 +160,9 @@ void GravatarResolvUrlJobTest::shouldGenerateGravatarUrl_data()
QTest::newRow("empty") << QString() << QString() << QUrl() << false;
QTest::newRow("no domain") << QStringLiteral("foo") << QString() << QUrl() << false;
QTest::newRow("validemail") << QStringLiteral("foo@kde.org") << QStringLiteral("89b4e14cf2fc6d426275c019c6dc9de6")
<< QUrl(QStringLiteral("http://www.gravatar.com:80/avatar/89b4e14cf2fc6d426275c019c6dc9de6?d=404")) << false;
<< QUrl(QStringLiteral("https://secure.gravatar.com:443/avatar/89b4e14cf2fc6d426275c019c6dc9de6?d=404")) << false;
QTest::newRow("validemaillibravatar") << QStringLiteral("foo@kde.org") << QStringLiteral("2726400c3a33ce56c0ff632cbc0474f766d3b36e68819c601fb02954c1681d85")
<< QUrl(QStringLiteral("http://cdn.libravatar.org:80/avatar/2726400c3a33ce56c0ff632cbc0474f766d3b36e68819c601fb02954c1681d85?d=404")) << true;
<< QUrl(QStringLiteral("https://seccdn.libravatar.org:443/avatar/2726400c3a33ce56c0ff632cbc0474f766d3b36e68819c601fb02954c1681d85?d=404")) << true;
}
void GravatarResolvUrlJobTest::shouldGenerateGravatarUrl()
......
......@@ -42,7 +42,6 @@ public:
, mUseLibravatar(false)
, mFallbackGravatar(true)
, mFallbackDone(false)
, mUseHttps(false)
{
}
......@@ -57,7 +56,6 @@ public:
bool mUseLibravatar;
bool mFallbackGravatar;
bool mFallbackDone;
bool mUseHttps;
};
GravatarResolvUrlJob::GravatarResolvUrlJob(QObject *parent)
......@@ -169,16 +167,6 @@ QString GravatarResolvUrlJob::calculateHash(bool useLibravator)
return QString::fromUtf8(hash.result().toHex());
}
bool GravatarResolvUrlJob::useHttps() const
{
return d->mUseHttps;
}
void GravatarResolvUrlJob::setUseHttps(bool useHttps)
{
d->mUseHttps = useHttps;
}
bool GravatarResolvUrlJob::fallbackGravatar() const
{
return d->mFallbackGravatar;
......@@ -259,13 +247,13 @@ QUrl GravatarResolvUrlJob::createUrl(bool useLibravatar)
if (d->mSize != 80) {
query.addQueryItem(QStringLiteral("s"), QString::number(d->mSize));
}
url.setScheme(d->mUseHttps ? QStringLiteral("https") : QStringLiteral("http"));
url.setScheme(QStringLiteral("https"));
if (useLibravatar) {
url.setHost(d->mUseHttps ? QStringLiteral("seccdn.libravatar.org") : QStringLiteral("cdn.libravatar.org"));
url.setHost(QStringLiteral("seccdn.libravatar.org"));
} else {
url.setHost(d->mUseHttps ? QStringLiteral("secure.gravatar.com") : QStringLiteral("www.gravatar.com"));
url.setHost(QStringLiteral("secure.gravatar.com"));
}
url.setPort(d->mUseHttps ? 443 : 80);
url.setPort(443);
d->mCalculatedHash = calculateHash(useLibravatar);
url.setPath(QLatin1String("/avatar/") + d->mCalculatedHash);
url.setQuery(query);
......
......@@ -64,9 +64,6 @@ public:
bool fallbackGravatar() const;
void setFallbackGravatar(bool fallbackGravatar);
bool useHttps() const;
void setUseHttps(bool useHttps);
Q_SIGNALS:
void finished(Gravatar::GravatarResolvUrlJob *);
void resolvUrl(const QUrl &url);
......
......@@ -18,10 +18,5 @@ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 http://www.kde.org/sta
<entry name="LibravatarSupportEnabled" type="Bool">
<default>false</default>
</entry>
<entry name="GravatarHttpsSupport" type="Bool">
<default>false</default>
</entry>
</group>
</kcfg>
......@@ -112,7 +112,6 @@ void GravatarConfigureSettingsDialog::save()
saveSpinBox(mGravatarCacheSize, Gravatar::GravatarSettings::self()->gravatarCacheSizeItem());
saveCheckBox(mFallbackGravatar, Gravatar::GravatarSettings::self()->fallbackToGravatarItem());
saveCheckBox(mUseLibravatar, Gravatar::GravatarSettings::self()->libravatarSupportEnabledItem());
//saveCheckBox(mUseHttps, Gravatar::GravatarSettings::self()->gravatarHttpsSupportItem());
accept();
}
......@@ -122,7 +121,6 @@ void GravatarConfigureSettingsDialog::load()
loadWidget(mGravatarCacheSize, Gravatar::GravatarSettings::self()->gravatarCacheSizeItem());
loadWidget(mFallbackGravatar, Gravatar::GravatarSettings::self()->fallbackToGravatarItem());
loadWidget(mUseLibravatar, Gravatar::GravatarSettings::self()->libravatarSupportEnabledItem());
//loadWidget(mUseHttps, Gravatar::GravatarSettings::self()->gravatarHttpsSupportItem());
}
void GravatarConfigureSettingsDialog::slotClearGravatarCache()
......
......@@ -43,7 +43,6 @@ private:
QCheckBox *mUseDefaultPixmap;
QCheckBox *mUseLibravatar;
QCheckBox *mFallbackGravatar;
//QCheckBox *mUseHttps;
QPushButton *mClearGravatarCache;
KPluralHandlingSpinBox *mGravatarCacheSize;
};
......
......@@ -42,10 +42,6 @@ GravatarDownloadPixmapWidget::GravatarDownloadPixmapWidget(QWidget *parent)
connect(mLineEdit, &QLineEdit::textChanged, this, &GravatarDownloadPixmapWidget::slotTextChanged);
hbox->addWidget(mLineEdit);
mUseHttps = new QCheckBox(i18n("Use HTTPS Protocol"));
mUseHttps->setObjectName(QStringLiteral("usehttps"));
mainLayout->addWidget(mUseHttps);
mUseLibravatar = new QCheckBox(i18n("Use Libravatar"));
mUseLibravatar->setObjectName(QStringLiteral("uselibravatar"));
mainLayout->addWidget(mUseLibravatar);
......@@ -100,7 +96,6 @@ void GravatarDownloadPixmapWidget::slotSearchButton()
//job->setUseDefaultPixmap(true);
job->setUseLibravatar(mUseLibravatar->isChecked());
job->setFallbackGravatar(mFallbackGravatar->isChecked());
job->setUseHttps(mUseHttps->isChecked());
//qDebug() << job->generateGravatarUrl(false);
if (job->canStart()) {
connect(job, &GravatarResolvUrlJob::finished, this, &GravatarDownloadPixmapWidget::slotResolvUrlFinish);
......
......@@ -49,7 +49,6 @@ private:
QPushButton *mGetPixmapButton;
QCheckBox *mUseLibravatar;
QCheckBox *mFallbackGravatar;
QCheckBox *mUseHttps;
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment