Fossil SCM
Enhance the CGI processor to assume that PATH_INFO is an empty string if it is omitted.
Commit
63a84cb66efa6bdb3361616eb17e80b6acf7e040
Parent
d8eb5cb7a503ac0…
1 file changed
+11
-6
+11
-6
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -831,27 +831,32 @@ | ||
| 831 | 831 | /* |
| 832 | 832 | ** Initialize the query parameter database. Information is pulled from |
| 833 | 833 | ** the QUERY_STRING environment variable (if it exists), from standard |
| 834 | 834 | ** input if there is POST data, and from HTTP_COOKIE. |
| 835 | 835 | ** |
| 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: | |
| 838 | 837 | ** |
| 839 | 838 | ** REQUEST_URI == SCRIPT_NAME + PATH_INFO |
| 840 | 839 | ** |
| 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. | |
| 843 | 847 | ** |
| 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. | |
| 845 | 850 | */ |
| 846 | 851 | void cgi_init(void){ |
| 847 | 852 | char *z; |
| 848 | 853 | const char *zType; |
| 849 | 854 | int len; |
| 850 | 855 | const char *zRequestUri = cgi_parameter("REQUEST_URI",0); |
| 851 | 856 | 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",""); | |
| 853 | 858 | |
| 854 | 859 | #ifdef FOSSIL_ENABLE_JSON |
| 855 | 860 | json_main_bootstrap(); |
| 856 | 861 | #endif |
| 857 | 862 | g.isHTTP = 1; |
| 858 | 863 |
| --- 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 |