post-W7 cleanup
This commit is contained in:
@@ -812,12 +812,20 @@ FastCGIServer::process_http_request(FastCGIRequest& request, String& data)
|
||||
|
||||
if(resolve_http_script_filename && request.params["SCRIPT_FILENAME"] == "" && request.params["DOCUMENT_URI"] != "")
|
||||
{
|
||||
String document_root = http_script_root();
|
||||
String document_root = first(http_document_root, http_script_root());
|
||||
String document_uri = strip_leading_slashes(request.params["DOCUMENT_URI"]);
|
||||
for(String part : split(document_uri, "/"))
|
||||
{
|
||||
if(part == "..")
|
||||
{
|
||||
reject_http_connection(*client_sockets[request.resources.client_socket], "HTTP/1.1 404 Not Found", "script not found\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
String candidate = path_join(document_root, document_uri);
|
||||
String real_root = path_real(document_root);
|
||||
String real_candidate = path_real(candidate);
|
||||
if(real_root == "" || real_candidate == "" || !path_is_within(candidate, document_root))
|
||||
if(real_root == "" || real_candidate == "" || !path_is_within(real_candidate, real_root))
|
||||
{
|
||||
reject_http_connection(*client_sockets[request.resources.client_socket], "HTTP/1.1 404 Not Found", "script not found\n");
|
||||
return;
|
||||
|
||||
@@ -62,6 +62,7 @@ public:
|
||||
void process_forever();
|
||||
int calls_until_termination = 8; // set this to -1 to never terminate
|
||||
bool resolve_http_script_filename = true;
|
||||
String http_document_root = "";
|
||||
|
||||
typedef unsigned RequestID;
|
||||
typedef std::map<RequestID, FastCGIRequest*> RequestList;
|
||||
|
||||
Reference in New Issue
Block a user