Fossil SCM

Fixed an incorrect setting of the content type in one error-handling case.

stephan 2011-10-02 23:21 UTC json-multitag-test
Commit 35e4e9188b819854850871a7ee408256b83a8a7c
1 file changed +3 -6
+3 -6
--- src/json.c
+++ src/json.c
@@ -705,15 +705,10 @@
705705
**
706706
** { "code":integer, "text":"string" }
707707
**
708708
** But the text part is optional.
709709
**
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
-**
715710
** If msg is non-NULL and not empty then it is used as the "text"
716711
** property's value. It is copied, and need not refer to static
717712
** memory.
718713
**
719714
** CURRENTLY this code only allows a given warning code to be
@@ -1335,10 +1330,13 @@
13351330
** about to call exit().
13361331
**
13371332
** !g.isHTTP then alsoOutput is ignored and all output is sent to
13381333
** stdout immediately.
13391334
**
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.
13401338
*/
13411339
void json_err( int code, char const * msg, char alsoOutput ){
13421340
int rc = code ? code : (g.json.resultCode
13431341
? g.json.resultCode
13441342
: FSL_JSON_E_UNKNOWN);
@@ -1362,11 +1360,10 @@
13621360
if( g.isHTTP ){
13631361
if(alsoOutput){
13641362
json_send_response(resp);
13651363
}else{
13661364
/* almost a duplicate of json_send_response() :( */
1367
- cgi_set_content_type("application/javascript");
13681365
cgi_reset_content();
13691366
if( g.json.jsonp ){
13701367
cgi_printf("%s(",g.json.jsonp);
13711368
}
13721369
cson_output( resp, cson_data_dest_cgi, NULL, &g.json.outOpt );
13731370
--- 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

Keyboard Shortcuts

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