Display any SSL or HTTP errors that occur when creating a grooveshark session
(cherry picked from commit ff92815ef0
)
This commit is contained in:
parent
d5fcc1a24e
commit
fd1c133e24
|
@ -366,6 +366,13 @@ void GroovesharkService::SessionCreated() {
|
||||||
|
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
|
|
||||||
|
if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() != 200) {
|
||||||
|
emit StreamError("Failed to create Grooveshark session: " +
|
||||||
|
reply->errorString());
|
||||||
|
emit LoginFinished(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QVariantMap result = ExtractResult(reply);
|
QVariantMap result = ExtractResult(reply);
|
||||||
if (!result["success"].toBool()) {
|
if (!result["success"].toBool()) {
|
||||||
qLog(Error) << "Grooveshark returned an error during session creation";
|
qLog(Error) << "Grooveshark returned an error during session creation";
|
||||||
|
@ -1377,9 +1384,23 @@ QNetworkReply* GroovesharkService::CreateRequest(const QString& method_name, QLi
|
||||||
QNetworkRequest req(url);
|
QNetworkRequest req(url);
|
||||||
QNetworkReply *reply = network_->post(req, post_params);
|
QNetworkReply *reply = network_->post(req, post_params);
|
||||||
|
|
||||||
|
if (use_https) {
|
||||||
|
connect(reply, SIGNAL(sslErrors(QList<QSslError>)),
|
||||||
|
SLOT(RequestSslErrors(QList<QSslError>)));
|
||||||
|
}
|
||||||
|
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GroovesharkService::RequestSslErrors(const QList<QSslError>& errors) {
|
||||||
|
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
|
||||||
|
|
||||||
|
foreach (const QSslError& error, errors) {
|
||||||
|
emit StreamError("SSL error occurred in Grooveshark request for " +
|
||||||
|
reply->url().toString() + ": " + error.errorString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool GroovesharkService::WaitForReply(QNetworkReply* reply) {
|
bool GroovesharkService::WaitForReply(QNetworkReply* reply) {
|
||||||
QEventLoop event_loop;
|
QEventLoop event_loop;
|
||||||
QTimer timeout_timer;
|
QTimer timeout_timer;
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
#include "internetmodel.h"
|
#include "internetmodel.h"
|
||||||
#include "internetservice.h"
|
#include "internetservice.h"
|
||||||
|
|
||||||
|
#include <QSslError>
|
||||||
|
|
||||||
class GroovesharkUrlHandler;
|
class GroovesharkUrlHandler;
|
||||||
class NetworkAccessManager;
|
class NetworkAccessManager;
|
||||||
class Playlist;
|
class Playlist;
|
||||||
|
@ -174,6 +176,8 @@ class GroovesharkService : public InternetService {
|
||||||
void StreamMarked();
|
void StreamMarked();
|
||||||
void SongMarkedAsComplete();
|
void SongMarkedAsComplete();
|
||||||
|
|
||||||
|
void RequestSslErrors(const QList<QSslError>& errors);
|
||||||
|
|
||||||
void Homepage();
|
void Homepage();
|
||||||
// Refresh all Grooveshark's items, and re-fill them
|
// Refresh all Grooveshark's items, and re-fill them
|
||||||
void RefreshItems();
|
void RefreshItems();
|
||||||
|
|
Loading…
Reference in New Issue