Fossil SCM

Make it possible to disable JSON auto-detection in the CGI subsystem.

mistachkin 2019-08-27 04:15 trunk
Commit a775435357c9c272d201907a67bb03d05d988b969d27450d50742a2e89bf8c47
1 file changed +4 -3
+4 -3
--- src/cgi.c
+++ src/cgi.c
@@ -951,11 +951,12 @@
951951
const char *zRequestUri = cgi_parameter("REQUEST_URI",0);
952952
const char *zScriptName = cgi_parameter("SCRIPT_NAME",0);
953953
const char *zPathInfo = cgi_parameter("PATH_INFO",0);
954954
955955
#ifdef FOSSIL_ENABLE_JSON
956
- json_main_bootstrap();
956
+ int noJson = P("NO_JSON")!=0;
957
+ if( noJson==0 ){ json_main_bootstrap(); }
957958
#endif
958959
g.isHTTP = 1;
959960
cgi_destination(CGI_BODY);
960961
if( zScriptName==0 ) malformed_request("missing SCRIPT_NAME");
961962
if( zRequestUri==0 ){
@@ -998,13 +999,13 @@
998999
if( fossil_strcmp(zType, "application/x-fossil")==0 ){
9991000
blob_read_from_channel(&g.cgiIn, g.httpIn, len);
10001001
blob_uncompress(&g.cgiIn, &g.cgiIn);
10011002
}
10021003
#ifdef FOSSIL_ENABLE_JSON
1003
- else if( fossil_strcmp(zType, "application/json")==0
1004
+ else if( noJson==0 && (fossil_strcmp(zType, "application/json")==0
10041005
|| 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) ){
10061007
g.json.isJsonMode = 1;
10071008
cgi_parse_POST_JSON(g.httpIn, (unsigned int)len);
10081009
/* FIXMEs:
10091010
10101011
- See if fossil really needs g.cgiIn to be set for this purpose
10111012
--- 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

Keyboard Shortcuts

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