Fossil

Check-in [63a84cb6]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Enhance the CGI processor to assume that PATH_INFO is an empty string if it is omitted.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:63a84cb66efa6bdb3361616eb17e80b6acf7e040
User & Date: drh 2013-10-17 18:36:08
Context
2013-10-17
22:16
Add the 'fossil all clean' and 'fossil all extra' sub-commands. Add -whatif option to the 'fossil clean' command that has the same effect as -dry-run, primarily for use with 'fossil all clean' since the all command itself uses the -dry-run option. check-in: d30e5a48 user: mistachkin tags: trunk
21:44
Merge updates from trunk. Closed-Leaf check-in: 9ee11edb user: mistachkin tags: allExtra
20:22
merge trunk check-in: bf45c30d user: jan.nijtmans tags: tkt-change-hook
18:36
Enhance the CGI processor to assume that PATH_INFO is an empty string if it is omitted. check-in: 63a84cb6 user: drh tags: trunk
18:12
Increase the version number to 1.28. check-in: d8eb5cb7 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/cgi.c.

829
830
831
832
833
834
835
836
837
838
839
840
841
842





843
844

845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
static NORETURN void malformed_request(const char *zMsg);

/*
** Initialize the query parameter database.  Information is pulled from
** the QUERY_STRING environment variable (if it exists), from standard
** input if there is POST data, and from HTTP_COOKIE.
**
** We require parameter SCRIPT_NAME and one of REQUEST_URI or PATH_INFO.
** These three are related as following:
**
**      REQUEST_URI == SCRIPT_NAME + PATH_INFO
**
** Where "+" means concatenate.  One of PATH_INFO or REQUEST_URI can
** be missing and it will be computed from the other two terms.





**
** SCGI typically omits PATH_INFO.  CGI sometimes omits REQUEST_URI.

*/
void cgi_init(void){
  char *z;
  const char *zType;
  int len;
  const char *zRequestUri = cgi_parameter("REQUEST_URI",0);
  const char *zScriptName = cgi_parameter("SCRIPT_NAME",0);
  const char *zPathInfo = cgi_parameter("PATH_INFO",0);

#ifdef FOSSIL_ENABLE_JSON
  json_main_bootstrap();
#endif
  g.isHTTP = 1;
  cgi_destination(CGI_BODY);
  if( zScriptName==0 ) malformed_request("missing SCRIPT_NAME");







<
|



|
|
>
>
>
>
>

|
>







|







829
830
831
832
833
834
835

836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
static NORETURN void malformed_request(const char *zMsg);

/*
** Initialize the query parameter database.  Information is pulled from
** the QUERY_STRING environment variable (if it exists), from standard
** input if there is POST data, and from HTTP_COOKIE.
**

** REQUEST_URI, PATH_INFO, and SCRIPT_NAME are related as follows:
**
**      REQUEST_URI == SCRIPT_NAME + PATH_INFO
**
** Where "+" means concatenate.  Fossil requires SCRIPT_NAME.  If
** REQUEST_URI is provided but PATH_INFO is not, then PATH_INFO is
** computed from REQUEST_URI and SCRIPT_NAME.  If PATH_INFO is provided
** but REQUEST_URI is not, then compute REQUEST_URI from PATH_INFO and
** SCRIPT_NAME.  If neither REQUEST_URI nor PATH_INFO are provided, then
** assume that PATH_INFO is an empty string and set REQUEST_URI equal
** to PATH_INFO.
**
** SCGI typically omits PATH_INFO.  CGI sometimes omits REQUEST_URI and
** PATH_INFO when it is empty.
*/
void cgi_init(void){
  char *z;
  const char *zType;
  int len;
  const char *zRequestUri = cgi_parameter("REQUEST_URI",0);
  const char *zScriptName = cgi_parameter("SCRIPT_NAME",0);
  const char *zPathInfo = cgi_parameter("PATH_INFO","");

#ifdef FOSSIL_ENABLE_JSON
  json_main_bootstrap();
#endif
  g.isHTTP = 1;
  cgi_destination(CGI_BODY);
  if( zScriptName==0 ) malformed_request("missing SCRIPT_NAME");