Fossil SCM
Doc changes only
Commit
5a9e567966c25502bbc77573263d4933a237ed8b
Parent
a67c6744e5c786c…
1 file changed
+17
-3
+17
-3
| --- src/json.c | ||
| +++ src/json.c | ||
| @@ -13,16 +13,23 @@ | ||
| 13 | 13 | ** [email protected] |
| 14 | 14 | ** http://www.hwaci.com/drh/ |
| 15 | 15 | ** |
| 16 | 16 | ******************************************************************************* |
| 17 | 17 | ** |
| 18 | -** Code for the JSON/REST API. | |
| 18 | +** Code for the JSON API. | |
| 19 | 19 | ** |
| 20 | 20 | ** For notes regarding the public JSON interface, please see: |
| 21 | 21 | ** |
| 22 | 22 | ** https://docs.google.com/document/d/1fXViveNhDbiXgCuE7QDXQOKeFzf2qNUkBEgiUvoqFN4/edit |
| 23 | 23 | ** |
| 24 | +** | |
| 25 | +** Notable FIXMEs: | |
| 26 | +** | |
| 27 | +** - The overlap between cson_cgi and fossil needs to be gotten rid | |
| 28 | +** of because cson_cgi cannot get all the environment info it needs | |
| 29 | +** when fossil is running in server mode. The goal is to remove all | |
| 30 | +** of the cson_cgi bits. | |
| 24 | 31 | */ |
| 25 | 32 | #include "config.h" |
| 26 | 33 | #include "VERSION.h" |
| 27 | 34 | #include "json.h" |
| 28 | 35 | #include <assert.h> |
| @@ -344,10 +351,16 @@ | ||
| 344 | 351 | ** position of the "json" part of the path. Returns NULL if ndx is out |
| 345 | 352 | ** of bounds or there is no "json" path element. |
| 346 | 353 | ** |
| 347 | 354 | ** In CLI mode the "path" is the list of arguments (skipping argv[0]). |
| 348 | 355 | ** In server/CGI modes the path is taken from PATH_INFO. |
| 356 | +** | |
| 357 | +** | |
| 358 | +** Reminder to self: this breaks in CLI mode when called with an | |
| 359 | +** abbreviated name because we rely on the full name "json" here. The | |
| 360 | +** g object probably has the short form which we can use for our | |
| 361 | +** purposes, but i haven't yet looked for it. | |
| 349 | 362 | */ |
| 350 | 363 | static char const * json_command_arg(unsigned char ndx){ |
| 351 | 364 | cson_array * ar = cson_value_get_array( |
| 352 | 365 | cson_cgi_getenv(&g.json.cgiCx, |
| 353 | 366 | "a", |
| @@ -475,18 +488,19 @@ | ||
| 475 | 488 | |
| 476 | 489 | } |
| 477 | 490 | #endif |
| 478 | 491 | |
| 479 | 492 | /* |
| 480 | -** Creates a new Fossil/REST response envelope skeleton. It is owned | |
| 493 | +** Creates a new Fossil/JSON response envelope skeleton. It is owned | |
| 481 | 494 | ** by the caller, who must eventually free it using cson_value_free(), |
| 482 | 495 | ** or add it to a cson container to transfer ownership. Returns NULL |
| 483 | 496 | ** on error. |
| 484 | 497 | ** |
| 485 | 498 | ** If payload is not NULL and resultCode is 0 then it is set as the |
| 486 | 499 | ** "payload" property of the returned object. If resultCode is non-0 |
| 487 | -** then this function will destroy payload if it is not NULL. | |
| 500 | +** then this function will destroy payload if it is not NULL. i.e. | |
| 501 | +** onwership of payload is transfered to this function. | |
| 488 | 502 | ** |
| 489 | 503 | ** pMsg is an optional message string (resultText) property of the |
| 490 | 504 | ** response. If resultCode is non-0 and pMsg is NULL then |
| 491 | 505 | ** json_err_str() is used to get the error string. The caller may |
| 492 | 506 | ** provide his own or may use an empty string to suppress the |
| 493 | 507 |
| --- src/json.c | |
| +++ src/json.c | |
| @@ -13,16 +13,23 @@ | |
| 13 | ** [email protected] |
| 14 | ** http://www.hwaci.com/drh/ |
| 15 | ** |
| 16 | ******************************************************************************* |
| 17 | ** |
| 18 | ** Code for the JSON/REST API. |
| 19 | ** |
| 20 | ** For notes regarding the public JSON interface, please see: |
| 21 | ** |
| 22 | ** https://docs.google.com/document/d/1fXViveNhDbiXgCuE7QDXQOKeFzf2qNUkBEgiUvoqFN4/edit |
| 23 | ** |
| 24 | */ |
| 25 | #include "config.h" |
| 26 | #include "VERSION.h" |
| 27 | #include "json.h" |
| 28 | #include <assert.h> |
| @@ -344,10 +351,16 @@ | |
| 344 | ** position of the "json" part of the path. Returns NULL if ndx is out |
| 345 | ** of bounds or there is no "json" path element. |
| 346 | ** |
| 347 | ** In CLI mode the "path" is the list of arguments (skipping argv[0]). |
| 348 | ** In server/CGI modes the path is taken from PATH_INFO. |
| 349 | */ |
| 350 | static char const * json_command_arg(unsigned char ndx){ |
| 351 | cson_array * ar = cson_value_get_array( |
| 352 | cson_cgi_getenv(&g.json.cgiCx, |
| 353 | "a", |
| @@ -475,18 +488,19 @@ | |
| 475 | |
| 476 | } |
| 477 | #endif |
| 478 | |
| 479 | /* |
| 480 | ** Creates a new Fossil/REST response envelope skeleton. It is owned |
| 481 | ** by the caller, who must eventually free it using cson_value_free(), |
| 482 | ** or add it to a cson container to transfer ownership. Returns NULL |
| 483 | ** on error. |
| 484 | ** |
| 485 | ** If payload is not NULL and resultCode is 0 then it is set as the |
| 486 | ** "payload" property of the returned object. If resultCode is non-0 |
| 487 | ** then this function will destroy payload if it is not NULL. |
| 488 | ** |
| 489 | ** pMsg is an optional message string (resultText) property of the |
| 490 | ** response. If resultCode is non-0 and pMsg is NULL then |
| 491 | ** json_err_str() is used to get the error string. The caller may |
| 492 | ** provide his own or may use an empty string to suppress the |
| 493 |
| --- src/json.c | |
| +++ src/json.c | |
| @@ -13,16 +13,23 @@ | |
| 13 | ** [email protected] |
| 14 | ** http://www.hwaci.com/drh/ |
| 15 | ** |
| 16 | ******************************************************************************* |
| 17 | ** |
| 18 | ** Code for the JSON API. |
| 19 | ** |
| 20 | ** For notes regarding the public JSON interface, please see: |
| 21 | ** |
| 22 | ** https://docs.google.com/document/d/1fXViveNhDbiXgCuE7QDXQOKeFzf2qNUkBEgiUvoqFN4/edit |
| 23 | ** |
| 24 | ** |
| 25 | ** Notable FIXMEs: |
| 26 | ** |
| 27 | ** - The overlap between cson_cgi and fossil needs to be gotten rid |
| 28 | ** of because cson_cgi cannot get all the environment info it needs |
| 29 | ** when fossil is running in server mode. The goal is to remove all |
| 30 | ** of the cson_cgi bits. |
| 31 | */ |
| 32 | #include "config.h" |
| 33 | #include "VERSION.h" |
| 34 | #include "json.h" |
| 35 | #include <assert.h> |
| @@ -344,10 +351,16 @@ | |
| 351 | ** position of the "json" part of the path. Returns NULL if ndx is out |
| 352 | ** of bounds or there is no "json" path element. |
| 353 | ** |
| 354 | ** In CLI mode the "path" is the list of arguments (skipping argv[0]). |
| 355 | ** In server/CGI modes the path is taken from PATH_INFO. |
| 356 | ** |
| 357 | ** |
| 358 | ** Reminder to self: this breaks in CLI mode when called with an |
| 359 | ** abbreviated name because we rely on the full name "json" here. The |
| 360 | ** g object probably has the short form which we can use for our |
| 361 | ** purposes, but i haven't yet looked for it. |
| 362 | */ |
| 363 | static char const * json_command_arg(unsigned char ndx){ |
| 364 | cson_array * ar = cson_value_get_array( |
| 365 | cson_cgi_getenv(&g.json.cgiCx, |
| 366 | "a", |
| @@ -475,18 +488,19 @@ | |
| 488 | |
| 489 | } |
| 490 | #endif |
| 491 | |
| 492 | /* |
| 493 | ** Creates a new Fossil/JSON response envelope skeleton. It is owned |
| 494 | ** by the caller, who must eventually free it using cson_value_free(), |
| 495 | ** or add it to a cson container to transfer ownership. Returns NULL |
| 496 | ** on error. |
| 497 | ** |
| 498 | ** If payload is not NULL and resultCode is 0 then it is set as the |
| 499 | ** "payload" property of the returned object. If resultCode is non-0 |
| 500 | ** then this function will destroy payload if it is not NULL. i.e. |
| 501 | ** onwership of payload is transfered to this function. |
| 502 | ** |
| 503 | ** pMsg is an optional message string (resultText) property of the |
| 504 | ** response. If resultCode is non-0 and pMsg is NULL then |
| 505 | ** json_err_str() is used to get the error string. The caller may |
| 506 | ** provide his own or may use an empty string to suppress the |
| 507 |