php newline pbm resolved

This commit is contained in:
hugogogo
2022-08-12 12:00:20 +02:00
parent c225063361
commit de09c2357c
2 changed files with 3 additions and 40 deletions

View File

@@ -1,5 +1,4 @@
#! /usr/bin/php
<?php
echo "false: 300\r\n";
echo "server: Webserv/0.2\r\n";
@@ -28,4 +27,3 @@
// echo $_POST['REQUEST_METHOD'];
echo "\n\n-----------\nEND PHP-CGI\n\n";
?>

View File

@@ -139,6 +139,9 @@ void Webserv::_check_script_output(Client *client, std::string & output)
{
_check_script_status(client, output);
_check_script_fields(client, output);
// _check_script_empty_lines(client, output);
// _check_script_space_colons(client, output);
// _check_script_new_lines(client, output);
}
void Webserv::_check_script_status(Client *client, std::string & output)
@@ -179,17 +182,6 @@ void Webserv::_check_script_fields(Client *client, std::string & output)
tmp.erase(pos);
::parse_http_headers(tmp, scr_fld);
// compare both map to supress duplicates
// debug
std::map<std::string, std::string>::iterator it;
std::cout << "\n\n+++++\ndebug comparison:\nBEFORE\nserver headers:\n";
for (it = srv_fld.begin(); it != srv_fld.end(); it++) {
std::cout << " " << it->first << ": [" << it->second << "]\n"; }
std::cout << "\nscript headers:\n";
for (it = scr_fld.begin(); it != scr_fld.end(); it++) {
std::cout << " " << it->first << ": [" << it->second << "]\n"; }
// en debug
for (it_srv = srv_fld.begin(); it_srv != srv_fld.end(); it_srv++)
{
for (it_scr = scr_fld.begin(); it_scr != scr_fld.end(); it_scr++)
@@ -201,32 +193,5 @@ for (it = scr_fld.begin(); it != scr_fld.end(); it++) {
}
}
}
// debug
srv_fld.clear();
scr_fld.clear();
// put server headers in map
tmp = client->response;
pos = tmp.find(CRLF CRLF);
if (pos != std::string::npos)
tmp.erase(pos);
::parse_http_headers(tmp, srv_fld);
// put script headers in map
tmp = output;
pos = tmp.find(CRLF CRLF);
if (pos != std::string::npos)
tmp.erase(pos);
::parse_http_headers(tmp, scr_fld);
// compare both map to supress duplicates
std::cout << "\nAFTER\nserver headers:\n";
for (it = srv_fld.begin(); it != srv_fld.end(); it++) {
std::cout << " " << it->first << ": [" << it->second << "]\n"; }
std::cout << "\nscript headers:\n";
for (it = scr_fld.begin(); it != scr_fld.end(); it++) {
std::cout << " " << it->first << ": [" << it->second << "]\n"; }
std::cout << "\nend debug comparison\n+++++\n\n";
// end debug
}