Skip to content

Commit

Permalink
debuh(cgi_path): add prints
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefano Lombardo committed May 21, 2024
1 parent 6f61ccf commit 0208c35
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 62 deletions.
40 changes: 20 additions & 20 deletions experiments/issues.csv
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
Summary,Issue key,Issue id,Issue Type,Status,Project key,Project name,Creator,Created,Updated
Fix the issue,Issue11,11,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue12,12,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue13,13,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue14,14,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue15,15,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue16,16,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue17,17,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue18,18,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue19,19,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue20,20,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue21,21,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue22,22,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue23,23,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue24,24,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue25,25,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue26,26,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue27,27,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue28,28,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue29,29,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue30,30,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue31,31,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue32,32,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue33,33,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue34,34,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue35,35,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue36,36,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue37,37,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue38,38,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue39,39,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue40,40,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue41,41,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue42,42,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue43,43,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue44,44,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue45,45,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue46,46,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue47,47,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue48,48,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue49,49,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
Fix the issue,Issue50,50,Bug,Backlog,GH123,ExampleProject,slombard,2024-05-10,2024-05-10
23 changes: 23 additions & 0 deletions src/CGIHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ void CGIHandler::handleRequest(HTTPRequest &request, HTTPResponse &response)

std::vector<std::string> CGIHandler::createArgvForExecve(const MetaVariables &env)
{
std ::cout << "------------------createArgvForExecve-------------------" << std::endl;
std::vector<std::string> argv;
std::string scriptName = env.getVar("SCRIPT_NAME");
std::cout << "createArgvForExecve: scriptName: " << scriptName << std::endl;
Expand All @@ -71,6 +72,7 @@ std::vector<std::string> CGIHandler::createArgvForExecve(const MetaVariables &en
{
argv.push_back(scriptPath);
}
std::cout << "---------- Exiting createArgvForExecve ------------------" << std::endl;
return argv;
}

Expand Down Expand Up @@ -143,6 +145,7 @@ void handleTimeout(int sig)

std::string CGIHandler::executeCGI(const MetaVariables &env)
{
std::cout << "------------------executeCGI-------------------" << std::endl;
std::string cgiOutput;
std::vector<std::string> argv = createArgvForExecve(env);
std::vector<std::string> envp = env.getForExecve();
Expand Down Expand Up @@ -178,6 +181,26 @@ std::string CGIHandler::executeCGI(const MetaVariables &env)
perror("access");
_exit(EXIT_FAILURE);
}
if (argvPointers[0] != NULL)
std::cerr << "argvPointers[0] " << argvPointers[0] << std::endl;
if (argvPointers[1] != NULL)
std::cerr << "argvPointers[1] " << argvPointers[1] << std::endl;
std::cerr << "Printing argvPointers" << std::endl;
for (size_t i = 0; i < argvPointers.size(); i++)
{
if (argvPointers[i] != NULL)
std::cout << argvPointers[i] << std::endl;
else
break;
}
std::cerr << "Printing envpPointers" << std::endl;
for (size_t i = 0; i < envpPointers.size(); i++)
{
if (envpPointers[i] != NULL)
std::cout << envpPointers[i] << std::endl;
else
break;
}

execve(argvPointers[0], argvPointers.data(), envpPointers.data());
perror("execve");
Expand Down
2 changes: 2 additions & 0 deletions src/MetaVariables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ std::string MetaVariables::getVar(const std::string &key) const

std::vector<std::string> MetaVariables::getForExecve() const
{
std::cout << "MetaVariables::getForExecve: " << std::endl;
std::vector<std::string> result;
for (std::map<std::string, std::string>::const_iterator it = metaVars.begin(); it != metaVars.end(); ++it)
{
std::string env = it->first + "=" + it->second;
result.push_back(env);
}
std::cout << "Exiting MetaVariables::getForExecve: " << std::endl;
return result;
}

Expand Down
42 changes: 0 additions & 42 deletions var/www.php_site.com/index.html

This file was deleted.

0 comments on commit 0208c35

Please sign in to comment.