-
Notifications
You must be signed in to change notification settings - Fork 794
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hotfix/0.3.1' into stable
- Loading branch information
Showing
8 changed files
with
127 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/**************************************************************************** | ||
** | ||
** Copyright (C) 2016 Oleg Shparber | ||
** Contact: https://go.zealdocs.org/l/contact | ||
** | ||
** This file is part of Zeal. | ||
** | ||
** Zeal is free software: you can redistribute it and/or modify | ||
** it under the terms of the GNU General Public License as published by | ||
** the Free Software Foundation, either version 3 of the License, or | ||
** (at your option) any later version. | ||
** | ||
** Zeal is distributed in the hope that it will be useful, | ||
** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
** GNU General Public License for more details. | ||
** | ||
** You should have received a copy of the GNU General Public License | ||
** along with Zeal. If not, see <https://www.gnu.org/licenses/>. | ||
** | ||
****************************************************************************/ | ||
|
||
#include "networkaccessmanager.h" | ||
|
||
#include <QNetworkRequest> | ||
|
||
using namespace Zeal::Core; | ||
|
||
NetworkAccessManager::NetworkAccessManager(QObject *parent) | ||
: QNetworkAccessManager(parent) | ||
{ | ||
} | ||
|
||
QNetworkReply *NetworkAccessManager::createRequest(QNetworkAccessManager::Operation op, | ||
const QNetworkRequest &request, | ||
QIODevice *outgoingData) | ||
{ | ||
// Detect URLs without schema, and prevent them from being requested on a local filesytem. | ||
const QUrl url = request.url(); | ||
if (url.scheme() == QLatin1String("file") && !url.host().isEmpty()) | ||
return QNetworkAccessManager::createRequest(GetOperation, QNetworkRequest(), outgoingData); | ||
|
||
return QNetworkAccessManager::createRequest(op, request, outgoingData); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/**************************************************************************** | ||
** | ||
** Copyright (C) 2016 Oleg Shparber | ||
** Contact: https://go.zealdocs.org/l/contact | ||
** | ||
** This file is part of Zeal. | ||
** | ||
** Zeal is free software: you can redistribute it and/or modify | ||
** it under the terms of the GNU General Public License as published by | ||
** the Free Software Foundation, either version 3 of the License, or | ||
** (at your option) any later version. | ||
** | ||
** Zeal is distributed in the hope that it will be useful, | ||
** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
** GNU General Public License for more details. | ||
** | ||
** You should have received a copy of the GNU General Public License | ||
** along with Zeal. If not, see <https://www.gnu.org/licenses/>. | ||
** | ||
****************************************************************************/ | ||
|
||
#ifndef ZEAL_CORE_NETWORKACCESSMANAGER_H | ||
#define ZEAL_CORE_NETWORKACCESSMANAGER_H | ||
|
||
#include <QNetworkAccessManager> | ||
|
||
namespace Zeal { | ||
namespace Core { | ||
|
||
class NetworkAccessManager : public QNetworkAccessManager | ||
{ | ||
Q_OBJECT | ||
public: | ||
NetworkAccessManager(QObject *parent = nullptr); | ||
|
||
protected: | ||
QNetworkReply *createRequest(Operation op, const QNetworkRequest &request, | ||
QIODevice *outgoingData = nullptr) override; | ||
}; | ||
|
||
} // namespace Core | ||
} // namespace Zeal | ||
|
||
#endif // ZEAL_CORE_NETWORKACCESSMANAGER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters