mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-06 05:31:44 +00:00
better realpath for static docroot
This commit is contained in:
+13
-1
@@ -958,9 +958,21 @@ nextsm:
|
||||
|
||||
// finally check for docroot
|
||||
if (uwsgi.check_static_docroot && wsgi_req->document_root_len > 0) {
|
||||
if (!uwsgi_file_serve(wsgi_req, wsgi_req->document_root, wsgi_req->document_root_len, wsgi_req->path_info, wsgi_req->path_info_len)) {
|
||||
char *orig_docroot = uwsgi_concat2n(wsgi_req->document_root, wsgi_req->document_root_len, "", 0);
|
||||
char *real_docroot = uwsgi_malloc(PATH_MAX+1);
|
||||
if (!realpath(orig_docroot, real_docroot)) {
|
||||
uwsgi_error("realpath()");
|
||||
free(orig_docroot);
|
||||
free(real_docroot);
|
||||
return -1;
|
||||
}
|
||||
if (!uwsgi_file_serve(wsgi_req, real_docroot, strlen(real_docroot), wsgi_req->path_info, wsgi_req->path_info_len)) {
|
||||
free(orig_docroot);
|
||||
free(real_docroot);
|
||||
return -1;
|
||||
}
|
||||
free(orig_docroot);
|
||||
free(real_docroot);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user