Fossil SCM
Fixed an incorrect setting of the content type in one error-handling case.
Commit
35e4e9188b819854850871a7ee408256b83a8a7c
Parent
8eaf58ee5179750…
1 file changed
+3
-6
+3
-6
| --- src/json.c | ||
| +++ src/json.c | ||
| @@ -705,15 +705,10 @@ | ||
| 705 | 705 | ** |
| 706 | 706 | ** { "code":integer, "text":"string" } |
| 707 | 707 | ** |
| 708 | 708 | ** But the text part is optional. |
| 709 | 709 | ** |
| 710 | -** FIXME FIXME FIXME: i am EXPERIMENTALLY using integer codes instead | |
| 711 | -** of FOSSIL-XXXX codes here. i may end up switching FOSSIL-XXXX | |
| 712 | -** string-form codes to integers. Let's ask the mailing list for | |
| 713 | -** opinions... | |
| 714 | -** | |
| 715 | 710 | ** If msg is non-NULL and not empty then it is used as the "text" |
| 716 | 711 | ** property's value. It is copied, and need not refer to static |
| 717 | 712 | ** memory. |
| 718 | 713 | ** |
| 719 | 714 | ** CURRENTLY this code only allows a given warning code to be |
| @@ -1335,10 +1330,13 @@ | ||
| 1335 | 1330 | ** about to call exit(). |
| 1336 | 1331 | ** |
| 1337 | 1332 | ** !g.isHTTP then alsoOutput is ignored and all output is sent to |
| 1338 | 1333 | ** stdout immediately. |
| 1339 | 1334 | ** |
| 1335 | +** For generating the resultCode property: if msg is not NULL then it | |
| 1336 | +** is used as-is. If it is NULL then g.zErrMsg is checked, and if that | |
| 1337 | +** is NULL then json_err_str(code) is used. | |
| 1340 | 1338 | */ |
| 1341 | 1339 | void json_err( int code, char const * msg, char alsoOutput ){ |
| 1342 | 1340 | int rc = code ? code : (g.json.resultCode |
| 1343 | 1341 | ? g.json.resultCode |
| 1344 | 1342 | : FSL_JSON_E_UNKNOWN); |
| @@ -1362,11 +1360,10 @@ | ||
| 1362 | 1360 | if( g.isHTTP ){ |
| 1363 | 1361 | if(alsoOutput){ |
| 1364 | 1362 | json_send_response(resp); |
| 1365 | 1363 | }else{ |
| 1366 | 1364 | /* almost a duplicate of json_send_response() :( */ |
| 1367 | - cgi_set_content_type("application/javascript"); | |
| 1368 | 1365 | cgi_reset_content(); |
| 1369 | 1366 | if( g.json.jsonp ){ |
| 1370 | 1367 | cgi_printf("%s(",g.json.jsonp); |
| 1371 | 1368 | } |
| 1372 | 1369 | cson_output( resp, cson_data_dest_cgi, NULL, &g.json.outOpt ); |
| 1373 | 1370 |
| --- src/json.c | |
| +++ src/json.c | |
| @@ -705,15 +705,10 @@ | |
| 705 | ** |
| 706 | ** { "code":integer, "text":"string" } |
| 707 | ** |
| 708 | ** But the text part is optional. |
| 709 | ** |
| 710 | ** FIXME FIXME FIXME: i am EXPERIMENTALLY using integer codes instead |
| 711 | ** of FOSSIL-XXXX codes here. i may end up switching FOSSIL-XXXX |
| 712 | ** string-form codes to integers. Let's ask the mailing list for |
| 713 | ** opinions... |
| 714 | ** |
| 715 | ** If msg is non-NULL and not empty then it is used as the "text" |
| 716 | ** property's value. It is copied, and need not refer to static |
| 717 | ** memory. |
| 718 | ** |
| 719 | ** CURRENTLY this code only allows a given warning code to be |
| @@ -1335,10 +1330,13 @@ | |
| 1335 | ** about to call exit(). |
| 1336 | ** |
| 1337 | ** !g.isHTTP then alsoOutput is ignored and all output is sent to |
| 1338 | ** stdout immediately. |
| 1339 | ** |
| 1340 | */ |
| 1341 | void json_err( int code, char const * msg, char alsoOutput ){ |
| 1342 | int rc = code ? code : (g.json.resultCode |
| 1343 | ? g.json.resultCode |
| 1344 | : FSL_JSON_E_UNKNOWN); |
| @@ -1362,11 +1360,10 @@ | |
| 1362 | if( g.isHTTP ){ |
| 1363 | if(alsoOutput){ |
| 1364 | json_send_response(resp); |
| 1365 | }else{ |
| 1366 | /* almost a duplicate of json_send_response() :( */ |
| 1367 | cgi_set_content_type("application/javascript"); |
| 1368 | cgi_reset_content(); |
| 1369 | if( g.json.jsonp ){ |
| 1370 | cgi_printf("%s(",g.json.jsonp); |
| 1371 | } |
| 1372 | cson_output( resp, cson_data_dest_cgi, NULL, &g.json.outOpt ); |
| 1373 |
| --- src/json.c | |
| +++ src/json.c | |
| @@ -705,15 +705,10 @@ | |
| 705 | ** |
| 706 | ** { "code":integer, "text":"string" } |
| 707 | ** |
| 708 | ** But the text part is optional. |
| 709 | ** |
| 710 | ** If msg is non-NULL and not empty then it is used as the "text" |
| 711 | ** property's value. It is copied, and need not refer to static |
| 712 | ** memory. |
| 713 | ** |
| 714 | ** CURRENTLY this code only allows a given warning code to be |
| @@ -1335,10 +1330,13 @@ | |
| 1330 | ** about to call exit(). |
| 1331 | ** |
| 1332 | ** !g.isHTTP then alsoOutput is ignored and all output is sent to |
| 1333 | ** stdout immediately. |
| 1334 | ** |
| 1335 | ** For generating the resultCode property: if msg is not NULL then it |
| 1336 | ** is used as-is. If it is NULL then g.zErrMsg is checked, and if that |
| 1337 | ** is NULL then json_err_str(code) is used. |
| 1338 | */ |
| 1339 | void json_err( int code, char const * msg, char alsoOutput ){ |
| 1340 | int rc = code ? code : (g.json.resultCode |
| 1341 | ? g.json.resultCode |
| 1342 | : FSL_JSON_E_UNKNOWN); |
| @@ -1362,11 +1360,10 @@ | |
| 1360 | if( g.isHTTP ){ |
| 1361 | if(alsoOutput){ |
| 1362 | json_send_response(resp); |
| 1363 | }else{ |
| 1364 | /* almost a duplicate of json_send_response() :( */ |
| 1365 | cgi_reset_content(); |
| 1366 | if( g.json.jsonp ){ |
| 1367 | cgi_printf("%s(",g.json.jsonp); |
| 1368 | } |
| 1369 | cson_output( resp, cson_data_dest_cgi, NULL, &g.json.outOpt ); |
| 1370 |