Several improvements to HTTPServer.

This commit is contained in:
EinMByte 2015-09-17 11:47:16 +02:00
parent 1ec31125b0
commit 17cd149e7f
9 changed files with 254 additions and 55 deletions

View file

@ -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);
}
}
}