Add setting for turning off HTTP/2

This commit is contained in:
Jonas Kvinge 2022-08-24 20:34:10 +02:00
parent 27b01d3642
commit d347e6fc5f
4 changed files with 21 additions and 0 deletions

View File

@ -30,6 +30,7 @@
#include <QUrl>
#include <QSettings>
#include "core/utilities.h"
#include "core/timeconstants.h"
#include "core/networkproxyfactory.h"
#include "engine_fwd.h"
@ -68,6 +69,7 @@ Engine::Base::Base(const EngineType type, QObject *parent)
channels_enabled_(false),
channels_(0),
bs2b_enabled_(false),
http2_enabled_(true),
about_to_end_emitted_(false) {}
Engine::Base::~Base() = default;
@ -145,6 +147,13 @@ void Engine::Base::ReloadSettings() {
bs2b_enabled_ = s.value("bs2b", false).toBool();
bool http2_enabled = s.value("http2", false).toBool();
if (http2_enabled != http2_enabled_) {
http2_enabled_ = http2_enabled;
Utilities::SetEnv("SOUP_FORCE_HTTP1", http2_enabled_ ? "" : "1");
qLog(Debug) << "SOUP_FORCE_HTTP1:" << (http2_enabled_ ? "OFF" : "ON");
}
s.endGroup();
s.beginGroup(NetworkProxySettingsPage::kSettingsGroup);

View File

@ -212,6 +212,7 @@ class Base : public QObject {
// Options
bool bs2b_enabled_;
bool http2_enabled_;
private:
bool about_to_end_emitted_;

View File

@ -166,6 +166,8 @@ void BackendSettingsPage::Load() {
ui_->checkbox_bs2b->setChecked(s.value("bs2b", false).toBool());
ui_->checkbox_http2->setChecked(s.value("http2", false).toBool());
ui_->spinbox_bufferduration->setValue(s.value("bufferduration", kDefaultBufferDuration).toInt());
ui_->spinbox_low_watermark->setValue(s.value("bufferlowwatermark", kDefaultBufferLowWatermark).toDouble());
ui_->spinbox_high_watermark->setValue(s.value("bufferhighwatermark", kDefaultBufferHighWatermark).toDouble());
@ -476,6 +478,8 @@ void BackendSettingsPage::Save() {
s.setValue("bs2b", ui_->checkbox_bs2b->isChecked());
s.setValue("http2", ui_->checkbox_http2->isChecked());
s.setValue("bufferduration", ui_->spinbox_bufferduration->value());
s.setValue("bufferlowwatermark", ui_->spinbox_low_watermark->value());
s.setValue("bufferhighwatermark", ui_->spinbox_high_watermark->value());

View File

@ -252,6 +252,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkbox_http2">
<property name="text">
<string>Enable HTTP/2 for streaming</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>