Fossil SCM

In cgi_parse_POST_JSON(), send the FOSSIL-1101 error reply before exiting, so that a POST to a /json page whose content is not a JSON object gets an answer instead of none.

dmestas 2026-11-21 10:41 UTC small-fixes
Commit 73a2d5e978b0b0005c2b976c0b8e11946938e918675dd8a0264b6b1b62b2b17c
1 file changed +1
+1
--- src/cgi.c
+++ src/cgi.c
@@ -1277,10 +1277,11 @@
12771277
json_err( FSL_JSON_E_INVALID_REQUEST,
12781278
"Request envelope must be a JSON Object (not array).", 1 );
12791279
}else{ /* generic error message */
12801280
json_err( FSL_JSON_E_INVALID_REQUEST, NULL, 1 );
12811281
}
1282
+ if( g.isHTTP ) cgi_reply();
12821283
fossil_exit( g.isHTTP ? 0 : 1);
12831284
}
12841285
#endif /* FOSSIL_ENABLE_JSON */
12851286
12861287
/*
12871288
--- src/cgi.c
+++ src/cgi.c
@@ -1277,10 +1277,11 @@
1277 json_err( FSL_JSON_E_INVALID_REQUEST,
1278 "Request envelope must be a JSON Object (not array).", 1 );
1279 }else{ /* generic error message */
1280 json_err( FSL_JSON_E_INVALID_REQUEST, NULL, 1 );
1281 }
 
1282 fossil_exit( g.isHTTP ? 0 : 1);
1283 }
1284 #endif /* FOSSIL_ENABLE_JSON */
1285
1286 /*
1287
--- src/cgi.c
+++ src/cgi.c
@@ -1277,10 +1277,11 @@
1277 json_err( FSL_JSON_E_INVALID_REQUEST,
1278 "Request envelope must be a JSON Object (not array).", 1 );
1279 }else{ /* generic error message */
1280 json_err( FSL_JSON_E_INVALID_REQUEST, NULL, 1 );
1281 }
1282 if( g.isHTTP ) cgi_reply();
1283 fossil_exit( g.isHTTP ? 0 : 1);
1284 }
1285 #endif /* FOSSIL_ENABLE_JSON */
1286
1287 /*
1288

Keyboard Shortcuts

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