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