CGI Status
This commit is contained in:
@ -59,6 +59,7 @@ URI::URI(string webroot, string reqpath) {
|
|||||||
}
|
}
|
||||||
this->webroot = webroot;
|
this->webroot = webroot;
|
||||||
this->reqpath = reqpath;
|
this->reqpath = reqpath;
|
||||||
|
this->info = "";
|
||||||
|
|
||||||
string abs = reqpath;
|
string abs = reqpath;
|
||||||
if (fileExists(webroot + abs)) {
|
if (fileExists(webroot + abs)) {
|
||||||
@ -140,7 +141,7 @@ FILE *URI::openFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string URI::getFilePathInfo() {
|
string URI::getFilePathInfo() {
|
||||||
return ""; //getAbsolutePath().erase(getFilePath().length(), getAbsolutePath().length());
|
return info; //getAbsolutePath().erase(getFilePath().length(), getAbsolutePath().length());
|
||||||
}
|
}
|
||||||
|
|
||||||
string URI::getFileType() {
|
string URI::getFileType() {
|
||||||
|
@ -12,6 +12,7 @@ private:
|
|||||||
string reqpath;
|
string reqpath;
|
||||||
string relpath;
|
string relpath;
|
||||||
string query;
|
string query;
|
||||||
|
string info;
|
||||||
string filepath;
|
string filepath;
|
||||||
bool queryinit;
|
bool queryinit;
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
|
|||||||
} else if (etag) {
|
} else if (etag) {
|
||||||
req.respond(304);
|
req.respond(304);
|
||||||
} else {
|
} else {
|
||||||
int statuscode = 200;
|
int statuscode = 0;
|
||||||
if (!path.isStatic()) {
|
if (!path.isStatic()) {
|
||||||
string cmd = (string) "env -i" +
|
string cmd = (string) "env -i" +
|
||||||
" REDIRECT_STATUS=" + cli_encode("CGI") +
|
" REDIRECT_STATUS=" + cli_encode("CGI") +
|
||||||
@ -282,19 +282,22 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
|
|||||||
while (data[0] == ' ') data.erase(data.begin() + 0);
|
while (data[0] == ' ') data.erase(data.begin() + 0);
|
||||||
while (data[data.length() - 1] == ' ') data.erase(data.end() - 1);
|
while (data[data.length() - 1] == ' ') data.erase(data.end() - 1);
|
||||||
|
|
||||||
if (index == "Location") {
|
if (index == "Status") {
|
||||||
|
statuscode = (int) strtol(data.substr(0, 3).c_str(), nullptr, 10);
|
||||||
|
} else {
|
||||||
|
if (index == "Location" && statuscode == 0) {
|
||||||
statuscode = 303;
|
statuscode = 303;
|
||||||
}
|
}
|
||||||
|
|
||||||
req.setField(index, data);
|
req.setField(index, data);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
file = pipes.stdout;
|
file = pipes.stdout;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
statuscode = (statuscode == 0) ? 200 : statuscode;
|
||||||
|
|
||||||
bool compress = path.isStatic() && type.find("text/") == 0 && req.isExistingField("Accept-Encoding") &&
|
bool compress = path.isStatic() && type.find("text/") == 0 && req.isExistingField("Accept-Encoding") &&
|
||||||
req.getField("Accept-Encoding").find("deflate") != string::npos;
|
req.getField("Accept-Encoding").find("deflate") != string::npos;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user