Fossil SCM
More fixes.
Commit
37089a5ed10529eb703e7e8d04e8096caef6fd44a50205c47b8d0ef931e10f47
Parent
920a64286dd5e87…
2 files changed
+20
-1
-4
+20
-1
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -1065,11 +1065,11 @@ | ||
| 1065 | 1065 | const char *zServerSoftware = cgi_parameter("SERVER_SOFTWARE",0); |
| 1066 | 1066 | #endif |
| 1067 | 1067 | |
| 1068 | 1068 | #ifdef FOSSIL_ENABLE_JSON |
| 1069 | 1069 | int noJson = P("no_json")!=0; |
| 1070 | - if( noJson==0 ){ json_main_bootstrap(); json_mode_bootstrap(); } | |
| 1070 | + if( noJson==0 ){ json_main_bootstrap(); } | |
| 1071 | 1071 | #endif |
| 1072 | 1072 | g.isHTTP = 1; |
| 1073 | 1073 | cgi_destination(CGI_BODY); |
| 1074 | 1074 | if( zScriptName==0 ) malformed_request("missing SCRIPT_NAME"); |
| 1075 | 1075 | #ifdef _WIN32 |
| @@ -1109,10 +1109,11 @@ | ||
| 1109 | 1109 | ** we are operating in JSON mode or not. We cannot, however, be |
| 1110 | 1110 | ** certain whether we should/need to be in JSON mode until the |
| 1111 | 1111 | ** PATH_INFO is set up. |
| 1112 | 1112 | */ |
| 1113 | 1113 | g.json.isJsonMode = 1; |
| 1114 | + json_mode_bootstrap(); | |
| 1114 | 1115 | }else{ |
| 1115 | 1116 | assert(!g.json.isJsonMode && |
| 1116 | 1117 | "Internal misconfiguration of g.json.isJsonMode"); |
| 1117 | 1118 | } |
| 1118 | 1119 | #endif |
| @@ -1745,10 +1746,13 @@ | ||
| 1745 | 1746 | char *z, *zToken; |
| 1746 | 1747 | const char *zType = 0; |
| 1747 | 1748 | int i, content_length = 0; |
| 1748 | 1749 | char zLine[2000]; /* A single line of input. */ |
| 1749 | 1750 | |
| 1751 | +#ifdef FOSSIL_ENABLE_JSON | |
| 1752 | + if( nCycles==0 ){ json_main_bootstrap(); } | |
| 1753 | +#endif | |
| 1750 | 1754 | if( zIpAddr ){ |
| 1751 | 1755 | if( nCycles==0 ){ |
| 1752 | 1756 | cgi_setenv("REMOTE_ADDR", zIpAddr); |
| 1753 | 1757 | g.zIpAddr = mprintf("%s", zIpAddr); |
| 1754 | 1758 | } |
| @@ -1809,10 +1813,25 @@ | ||
| 1809 | 1813 | |
| 1810 | 1814 | for(i=0; zToken[i] && zToken[i]!='?'; i++){} |
| 1811 | 1815 | if( zToken[i] ) zToken[i++] = 0; |
| 1812 | 1816 | if( nCycles==0 ){ |
| 1813 | 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 | |
| 1814 | 1833 | }else{ |
| 1815 | 1834 | cgi_replace_parameter("PATH_INFO", mprintf("%s",zToken)); |
| 1816 | 1835 | } |
| 1817 | 1836 | |
| 1818 | 1837 | /* Get all the optional fields that follow the first line. |
| 1819 | 1838 |
| --- 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 @@ | ||
| 2554 | 2554 | |
| 2555 | 2555 | /* |
| 2556 | 2556 | ** Process all requests in a single SSH connection if possible. |
| 2557 | 2557 | */ |
| 2558 | 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 | 2559 | blob_zero(&g.cgiIn); |
| 2564 | 2560 | do{ |
| 2565 | 2561 | cgi_handle_ssh_http_request(zIpAddr); |
| 2566 | 2562 | process_one_web_page(0, FileGlob, 0); |
| 2567 | 2563 | blob_reset(&g.cgiIn); |
| 2568 | 2564 |
| --- 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 |