code: Initial Commit

This commit is contained in:
Vaxry
2025-04-12 20:06:56 +01:00
parent cf925610f4
commit fdc616ac69
23 changed files with 1349 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
#include <pistache/http_headers.h>
#include <pistache/net.h>
class AuthorizationHeader : public Pistache::Http::Header::Header {
public:
NAME("Authorization");
AuthorizationHeader() = default;
void parse(const std::string& str) override {
m_token = str;
}
void write(std::ostream& os) const override {
os << m_token;
}
std::string token() const {
return m_token;
}
private:
std::string m_token = "";
};

24
src/headers/cfHeader.hpp Normal file
View File

@@ -0,0 +1,24 @@
#include <pistache/http_headers.h>
#include <pistache/net.h>
class CFConnectingIPHeader : public Pistache::Http::Header::Header {
public:
NAME("cf-connecting-ip");
CFConnectingIPHeader() = default;
void parse(const std::string& str) override {
m_ip = str;
}
void write(std::ostream& os) const override {
os << m_ip;
}
std::string ip() const {
return m_ip;
}
private:
std::string m_ip = "";
};

View File

@@ -0,0 +1,24 @@
#include <pistache/http_headers.h>
#include <pistache/net.h>
class XForwardedForHeader : public Pistache::Http::Header::Header {
public:
NAME("X-Forwarded-For");
XForwardedForHeader() = default;
void parse(const std::string& str) override {
m_for = str;
}
void write(std::ostream& os) const override {
os << m_for;
}
std::string from() const {
return m_for;
}
private:
std::string m_for = "";
};