diff --git a/src/Client/Response.cpp b/src/Client/Response.cpp index 8a37901..2a29dfd 100644 --- a/src/Client/Response.cpp +++ b/src/Client/Response.cpp @@ -27,6 +27,21 @@ void Response::freeData(void) } } +int Response::getCode() +{ + return (_code); +} + +ssize_t Response::getBodySize() +{ + return _contentLength; +} + +location *Response::getLocation(void) +{ + return (_location); +} + std::string Response::getHeader(void) { return (*_header); @@ -82,6 +97,11 @@ void Response::setContentType(void) _contentType = getContentType(); } +std::string Response::getRedirect() +{ + return (_locationSTR); +} + void Response::setContentLength() { if (_body != NULL) @@ -272,9 +292,6 @@ std::string Response::getFullURI(void) ret = tmp; if (_upload_dir.empty()) _upload_dir = ret; - DBOUT << PINK << "location " << _location->location << ENDL; - DBOUT << PINK << "fullURI " << ret << ENDL; - DBOUT << PINK << "upload dir " << _upload_dir << ENDL; return (ret); } @@ -413,7 +430,7 @@ void Response::invalidClient(void) setHeaderBlocks(); generateHeader(); - DBOUT << RED << "Error Method called" << ENDL; + DBOUT << WARNING << getDebugTime() << FAIL << " Error Method called" << ENDL; } @@ -443,7 +460,8 @@ void Response::methodGet(void) generateBody(); setHeaderBlocks(); generateHeader(); - DBOUT << GREEN << "GET method called\n" << ZERO_C; + DBOUT << WARNING << getDebugTime() << GREEN << " GET Method called" << ENDL; + } void Response::methodPost(void) { @@ -453,7 +471,6 @@ void Response::methodPost(void) CgiHandle cgi(_request, *this); *_body = cgi.executeCgi(); - DBOUT << "CGI SIZE BODY " << _body->size() << ENDL; unsigned long pos = _body->find("\r\n\r\n"); if (pos != std::string::npos) { @@ -471,7 +488,8 @@ void Response::methodPost(void) _code = 204; setHeaderBlocks(); generateHeader(); - DBOUT << GREEN << "POST method called" << ENDL; + DBOUT << WARNING << getDebugTime() << GREEN << " POST Method called" << ENDL; +\ } void Response::methodPut(void) @@ -495,7 +513,7 @@ void Response::methodPut(void) } setHeaderBlocks(); generateHeader(); - DBOUT << GREEN << "PUT method called" << ENDL; + DBOUT << WARNING << getDebugTime() << GREEN << " PUT Method called" << ENDL; } void Response::methodDelete(void) @@ -513,7 +531,7 @@ void Response::methodDelete(void) OpenErrorFile(_code); setHeaderBlocks(); generateHeader(); - DBOUT << GREEN << "Delete method called" << ENDL; + DBOUT << WARNING << getDebugTime() << GREEN << " DELETE Method called" << ENDL; } diff --git a/src/Client/Response.hpp b/src/Client/Response.hpp index d33fc67..032b3a1 100644 --- a/src/Client/Response.hpp +++ b/src/Client/Response.hpp @@ -64,6 +64,7 @@ private: std::string getContentType(void); public: serverListen getListen(void); + location * getLocation(void); std::string getCgiPass(void); std::string getHeader(void); std::string *getBody(void); @@ -71,7 +72,10 @@ public: static std::string getReasonPhrase(int); std::string getErrorPage(int code); std::string getFullURI(); - ssize_t getMaxBodySize(void); + ssize_t getMaxBodySize(void); + ssize_t getBodySize(); + std::string getRedirect(); + int getCode(); bool isRedirect(void); bool allowedMethod(std::string &); void setData(Request, ServerConfig *);