mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
WebContent+WebWorker: Use custom certificate paths with Qt networking
This change adds a `--certificate` option to both WebContent and WebWorker, which allows one or more custom root certificate paths to be specified. Certificates are then loaded from these paths when Qt networking is used. This allows WPT tests that require a https connection to be run locally with Qt networking.
This commit is contained in:
parent
772d64aca2
commit
28b95e8ed0
Notes:
sideshowbarker
2024-07-17 01:12:07 +09:00
Author: https://github.com/tcl3
Commit: 28b95e8ed0
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/549
4 changed files with 18 additions and 6 deletions
|
|
@ -5,15 +5,24 @@
|
|||
*/
|
||||
|
||||
#include "RequestManagerQt.h"
|
||||
#include "StringUtils.h"
|
||||
#include "WebSocketImplQt.h"
|
||||
#include "WebSocketQt.h"
|
||||
#include <QNetworkCookie>
|
||||
|
||||
namespace Ladybird {
|
||||
|
||||
RequestManagerQt::RequestManagerQt()
|
||||
RequestManagerQt::RequestManagerQt(Vector<ByteString> const& certificate_paths)
|
||||
{
|
||||
m_qnam = new QNetworkAccessManager(this);
|
||||
auto ssl_configuration = QSslConfiguration::defaultConfiguration();
|
||||
ssl_configuration.setPeerVerifyMode(QSslSocket::VerifyNone);
|
||||
for (auto const& certificate_path : certificate_paths) {
|
||||
auto certificates = QSslCertificate::fromPath(qstring_from_ak_string(certificate_path));
|
||||
for (auto const& certificate : certificates)
|
||||
ssl_configuration.addCaCertificate(certificate);
|
||||
}
|
||||
QSslConfiguration::setDefaultConfiguration(ssl_configuration);
|
||||
|
||||
QObject::connect(m_qnam, &QNetworkAccessManager::finished, this, &RequestManagerQt::reply_finished);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue