From d347e6fc5f24c13273bae3d68bd16619d31cdfa4 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Wed, 24 Aug 2022 20:34:10 +0200 Subject: [PATCH] Add setting for turning off HTTP/2 --- src/engine/enginebase.cpp | 9 +++++++++ src/engine/enginebase.h | 1 + src/settings/backendsettingspage.cpp | 4 ++++ src/settings/backendsettingspage.ui | 7 +++++++ 4 files changed, 21 insertions(+) diff --git a/src/engine/enginebase.cpp b/src/engine/enginebase.cpp index d37cb9f9f..85d508945 100644 --- a/src/engine/enginebase.cpp +++ b/src/engine/enginebase.cpp @@ -30,6 +30,7 @@ #include #include +#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); diff --git a/src/engine/enginebase.h b/src/engine/enginebase.h index 15dde6e20..ea05676f7 100644 --- a/src/engine/enginebase.h +++ b/src/engine/enginebase.h @@ -212,6 +212,7 @@ class Base : public QObject { // Options bool bs2b_enabled_; + bool http2_enabled_; private: bool about_to_end_emitted_; diff --git a/src/settings/backendsettingspage.cpp b/src/settings/backendsettingspage.cpp index 1897317e9..86a11f646 100644 --- a/src/settings/backendsettingspage.cpp +++ b/src/settings/backendsettingspage.cpp @@ -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()); diff --git a/src/settings/backendsettingspage.ui b/src/settings/backendsettingspage.ui index 4a5af428f..fec2b8c74 100644 --- a/src/settings/backendsettingspage.ui +++ b/src/settings/backendsettingspage.ui @@ -252,6 +252,13 @@ + + + + Enable HTTP/2 for streaming + + +