Files
42_INT_12_webserv/srcs/webserv/http_status.hpp
LuckyLaszlo ab0bc2c4c0 added timeout response (status 408)
+ added EPOLLERR and EPOLLHUP handling
+ fix root substitution for default "/" location (temp or permanent ?)
+ tested siege a little, seems good
2022-08-11 07:12:13 +02:00

52 lines
1.5 KiB
C++

#ifndef HTTP_STATUS_HPP
# define HTTP_STATUS_HPP
// https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
/*
First version of macro HTML_ERROR(STATUS) dont work with call like this :
client->response.append( HTML_ERROR( _http_status[client->status].c_str() ) );
so I made the other version with dynamic replacement of STATUS .
*/
// # define HTML_ERROR(STATUS) "\r\n<!DOCTYPE html><html><head><title>"STATUS"</title></head><body><h1 style=\"text-align:center\">"STATUS"</h1><hr><p style=\"text-align:center\">Le Webserv/0.1</p></body></html>"
# define STATUS_PLACEHOLDER "$STATUS"
# define HTML_ERROR \
"<!DOCTYPE html>"\
"<html>"\
"<head>"\
"<title>" STATUS_PLACEHOLDER "</title>"\
"</head>"\
"<body>"\
"<h1 style=\"text-align:center\">" STATUS_PLACEHOLDER "</h1>"\
"<hr>"\
"<p style=\"text-align:center\">Le Webserv/0.1</p>"\
"</body>"\
"</html>"
// When new status added, need to update _init_http_status_map()
# define S200 "200 OK"
# define S201 "201 Created"
# define S204 "204 No Content"
# define S301 "301 Moved Permanently"
# define S302 "302 Found"
# define S303 "303 See Other"
# define S304 "304 Not Modified" // unused
# define S307 "307 Temporary Redirect"
# define S308 "308 Permanent Redirect"
# define S400 "400 Bad Request"
# define S403 "403 Forbidden"
# define S404 "404 Not Found"
# define S405 "405 Method Not Allowed"
# define S408 "408 Request Timeout"
# define S413 "413 Content Too Large"
# define S500 "500 Internal Server Error"
# define S501 "501 Not Implemented"
# define S505 "505 HTTP Version Not Supported"
#endif