Fossil SCM

More fixes.

mistachkin 2020-06-11 23:55 jsonTestsPass
Commit 37089a5ed10529eb703e7e8d04e8096caef6fd44a50205c47b8d0ef931e10f47
2 files changed +20 -1 -4
+20 -1
--- src/cgi.c
+++ src/cgi.c
@@ -1065,11 +1065,11 @@
10651065
const char *zServerSoftware = cgi_parameter("SERVER_SOFTWARE",0);
10661066
#endif
10671067
10681068
#ifdef FOSSIL_ENABLE_JSON
10691069
int noJson = P("no_json")!=0;
1070
- if( noJson==0 ){ json_main_bootstrap(); json_mode_bootstrap(); }
1070
+ if( noJson==0 ){ json_main_bootstrap(); }
10711071
#endif
10721072
g.isHTTP = 1;
10731073
cgi_destination(CGI_BODY);
10741074
if( zScriptName==0 ) malformed_request("missing SCRIPT_NAME");
10751075
#ifdef _WIN32
@@ -1109,10 +1109,11 @@
11091109
** we are operating in JSON mode or not. We cannot, however, be
11101110
** certain whether we should/need to be in JSON mode until the
11111111
** PATH_INFO is set up.
11121112
*/
11131113
g.json.isJsonMode = 1;
1114
+ json_mode_bootstrap();
11141115
}else{
11151116
assert(!g.json.isJsonMode &&
11161117
"Internal misconfiguration of g.json.isJsonMode");
11171118
}
11181119
#endif
@@ -1745,10 +1746,13 @@
17451746
char *z, *zToken;
17461747
const char *zType = 0;
17471748
int i, content_length = 0;
17481749
char zLine[2000]; /* A single line of input. */
17491750
1751
+#ifdef FOSSIL_ENABLE_JSON
1752
+ if( nCycles==0 ){ json_main_bootstrap(); }
1753
+#endif
17501754
if( zIpAddr ){
17511755
if( nCycles==0 ){
17521756
cgi_setenv("REMOTE_ADDR", zIpAddr);
17531757
g.zIpAddr = mprintf("%s", zIpAddr);
17541758
}
@@ -1809,10 +1813,25 @@
18091813
18101814
for(i=0; zToken[i] && zToken[i]!='?'; i++){}
18111815
if( zToken[i] ) zToken[i++] = 0;
18121816
if( nCycles==0 ){
18131817
cgi_setenv("PATH_INFO", zToken);
1818
+#ifdef FOSSIL_ENABLE_JSON
1819
+ if(strncmp("/json",zToken,5)==0
1820
+ && (zToken[5]==0 || zToken[5]=='/')){
1821
+ /* We need to change some following behaviour depending on whether
1822
+ ** we are operating in JSON mode or not. We cannot, however, be
1823
+ ** certain whether we should/need to be in JSON mode until the
1824
+ ** PATH_INFO is set up.
1825
+ */
1826
+ g.json.isJsonMode = 1;
1827
+ json_mode_bootstrap();
1828
+ }else{
1829
+ assert(!g.json.isJsonMode &&
1830
+ "Internal misconfiguration of g.json.isJsonMode");
1831
+ }
1832
+#endif
18141833
}else{
18151834
cgi_replace_parameter("PATH_INFO", mprintf("%s",zToken));
18161835
}
18171836
18181837
/* Get all the optional fields that follow the first line.
18191838
--- src/cgi.c
+++ src/cgi.c
@@ -1065,11 +1065,11 @@
1065 const char *zServerSoftware = cgi_parameter("SERVER_SOFTWARE",0);
1066 #endif
1067
1068 #ifdef FOSSIL_ENABLE_JSON
1069 int noJson = P("no_json")!=0;
1070 if( noJson==0 ){ json_main_bootstrap(); json_mode_bootstrap(); }
1071 #endif
1072 g.isHTTP = 1;
1073 cgi_destination(CGI_BODY);
1074 if( zScriptName==0 ) malformed_request("missing SCRIPT_NAME");
1075 #ifdef _WIN32
@@ -1109,10 +1109,11 @@
1109 ** we are operating in JSON mode or not. We cannot, however, be
1110 ** certain whether we should/need to be in JSON mode until the
1111 ** PATH_INFO is set up.
1112 */
1113 g.json.isJsonMode = 1;
 
1114 }else{
1115 assert(!g.json.isJsonMode &&
1116 "Internal misconfiguration of g.json.isJsonMode");
1117 }
1118 #endif
@@ -1745,10 +1746,13 @@
1745 char *z, *zToken;
1746 const char *zType = 0;
1747 int i, content_length = 0;
1748 char zLine[2000]; /* A single line of input. */
1749
 
 
 
