Display any SSL or HTTP errors that occur when creating a grooveshark session
(cherry picked from commit ff92815ef071abcbddf0bc7c60ffb471716d9465)
This commit is contained in:
parent
d5fcc1a24e
commit
fd1c133e24
@ -366,6 +366,13 @@ void GroovesharkService::SessionCreated() {
|
||||
|
||||
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);
|
||||
if (!result["success"].toBool()) {
|
||||
qLog(Error) << "Grooveshark returned an error during session creation";
|
||||
@ -1377,9 +1384,23 @@ QNetworkReply* GroovesharkService::CreateRequest(const QString& method_name, QLi
|
||||
QNetworkRequest req(url);
|
||||
QNetworkReply *reply = network_->post(req, post_params);
|
||||
|
||||
if (use_https) {
|
||||
connect(reply, SIGNAL(sslErrors(QList<QSslError>)),
|
||||
SLOT(RequestSslErrors(QList<QSslError>)));
|
||||
}
|
||||
|
||||
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) {
|
||||
QEventLoop event_loop;
|
||||
QTimer timeout_timer;
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include "internetmodel.h"
|
||||
#include "internetservice.h"
|
||||
|
||||
#include <QSslError>
|
||||
|
||||
class GroovesharkUrlHandler;
|
||||
class NetworkAccessManager;
|
||||
class Playlist;
|
||||
@ -174,6 +176,8 @@ class GroovesharkService : public InternetService {
|
||||
void StreamMarked();
|
||||
void SongMarkedAsComplete();
|
||||
|
||||
void RequestSslErrors(const QList<QSslError>& errors);
|
||||
|
||||
void Homepage();
|
||||
// Refresh all Grooveshark's items, and re-fill them
|
||||
void RefreshItems();
|
||||
|
Loading…
x
Reference in New Issue
Block a user