code: Initial Commit
This commit is contained in:
24
src/headers/authorization.hpp
Normal file
24
src/headers/authorization.hpp
Normal 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
24
src/headers/cfHeader.hpp
Normal 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 = "";
|
||||
};
|
||||
24
src/headers/xforwardfor.hpp
Normal file
24
src/headers/xforwardfor.hpp
Normal 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 = "";
|
||||
};
|
||||
Reference in New Issue
Block a user