key fields headers in map are in lowercase

+ getters for this map are case insensitive
+ change request fiel 'path' for 'uri', 'query', and 'abs_path'
This commit is contained in:
hugogogo
2022-08-07 13:06:16 +02:00
parent 63ff42b57d
commit e0fd743b5b
7 changed files with 89 additions and 40 deletions

View File

@@ -3,7 +3,8 @@
bool Webserv::_is_cgi(Client *client)
{
if (client->get_rq_path().find("/cgi-bin/") != std::string::npos)
// TMP
if (client->get_rq_abs_path().find("/cgi-bin") != std::string::npos)
return true;
return false;
}
@@ -35,7 +36,7 @@ char** Webserv::_set_env(Client *client)
env[3] = _dup_env("GATEWAY_INTERFACE");
env[4] = _dup_env("PATH_INFO");
env[5] = _dup_env("PATH_TRANSLATED");
env[6] = _dup_env("QUERY_STRING");
env[6] = _dup_env("QUERY_STRING" , client->get_rq_query());
env[7] = _dup_env("REMOTE_ADDR" , client->get_cl_ip());
env[8] = _dup_env("REMOTE_HOST" , client->get_rq_headers("Host")); // just test
env[9] = _dup_env("REMOTE_IDENT"); // authentification not supported

View File

@@ -72,7 +72,7 @@ void Webserv::_construct_response(Client *client, ServerConfig &server)
client->status = 413;
return;
}
LocationConfig &location = _determine_location(server, client->get_rq_path());
LocationConfig &location = _determine_location(server, client->get_rq_uri());
_process_method(client, server, location);
}
@@ -135,7 +135,7 @@ void Webserv::_error_html_response(Client *client, ServerConfig &server)
void Webserv::_get(Client *client, ServerConfig &server, LocationConfig &location)
{
(void)server; // To remove from arg if we determine its useless
std::string path = client->get_rq_path();
std::string path = client->get_rq_uri();
if (path == "/") // TODO : index and autoindex
path.append(INDEX);
@@ -255,7 +255,7 @@ void Webserv::_post(Client *client, ServerConfig &server, LocationConfig &locati
WIP
https://www.rfc-editor.org/rfc/rfc9110.html#name-post
*/
std::string path = client->get_rq_path();
std::string path = client->get_rq_uri();
path.insert(0, location.root);
/* CGI Here ? */
@@ -321,7 +321,7 @@ void Webserv::_delete(Client *client, ServerConfig &server, LocationConfig &loca
WIP
https://www.rfc-editor.org/rfc/rfc9110.html#name-delete
*/
std::string path = client->get_rq_path();
std::string path = client->get_rq_uri();
path.insert(0, location.root);
/* CGI Here ? */