31 lines
1.2 KiB
C++
31 lines
1.2 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 S400 "400 Bad Request"
|
|
# define S403 "403 Forbidden"
|
|
# define S404 "404 Not Found"
|
|
# define S405 "405 Method Not Allowed"
|
|
# define S413 "413 Content Too Large"
|
|
|
|
# define S500 "500 Internal Server Error"
|
|
|
|
#endif
|