mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
Several improvements to HTTPServer.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
|
||||
namespace i2p {
|
||||
namespace util {
|
||||
@@ -13,6 +14,10 @@ class Request {
|
||||
void parseRequestLine(const std::string& line);
|
||||
|
||||
void parseHeaderLine(const std::string& line);
|
||||
|
||||
void parseHeader(std::stringstream& ss);
|
||||
|
||||
void setIsComplete();
|
||||
public:
|
||||
Request() = default;
|
||||
|
||||
@@ -33,13 +38,26 @@ public:
|
||||
|
||||
std::string getContent() const;
|
||||
|
||||
bool hasData() const;
|
||||
|
||||
bool isComplete() const;
|
||||
|
||||
void clear();
|
||||
|
||||
void update(const std::string& data);
|
||||
|
||||
private:
|
||||
std::string header_part;
|
||||
|
||||
std::string method;
|
||||
std::string uri;
|
||||
std::string host;
|
||||
std::string content;
|
||||
int port;
|
||||
std::map<std::string, std::string> headers;
|
||||
bool has_data;
|
||||
bool has_header;
|
||||
bool is_complete;
|
||||
};
|
||||
|
||||
class Response {
|
||||
@@ -69,6 +87,11 @@ private:
|
||||
std::map<std::string, std::string> headers;
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle server side includes.
|
||||
*/
|
||||
std::string preprocessContent(const std::string& content, const std::string& path);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user