Fossil SCM

Move the JSON error cgi_reply() into fossil_print_error().

mistachkin 2020-06-13 19:11 jsonTestsPass
Commit 6131789870b2449cdb7269ef0680871f6bdb552b0cfd20228369ad9d829024d7
2 files changed -1 +4
-1
--- src/json.c
+++ src/json.c
@@ -1576,11 +1576,10 @@
15761576
cson_output( resp, cson_data_dest_cgi, NULL, &g.json.outOpt );
15771577
if( g.json.jsonp ){
15781578
cgi_append_content(")",1);
15791579
}
15801580
}
1581
- cgi_reply();
15821581
}else{
15831582
json_send_response(resp);
15841583
}
15851584
cson_value_free(resp);
15861585
}
15871586
--- src/json.c
+++ src/json.c
@@ -1576,11 +1576,10 @@
1576 cson_output( resp, cson_data_dest_cgi, NULL, &g.json.outOpt );
1577 if( g.json.jsonp ){
1578 cgi_append_content(")",1);
1579 }
1580 }
1581 cgi_reply();
1582 }else{
1583 json_send_response(resp);
1584 }
1585 cson_value_free(resp);
1586 }
1587
--- src/json.c
+++ src/json.c
@@ -1576,11 +1576,10 @@
1576 cson_output( resp, cson_data_dest_cgi, NULL, &g.json.outOpt );
1577 if( g.json.jsonp ){
1578 cgi_append_content(")",1);
1579 }
1580 }
 
1581 }else{
1582 json_send_response(resp);
1583 }
1584 cson_value_free(resp);
1585 }
1586
--- src/printf.c
+++ src/printf.c
@@ -1085,10 +1085,14 @@
10851085
*/
10861086
if( !json_is_main_boostrapped() ) json_main_bootstrap();
10871087
json_err( 0, z, 1 );
10881088
if( g.isHTTP && !g.json.preserveRc ){
10891089
rc = 0 /* avoid HTTP 500 */;
1090
+ }
1091
+ if( g.cgiOutput==1 ){
1092
+ g.cgiOutput = 2;
1093
+ cgi_reply();
10901094
}
10911095
}
10921096
else
10931097
#endif
10941098
if( g.cgiOutput==1 && g.db ){
10951099
--- src/printf.c
+++ src/printf.c
@@ -1085,10 +1085,14 @@
1085 */
1086 if( !json_is_main_boostrapped() ) json_main_bootstrap();
1087 json_err( 0, z, 1 );
1088 if( g.isHTTP && !g.json.preserveRc ){
1089 rc = 0 /* avoid HTTP 500 */;
 
 
 
 
1090 }
1091 }
1092 else
1093 #endif
1094 if( g.cgiOutput==1 && g.db ){
1095
--- src/printf.c
+++ src/printf.c
@@ -1085,10 +1085,14 @@
1085 */
1086 if( !json_is_main_boostrapped() ) json_main_bootstrap();
1087 json_err( 0, z, 1 );
1088 if( g.isHTTP && !g.json.preserveRc ){
1089 rc = 0 /* avoid HTTP 500 */;
1090 }
1091 if( g.cgiOutput==1 ){
1092 g.cgiOutput = 2;
1093 cgi_reply();
1094 }
1095 }
1096 else
1097 #endif
1098 if( g.cgiOutput==1 && g.db ){
1099

Keyboard Shortcuts

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