Skip to content

Commit

Permalink
Changed the position where the setEntireData function is called to af…
Browse files Browse the repository at this point in the history
…ter adding the location header
  • Loading branch information
ilovenoah committed Mar 12, 2024
1 parent f636e20 commit a5beb71
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/response/Response.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ bool Response::_setIndexPage(bool shouldKeepAlive) {
for (std::vector<std::string>::iterator iter = index.begin();
iter != index.end(); ++iter) {
path = this->_actPath + *iter;
this->setEntireDataWithFile(path, "200", shouldKeepAlive);
this->setEntireDataWithFile(path, "200", shouldKeepAlive);
return true;
}
return false;
Expand Down Expand Up @@ -289,10 +289,10 @@ ClientSocket::csphase Response::_setGetResponse(const Request &request) {
}
if (res.getOk() == true &&
this->_actPath.find_last_of('/') != this->_actPath.length() - 1) {
this->setEntireData("301", request.shouldKeepAlive());
this->_headers.insert(std::pair<std::string, std::string>(
"Location",
"http://" + this->_server->getListen() + request.getPath() + "/"));
this->setEntireData("301", request.shouldKeepAlive());
return ClientSocket::SEND;
}
if (res.getOk() == true) {
Expand Down

0 comments on commit a5beb71

Please sign in to comment.