Debugging 2
This commit is contained in:
@ -223,7 +223,7 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
|
||||
char *prefix = (char *) preprefix;
|
||||
|
||||
HttpConnection *req = nullptr;
|
||||
printf("STAGE 1");
|
||||
printf("STAGE 1\n");
|
||||
try {
|
||||
*req = HttpConnection(socket);
|
||||
} catch (char *msg) {
|
||||
@ -244,7 +244,7 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
|
||||
|
||||
}
|
||||
}
|
||||
printf("STAGE 2");
|
||||
printf("STAGE 2\n");
|
||||
|
||||
try {
|
||||
bool noRedirect, redir, invalidMethod, etag;
|
||||
@ -276,7 +276,7 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
|
||||
host.erase(pos, host.length() - pos);
|
||||
}
|
||||
|
||||
printf("STAGE 3");
|
||||
printf("STAGE 3\n");
|
||||
|
||||
/*
|
||||
FILE *name = popen(("dig @8.8.8.8 +time=1 -x " + socket->getPeerAddress()->toString() +
|
||||
@ -298,7 +298,7 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
|
||||
log_to_file(prefix, "\x1B[1m" + req->getMethod() + " " + req->getPath() + "\x1B[0m", host);
|
||||
|
||||
noRedirect = req->getPath().find("/.well-known/") == 0 || (req->getPath().find("/files/") == 0);
|
||||
printf("STAGE 4");
|
||||
printf("STAGE 4\n");
|
||||
|
||||
redir = true;
|
||||
if (!noRedirect) {
|
||||
@ -315,7 +315,7 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
|
||||
|
||||
*path = URI(getWebRoot(host), req->getPath());
|
||||
childpid = 0;
|
||||
printf("STAGE 5");
|
||||
printf("STAGE 5\n");
|
||||
|
||||
if (redir) {
|
||||
goto respond;
|
||||
@ -336,7 +336,7 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
|
||||
req->respond(403);
|
||||
goto respond;
|
||||
}
|
||||
printf("STAGE 6");
|
||||
printf("STAGE 6\n");
|
||||
|
||||
req->setField("Content-Type", type);
|
||||
req->setField("Last-Modified", getHttpDate(path->getFilePath()));
|
||||
@ -368,7 +368,7 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
|
||||
invalidMethod = true;
|
||||
}
|
||||
}
|
||||
printf("STAGE 7");
|
||||
printf("STAGE 7\n");
|
||||
|
||||
if (invalidMethod) {
|
||||
req->respond(405);
|
||||
@ -409,7 +409,7 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
|
||||
" GATEWAY_INTERFACE=" + cli_encode("CGI/1.1") +
|
||||
" /usr/bin/php-cgi";
|
||||
|
||||
printf("STAGE 8");
|
||||
printf("STAGE 8\n");
|
||||
stds pipes = procopen(cmd.c_str());
|
||||
childpid = pipes.pid;
|
||||
|
||||
@ -421,7 +421,7 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
|
||||
fclose(pipes.stdin);
|
||||
|
||||
t = new thread(php_error_handler, prefix, pipes.stderr);
|
||||
printf("STAGE 9");
|
||||
printf("STAGE 9\n");
|
||||
|
||||
string line;
|
||||
while (!(line = read_line(pipes.stdout)).empty()) {
|
||||
@ -445,7 +445,7 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
|
||||
req->setField(index, data);
|
||||
}
|
||||
}
|
||||
printf("STAGE 10");
|
||||
printf("STAGE 10\n");
|
||||
|
||||
fclose(file);
|
||||
int c = fgetc(pipes.stdout);
|
||||
@ -459,7 +459,7 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
|
||||
file = pipes.stdout;
|
||||
}
|
||||
|
||||
printf("STAGE 11");
|
||||
printf("STAGE 11\n");
|
||||
|
||||
if (statuscode != -1) {
|
||||
statuscode = (statuscode == 0) ? 200 : statuscode;
|
||||
@ -513,7 +513,7 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
|
||||
}
|
||||
}
|
||||
|
||||
printf("STAGE 12");
|
||||
printf("STAGE 12\n");
|
||||
|
||||
fclose(file);
|
||||
if (childpid > 0) {
|
||||
@ -521,7 +521,7 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
|
||||
}
|
||||
|
||||
respond:
|
||||
printf("STAGE RESPOND");
|
||||
printf("STAGE RESPOND\n");
|
||||
|
||||
HttpStatusCode status = req->getStatusCode();
|
||||
int code = status.code;
|
||||
|
Reference in New Issue
Block a user