aboutsummaryrefslogtreecommitdiff
path: root/launcher/net/HeaderProxy.h
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2023-08-10 20:38:32 +0200
committerSefa Eyeoglu <contact@scrumplex.net>2023-08-10 20:38:32 +0200
commitef6f9487f48ee6f114d47108977380fb4c278597 (patch)
tree57945b096640c87a976223daace6ecc27613d4c1 /launcher/net/HeaderProxy.h
parent81bc9e488f653eba3e29d63b51c95f73f03ad182 (diff)
parent2090f958c8d1940238fe08f98eee2145edb12906 (diff)
downloadPrismLauncher-ef6f9487f48ee6f114d47108977380fb4c278597.tar.gz
PrismLauncher-ef6f9487f48ee6f114d47108977380fb4c278597.tar.bz2
PrismLauncher-ef6f9487f48ee6f114d47108977380fb4c278597.zip
Merge remote-tracking branch 'upstream/staging' into chore/add-compiler-warnings
Diffstat (limited to 'launcher/net/HeaderProxy.h')
-rw-r--r--launcher/net/HeaderProxy.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/launcher/net/HeaderProxy.h b/launcher/net/HeaderProxy.h
new file mode 100644
index 00000000..f41c5875
--- /dev/null
+++ b/launcher/net/HeaderProxy.h
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: GPL-3.0-only
+/*
+ * Prism Launcher - Minecraft Launcher
+ * Copyright (C) 2023 Rachel Powers <508861+Ryex@users.noreply.github.com>
+ *
+ * This program 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, version 3.
+ *
+ * This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#pragma once
+
+#include <QDebug>
+#include <QNetworkRequest>
+
+namespace Net {
+
+struct HeaderPair {
+ QByteArray headerName;
+ QByteArray headerValue;
+};
+
+class HeaderProxy {
+ public:
+ HeaderProxy(){};
+ virtual ~HeaderProxy(){};
+
+ public:
+ virtual QList<HeaderPair> headers(const QNetworkRequest& request) const = 0;
+
+ public:
+ void writeHeaders(QNetworkRequest& request)
+ {
+ for (auto header : headers(request)) {
+ request.setRawHeader(header.headerName, header.headerValue);
+ }
+ }
+};
+
+} // namespace Net