diff --git a/src/Client/Client.cpp b/src/Client/Client.cpp index 58fe3eb..73b2bf5 100644 --- a/src/Client/Client.cpp +++ b/src/Client/Client.cpp @@ -217,6 +217,10 @@ void Client::printClientInfo(void) std::cout << GREEN << "request http versioin = " << _request.getVersion() << ZERO_C << std::endl; std::cout << GREEN << "content-length = " << _request.getContentLength() << ZERO_C << std::endl; std::cout << GREEN << "connection type = " << _request.getConnection() << ZERO_C << std::endl; + it = map.find("transfer-encoding"); + if (it != map.end()) + std::cout << GREEN << "transfer-encoding = " << it->second << ZERO_C << std::endl; + std::cout << BLUE << std::endl << "RESPONSE" << ZERO_C << std::endl << std::endl; std::cout << GREEN << _response.getHeader() << ZERO_C << std::endl; diff --git a/src/Client/Request.cpp b/src/Client/Request.cpp index 15003d5..593749f 100644 --- a/src/Client/Request.cpp +++ b/src/Client/Request.cpp @@ -196,7 +196,8 @@ void Request::splitData(std::string &data) _head_ok = true; parseHeader(); - if (_contentLength == 0 && !_chunked) + if ((_contentLength == 0 && !_chunked) || (_method == "GET" + || _method == "DELETE" || _method == "HEAD")) _body_ok = true; } } diff --git a/src/Client/Response.cpp b/src/Client/Response.cpp index efd97b5..b2f1813 100644 --- a/src/Client/Response.cpp +++ b/src/Client/Response.cpp @@ -197,7 +197,6 @@ std::string Response::getTime(void) std::string Response::getFullURI(void) { - std::string tmp; std::string ret = ""; int len = _location->location.size(); @@ -210,8 +209,11 @@ std::string Response::getFullURI(void) } else { + DBOUT << "location" << _location->location << ENDL; tmp = _request.getURI().substr(len); + DBOUT << "tmp1 " << RED << tmp << ENDL; tmp = _location->root + tmp; + DBOUT << "tmp2" << RED << tmp << ENDL; } if (_request.isDir(tmp) == 0) { @@ -320,11 +322,13 @@ void Response::generate2(serverListen &l) _fullURI = getFullURI(); _method = _request.getMethod(); _maxBodySize = (_location->clientBodySize > 0) ? _location->clientBodySize : _config->getClientBodySize(); - _code = (_request.getContentLength() > _maxBodySize) ? 413 : _code; - DBOUT << "max size" << _maxBodySize << ENDL; - DBOUT << "_location size" << _location->clientBodySize << ENDL; - DBOUT << "_config sieze" << _config->getClientBodySize() << ENDL; - DBOUT << "req size " << _request.getContentLength() << ENDL; + if (_maxBodySize > 0) + _code = (_request.getRecved() > _maxBodySize) ? 413 : _code; + DBOUT << BLUE << "max size" << _maxBodySize << ENDL; + DBOUT << BLUE << "_location size" << _location->clientBodySize << ENDL; + DBOUT << BLUE << "_config sieze" << _config->getClientBodySize() << ENDL; + DBOUT << BLUE << "req size " << _request.getContentLength() << ENDL; + DBOUT << BLUE << "recv size " << _request.getRecved() << ENDL; } DBOUT << "fullURI " << _fullURI << ENDL;