1750 if( zIpAddr ){
1751 if( nCycles==0 ){
1752 cgi_setenv("REMOTE_ADDR", zIpAddr);
1753 g.zIpAddr = mprintf("%s", zIpAddr);
1754 }
@@ -1809,10 +1813,25 @@
1809
1810 for(i=0; zToken[i] && zToken[i]!='?'; i++){}
1811 if( zToken[i] ) zToken[i++] = 0;
1812 if( nCycles==0 ){
1813 cgi_setenv("PATH_INFO", zToken);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1814 }else{
1815 cgi_replace_parameter("PATH_INFO", mprintf("%s",zToken));
1816 }
1817
1818 /* Get all the optional fields that follow the first line.
1819
--- src/cgi.c
+++ src/cgi.c
@@ -1065,11 +1065,11 @@
1065 const char *zServerSoftware = cgi_parameter("SERVER_SOFTWARE",0);
1066 #endif
1067
1068 #ifdef FOSSIL_ENABLE_JSON
1069 int noJson = P("no_json")!=0;
1070 if( noJson==0 ){ json_main_bootstrap(); }
1071 #endif
1072 g.isHTTP = 1;
1073 cgi_destination(CGI_BODY);
1074 if( zScriptName==0 ) malformed_request("missing SCRIPT_NAME");
1075 #ifdef _WIN32
@@ -1109,10 +1109,11 @@
1109 ** we are operating in JSON mode or not. We cannot, however, be
1110 ** certain whether we should/need to be in JSON mode until the
1111 ** PATH_INFO is set up.
1112 */
1113 g.json.isJsonMode = 1;
1114 json_mode_bootstrap();
1115 }else{
1116 assert(!g.json.isJsonMode &&
1117 "Internal misconfiguration of g.json.isJsonMode");
1118 }
1119 #endif
@@ -1745,10 +1746,13 @@
1746 char *z, *zToken;
1747 const char *zType = 0;
1748 int i, content_length = 0;
1749 char zLine[2000]; /* A single line of input. */
1750
1751 #ifdef FOSSIL_ENABLE_JSON
1752 if( nCycles==0 ){ json_main_bootstrap(); }
1753 #endif
1754 if( zIpAddr ){
1755 if( nCycles==0 ){
1756 cgi_setenv("REMOTE_ADDR", zIpAddr);
1757 g.zIpAddr = mprintf("%s", zIpAddr);
1758 }
@@ -1809,10 +1813,25 @@
1813
1814 for(i=0; zToken[i] && zToken[i]!='?'; i++){}
1815 if( zToken[i] ) zToken[i++] = 0;
1816 if( nCycles==0 ){
1817 cgi_setenv("PATH_INFO", zToken);
1818 #ifdef FOSSIL_ENABLE_JSON
1819 if(strncmp("/json",zToken,5)==0
1820 && (zToken[5]==0 || zToken[5]=='/')){
1821 /* We need to change some following behaviour depending on whether
1822 ** we are operating in JSON mode or not. We cannot, however, be
1823 ** certain whether we should/need to be in JSON mode until the
1824 ** PATH_INFO is set up.
1825 */
1826 g.json.isJsonMode = 1;
1827 json_mode_bootstrap();
1828 }else{
1829 assert(!g.json.isJsonMode &&
1830 "Internal misconfiguration of g.json.isJsonMode");
1831 }
1832 #endif
1833 }else{
1834 cgi_replace_parameter("PATH_INFO", mprintf("%s",zToken));
1835 }
1836
1837 /* Get all the optional fields that follow the first line.
1838
-4
--- src/main.c
+++ src/main.c
@@ -2554,14 +2554,10 @@
25542554
25552555
/*
25562556
** Process all requests in a single SSH connection if possible.
25572557
*/
25582558
void ssh_request_loop(const char *zIpAddr, Glob *FileGlob){
2559
-#ifdef FOSSIL_ENABLE_JSON
2560
- int noJson = P("no_json")!=0;
2561
- if( noJson==0 ){ json_main_bootstrap(); json_mode_bootstrap(); }
2562
-#endif
25632559
blob_zero(&g.cgiIn);
25642560
do{
25652561
cgi_handle_ssh_http_request(zIpAddr);
25662562
process_one_web_page(0, FileGlob, 0);
25672563
blob_reset(&g.cgiIn);
25682564
--- src/main.c
+++ src/main.c
@@ -2554,14 +2554,10 @@
2554
2555 /*
2556 ** Process all requests in a single SSH connection if possible.
2557 */
2558 void ssh_request_loop(const char *zIpAddr, Glob *FileGlob){
2559 #ifdef FOSSIL_ENABLE_JSON
2560 int noJson = P("no_json")!=0;
2561 if( noJson==0 ){ json_main_bootstrap(); json_mode_bootstrap(); }
2562 #endif
2563 blob_zero(&g.cgiIn);
2564 do{
2565 cgi_handle_ssh_http_request(zIpAddr);
2566 process_one_web_page(0, FileGlob, 0);
2567 blob_reset(&g.cgiIn);
2568
--- src/main.c
+++ src/main.c
@@ -2554,14 +2554,10 @@
2554
2555 /*
2556 ** Process all requests in a single SSH connection if possible.
2557 */
2558 void ssh_request_loop(const char *zIpAddr, Glob *FileGlob){
 
 
 
 
2559 blob_zero(&g.cgiIn);
2560 do{
2561 cgi_handle_ssh_http_request(zIpAddr);
2562 process_one_web_page(0, FileGlob, 0);
2563 blob_reset(&g.cgiIn);
2564

Keyboard Shortcuts

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