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.
Commit
73a2d5e978b0b0005c2b976c0b8e11946938e918675dd8a0264b6b1b62b2b17c
Parent
8313916950351d3…
1 file changed
+1
+1
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -1277,10 +1277,11 @@ | ||
| 1277 | 1277 | json_err( FSL_JSON_E_INVALID_REQUEST, |
| 1278 | 1278 | "Request envelope must be a JSON Object (not array).", 1 ); |
| 1279 | 1279 | }else{ /* generic error message */ |
| 1280 | 1280 | json_err( FSL_JSON_E_INVALID_REQUEST, NULL, 1 ); |
| 1281 | 1281 | } |
| 1282 | + if( g.isHTTP ) cgi_reply(); | |
| 1282 | 1283 | fossil_exit( g.isHTTP ? 0 : 1); |
| 1283 | 1284 | } |
| 1284 | 1285 | #endif /* FOSSIL_ENABLE_JSON */ |
| 1285 | 1286 | |
| 1286 | 1287 | /* |
| 1287 | 1288 |
| --- 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 |