diff --git a/src/Client/Request.cpp b/src/Client/Request.cpp index b4a60fd..7664df1 100644 --- a/src/Client/Request.cpp +++ b/src/Client/Request.cpp @@ -8,6 +8,8 @@ Request::Request() _ret = 200; _contentLength = 0; _chunked = false; + _head_ok = false; + _body_ok = false; } Request::Request(char *str) @@ -71,6 +73,16 @@ bool Request::getChunked(void) { return (_chunked); } + +unsigned int Request::getContentLength(void) const +{ + return (_contentLength); +} +unsigned int Request::getHeaderSize(void) const +{ + return (_headerSize); +} + void Request::setData(char *str) { this->_data = str; @@ -142,6 +154,7 @@ void Request::splitData(char *data) return; } _head = str.substr(0, pos) + "\n"; + _headerSize = _head.size() + 3; str.erase(0, pos + 4); _head_ok = true; parseHeader(); diff --git a/src/Client/Request.hpp b/src/Client/Request.hpp index 850704e..56528d4 100644 --- a/src/Client/Request.hpp +++ b/src/Client/Request.hpp @@ -13,6 +13,7 @@ private: int _ret; int _row; unsigned int _contentLength; + unsigned int _headerSize; std::string _URI; std::string _head; @@ -40,6 +41,8 @@ public: std::string getLocation(void); ServerConfig *getConfig(void); int getCode(void); + unsigned int getContentLength(void) const; + unsigned int getHeaderSize(void) const; std::map getClientFields(void); bool getChunked(void); @@ -73,4 +76,4 @@ public: -#endif \ No newline at end of file +#endif