Skip to content

Commit

Permalink
few change occured
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-philippe Martel committed Oct 18, 2022
1 parent 52f9241 commit 0b3424c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 21 deletions.
10 changes: 0 additions & 10 deletions resources/success/upload_success.html

This file was deleted.

2 changes: 2 additions & 0 deletions src/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ void server::get_data_from_client(int i) {
{
resp = response(serveInfo.locations[page.second],this->serveInfo.error_pages, data);
resp.set_status_code(500);
resp.set_status("500 Internal Server Error");

}
} else {
if (page.second.find("cgi-bin") != std::string::npos &&
Expand Down
14 changes: 3 additions & 11 deletions src/response.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ response::build_response(std::map<std::string, location_info> &lst_info) {
std::string content_type;

if (status_code == 200 && this->content == "/upload") {
content = readfile("./resources/success/upload_success.html");
content = "<!DOCTYPE html> <html> <head> <title>Upload successfully completed</title> </head> <body> <img src=\"/images/done.jpeg\" alt=\"Upload done\"> <h1>Upload successfully completed!</h1> </body> </html>";

content_length = content.length();
content_type = "text/html";
} else if (status_code == 200 && this->content != "") {
Expand All @@ -189,16 +190,7 @@ response::build_response(std::map<std::string, location_info> &lst_info) {
content_type = "text/html";
} else if (status_code != 200) {
content = local_info.find_error_page(error_page[status_code]);
/*
if (content == "") {
content = "<!DOCTYPE html><html><head><title>" + status +
"</title></head><body><h1>" + status +
"</h1> <img width=500 height=500 src=\"https://images.nightcafe.studio/jobs/gSfqoxufQvOM3TxCsPqr/gSfqoxufQvOM3TxCsPqr--3--7z5s8.jpg?tr=w-640,c-at_max\"> \
<h1> a rat ate your error page sorry </h1> </body></html>";
}
*/

content_length = content.length();
content_type = "text/html";
} else if ((status_code == 200 && type == "") ||
Expand Down

0 comments on commit 0b3424c

Please sign in to comment.