D9885: Retrieve OAuth2 token with HTTP socket
Laurent Montel
noreply at phabricator.kde.org
Wed Jan 17 08:03:05 GMT 2018
mlaurent added inline comments.
INLINE COMMENTS
> authwidget.cpp:104
> + d->server = new QTcpServer(this);
> + if (! d->server->listen(QHostAddress::LocalHost)) {
> + Q_EMIT error(InvalidAccount, tr("Could not start oauth http server"));
remove space after !
> authwidget_p.cpp:247
>
> -void AuthWidgetPrivate::webviewFinished(bool ok)
> -{
> - if (!ok) {
> - qCWarning(KGAPIDebug) << "Failed to load" << webview->url();
> - }
> +void AuthWidgetPrivate::socketReady() {
> + QByteArray data = connection->readLine();
new line after '()'
> authwidget_p.cpp:248
> +void AuthWidgetPrivate::socketReady() {
> + QByteArray data = connection->readLine();
> + connection->deleteLater();
const QByteArray ?
> authwidget_p.cpp:258
>
> - if (!isGoogleHost(url)) {
> + QStringList line = QString::fromLatin1(data).split(QStringLiteral(" "));
> + if (line.size() != 3 || line.at(0) != QStringLiteral("GET") || !line.at(2).startsWith(QStringLiteral("HTTP/1.1"))) {
QLAtin1Char(' ') + const QStringList
> authwidget_p.cpp:259
> + QStringList line = QString::fromLatin1(data).split(QStringLiteral(" "));
> + if (line.size() != 3 || line.at(0) != QStringLiteral("GET") || !line.at(2).startsWith(QStringLiteral("HTTP/1.1"))) {
> + qCDebug(KGAPIDebug) << QStringLiteral("Token response invalid");
it will crash if line is empty no or == 1 ? Perhaps you can test it no ?
> authwidget_p.cpp:270
> + if (code.isEmpty()) {
> + QString error = query.queryItemValue(QStringLiteral("error"));
> + if (!error.isEmpty()) {
const
REPOSITORY
R477 KGAPI Library
REVISION DETAIL
https://phabricator.kde.org/D9885
To: davidk, mlaurent, dvratil, #kde_pim
Cc: dvasin, winterz, vkrause, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20180117/e0cd90de/attachment.html>
More information about the kde-pim
mailing list