Fossil SCM
Make it possible to disable JSON auto-detection in the CGI subsystem.
Commit
a775435357c9c272d201907a67bb03d05d988b969d27450d50742a2e89bf8c47
Parent
c6a033cea66f8c0…
1 file changed
+4
-3
+4
-3
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -951,11 +951,12 @@ | ||
| 951 | 951 | const char *zRequestUri = cgi_parameter("REQUEST_URI",0); |
| 952 | 952 | const char *zScriptName = cgi_parameter("SCRIPT_NAME",0); |
| 953 | 953 | const char *zPathInfo = cgi_parameter("PATH_INFO",0); |
| 954 | 954 | |
| 955 | 955 | #ifdef FOSSIL_ENABLE_JSON |
| 956 | - json_main_bootstrap(); | |
| 956 | + int noJson = P("NO_JSON")!=0; | |
| 957 | + if( noJson==0 ){ json_main_bootstrap(); } | |
| 957 | 958 | #endif |
| 958 | 959 | g.isHTTP = 1; |
| 959 | 960 | cgi_destination(CGI_BODY); |
| 960 | 961 | if( zScriptName==0 ) malformed_request("missing SCRIPT_NAME"); |
| 961 | 962 | if( zRequestUri==0 ){ |
| @@ -998,13 +999,13 @@ | ||
| 998 | 999 | if( fossil_strcmp(zType, "application/x-fossil")==0 ){ |
| 999 | 1000 | blob_read_from_channel(&g.cgiIn, g.httpIn, len); |
| 1000 | 1001 | blob_uncompress(&g.cgiIn, &g.cgiIn); |
| 1001 | 1002 | } |
| 1002 | 1003 | #ifdef FOSSIL_ENABLE_JSON |
| 1003 | - else if( fossil_strcmp(zType, "application/json")==0 | |
| 1004 | + else if( noJson==0 && (fossil_strcmp(zType, "application/json")==0 | |
| 1004 | 1005 | || fossil_strcmp(zType,"text/plain")==0/*assume this MIGHT be JSON*/ |
| 1005 | - || fossil_strcmp(zType,"application/javascript")==0){ | |
| 1006 | + || fossil_strcmp(zType,"application/javascript")==0) ){ | |
| 1006 | 1007 | g.json.isJsonMode = 1; |
| 1007 | 1008 | cgi_parse_POST_JSON(g.httpIn, (unsigned int)len); |
| 1008 | 1009 | /* FIXMEs: |
| 1009 | 1010 | |
| 1010 | 1011 | - See if fossil really needs g.cgiIn to be set for this purpose |
| 1011 | 1012 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -951,11 +951,12 @@ | |
| 951 | const char *zRequestUri = cgi_parameter("REQUEST_URI",0); |
| 952 | const char *zScriptName = cgi_parameter("SCRIPT_NAME",0); |
| 953 | const char *zPathInfo = cgi_parameter("PATH_INFO",0); |
| 954 | |
| 955 | #ifdef FOSSIL_ENABLE_JSON |
| 956 | json_main_bootstrap(); |
| 957 | #endif |
| 958 | g.isHTTP = 1; |
| 959 | cgi_destination(CGI_BODY); |
| 960 | if( zScriptName==0 ) malformed_request("missing SCRIPT_NAME"); |
| 961 | if( zRequestUri==0 ){ |
| @@ -998,13 +999,13 @@ | |
| 998 | if( fossil_strcmp(zType, "application/x-fossil")==0 ){ |
| 999 | blob_read_from_channel(&g.cgiIn, g.httpIn, len); |
| 1000 | blob_uncompress(&g.cgiIn, &g.cgiIn); |
| 1001 | } |
| 1002 | #ifdef FOSSIL_ENABLE_JSON |
| 1003 | else if( fossil_strcmp(zType, "application/json")==0 |
| 1004 | || fossil_strcmp(zType,"text/plain")==0/*assume this MIGHT be JSON*/ |
| 1005 | || fossil_strcmp(zType,"application/javascript")==0){ |
| 1006 | g.json.isJsonMode = 1; |
| 1007 | cgi_parse_POST_JSON(g.httpIn, (unsigned int)len); |
| 1008 | /* FIXMEs: |
| 1009 | |
| 1010 | - See if fossil really needs g.cgiIn to be set for this purpose |
| 1011 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -951,11 +951,12 @@ | |
| 951 | const char *zRequestUri = cgi_parameter("REQUEST_URI",0); |
| 952 | const char *zScriptName = cgi_parameter("SCRIPT_NAME",0); |
| 953 | const char *zPathInfo = cgi_parameter("PATH_INFO",0); |
| 954 | |
| 955 | #ifdef FOSSIL_ENABLE_JSON |
| 956 | int noJson = P("NO_JSON")!=0; |
| 957 | if( noJson==0 ){ json_main_bootstrap(); } |
| 958 | #endif |
| 959 | g.isHTTP = 1; |
| 960 | cgi_destination(CGI_BODY); |
| 961 | if( zScriptName==0 ) malformed_request("missing SCRIPT_NAME"); |
| 962 | if( zRequestUri==0 ){ |
| @@ -998,13 +999,13 @@ | |
| 999 | if( fossil_strcmp(zType, "application/x-fossil")==0 ){ |
| 1000 | blob_read_from_channel(&g.cgiIn, g.httpIn, len); |
| 1001 | blob_uncompress(&g.cgiIn, &g.cgiIn); |
| 1002 | } |
| 1003 | #ifdef FOSSIL_ENABLE_JSON |
| 1004 | else if( noJson==0 && (fossil_strcmp(zType, "application/json")==0 |
| 1005 | || fossil_strcmp(zType,"text/plain")==0/*assume this MIGHT be JSON*/ |
| 1006 | || fossil_strcmp(zType,"application/javascript")==0) ){ |
| 1007 | g.json.isJsonMode = 1; |
| 1008 | cgi_parse_POST_JSON(g.httpIn, (unsigned int)len); |
| 1009 | /* FIXMEs: |
| 1010 | |
| 1011 | - See if fossil really needs g.cgiIn to be set for this purpose |
| 1012 |