jFastCGI / jfastcgi

jFastCGI
Other
38 stars 11 forks source link

Some thoughts, especially about $_SERVER['PATH_INFO'] #23

Closed jm009 closed 6 years ago

jm009 commented 6 years ago

I would like to run Nextcloud with jFastCGI. Nextcloud handles everything with only a few PHP CGI scripts. These "dispatcher scripts" then call the "real" scripts. For example index.php may be called by URL https://my.host/nextcloud/index.php/apps/files/

I got aware, that jFastCGI doesn't properly set $_SERVER['PATH_INFO'] (should be /apps/files/ for the above example).

Now I am reading the code FastCGIHandler.java [1], method setEnvironment.

Now the things that really matter (especially for Nextcloud and the like) :-) The tomcat CGIServlet determines SCRIPT_NAME and PATH_INFO by really searching the script in the file system [4].

Maybe (if I find the time) I am going to implement a patch with proper creation of SCRIPT_NAME and PATH_INFO these days...

[1] https://github.com/jFastCGI/jfastcgi/blob/master/client/core/src/main/java/org/jfastcgi/client/FastCGIHandler.java [2] https://docs.oracle.com/javaee/7/api/javax/servlet/http/HttpServletRequest.html#getRequestURI-- [3] https://docs.oracle.com/javaee/7/api/javax/servlet/http/HttpServletRequest.html#getServletPath-- [4] https://github.com/apache/tomcat/blob/trunk/java/org/apache/catalina/servlets/CGIServlet.java [5] https://docs.oracle.com/javaee/7/api/javax/servlet/http/HttpServletRequest.html#getPathInfo-- (Keep in mind, that this is talking about servlets, not about CGI scripts - for CGI scripts I think "follows the servlet" should read "follows the file name".)

jrialland commented 6 years ago

Thanks for you're improvements, I've just merged your modifications

jm009 commented 6 years ago

Thank you. Great.