Fossil SCM

Enhance the CGI processor to assume that PATH_INFO is an empty string if it is omitted.

drh 2013-10-17 18:36 trunk
Commit 63a84cb66efa6bdb3361616eb17e80b6acf7e040
1 file changed +11 -6
+11 -6
--- src/cgi.c
+++ src/cgi.c
@@ -831,27 +831,32 @@
831831
/*
832832
** Initialize the query parameter database. Information is pulled from
833833
** the QUERY_STRING environment variable (if it exists), from standard
834834
** input if there is POST data, and from HTTP_COOKIE.
835835
**
836
-** We require parameter SCRIPT_NAME and one of REQUEST_URI or PATH_INFO.
837
-** These three are related as following:
836
+** REQUEST_URI, PATH_INFO, and SCRIPT_NAME are related as follows:
838837
**
839838
** REQUEST_URI == SCRIPT_NAME + PATH_INFO
840839
**
841
-** Where "+" means concatenate. One of PATH_INFO or REQUEST_URI can
842
-** be missing and it will be computed from the other two terms.
840
+** Where "+" means concatenate. Fossil requires SCRIPT_NAME. If
841
+** REQUEST_URI is provided but PATH_INFO is not, then PATH_INFO is
842
+** computed from REQUEST_URI and SCRIPT_NAME. If PATH_INFO is provided
843
+** but REQUEST_URI is not, then compute REQUEST_URI from PATH_INFO and
844
+** SCRIPT_NAME. If neither REQUEST_URI nor PATH_INFO are provided, then
845
+** assume that PATH_INFO is an empty string and set REQUEST_URI equal
846
+** to PATH_INFO.
843847
**
844
-** SCGI typically omits PATH_INFO. CGI sometimes omits REQUEST_URI.
848
+** SCGI typically omits PATH_INFO. CGI sometimes omits REQUEST_URI and
849
+** PATH_INFO when it is empty.
845850
*/
846851
void cgi_init(void){
847852
char *z;
848853
const char *zType;
849854
int len;
850855
const char *zRequestUri = cgi_parameter("REQUEST_URI",0);
851856
const char *zScriptName = cgi_parameter("SCRIPT_NAME",0);
852
- const char *zPathInfo = cgi_parameter("PATH_INFO",0);
857
+ const char *zPathInfo = cgi_parameter("PATH_INFO","");
853858
854859
#ifdef FOSSIL_ENABLE_JSON
855860
json_main_bootstrap();
856861
#endif
857862
g.isHTTP = 1;
858863
--- src/cgi.c
+++ src/cgi.c
@@ -831,27 +831,32 @@
831 /*
832 ** Initialize the query parameter database. Information is pulled from
833 ** the QUERY_STRING environment variable (if it exists), from standard
834 ** input if there is POST data, and from HTTP_COOKIE.
835 **
836 ** We require parameter SCRIPT_NAME and one of REQUEST_URI or PATH_INFO.
837 ** These three are related as following:
838 **
839 ** REQUEST_URI == SCRIPT_NAME + PATH_INFO
840 **
841 ** Where "+" means concatenate. One of PATH_INFO or REQUEST_URI can
842 ** be missing and it will be computed from the other two terms.
 
 
 
 
 
843 **
844 ** SCGI typically omits PATH_INFO. CGI sometimes omits REQUEST_URI.
 
845 */
846 void cgi_init(void){
847 char *z;
848 const char *zType;
849 int len;
850 const char *zRequestUri = cgi_parameter("REQUEST_URI",0);
851 const char *zScriptName = cgi_parameter("SCRIPT_NAME",0);
852 const char *zPathInfo = cgi_parameter("PATH_INFO",0);
853
854 #ifdef FOSSIL_ENABLE_JSON
855 json_main_bootstrap();
856 #endif
857 g.isHTTP = 1;
858
--- src/cgi.c
+++ src/cgi.c
@@ -831,27 +831,32 @@
831 /*
832 ** Initialize the query parameter database. Information is pulled from
833 ** the QUERY_STRING environment variable (if it exists), from standard
834 ** input if there is POST data, and from HTTP_COOKIE.
835 **
836 ** REQUEST_URI, PATH_INFO, and SCRIPT_NAME are related as follows:
 
837 **
838 ** REQUEST_URI == SCRIPT_NAME + PATH_INFO
839 **
840 ** Where "+" means concatenate. Fossil requires SCRIPT_NAME. If
841 ** REQUEST_URI is provided but PATH_INFO is not, then PATH_INFO is
842 ** computed from REQUEST_URI and SCRIPT_NAME. If PATH_INFO is provided
843 ** but REQUEST_URI is not, then compute REQUEST_URI from PATH_INFO and
844 ** SCRIPT_NAME. If neither REQUEST_URI nor PATH_INFO are provided, then
845 ** assume that PATH_INFO is an empty string and set REQUEST_URI equal
846 ** to PATH_INFO.
847 **
848 ** SCGI typically omits PATH_INFO. CGI sometimes omits REQUEST_URI and
849 ** PATH_INFO when it is empty.
850 */
851 void cgi_init(void){
852 char *z;
853 const char *zType;
854 int len;
855 const char *zRequestUri = cgi_parameter("REQUEST_URI",0);
856 const char *zScriptName = cgi_parameter("SCRIPT_NAME",0);
857 const char *zPathInfo = cgi_parameter("PATH_INFO","");
858
859 #ifdef FOSSIL_ENABLE_JSON
860 json_main_bootstrap();
861 #endif
862 g.isHTTP = 1;
863

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button