mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-05-02 21:52:30 +02:00
Several improvements to HTTPServer.
This commit is contained in:
parent
1ec31125b0
commit
17cd149e7f
9 changed files with 254 additions and 55 deletions
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue