Skip to content

Commit

Permalink
Minor fixes in rlm_rest
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Dec 31, 2012
1 parent 45607c9 commit 3196677
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/modules/rlm_rest/rest.c
Expand Up @@ -183,6 +183,7 @@ const FR_NAME_NUMBER http_content_type_table[] = {
{ NULL , -1 }
};

#ifdef HAVE_JSON
/** Flags to control the conversion of JSON values to VALUE_PAIRs.
*
* These fields are set when parsing the expanded format for value pairs in
Expand All @@ -192,7 +193,6 @@ const FR_NAME_NUMBER http_content_type_table[] = {
* @see json_pairmake
* @see json_pairmake_leaf
*/
#ifdef HAVE_JSON
typedef struct json_flags {
boolean do_xlat; //!< If TRUE value will be expanded with xlat.
boolean is_json; //!< If TRUE value will be inserted as raw JSON
Expand Down Expand Up @@ -579,7 +579,7 @@ static size_t rest_encode_post(void *ptr, size_t size, size_t nmemb,
* successive calls will return additional encoded VALUE_PAIRs.
*
* Only complete attribute headers
* @verbatim "<name>":{"type":"<type>","value":['</pre> @endverbatim
* @verbatim "<name>":{"type":"<type>","value":[' @endverbatim
* and complete attribute values will be written to ptr.
*
* If an attribute occurs multiple times in the request the attribute values
Expand Down Expand Up @@ -1258,7 +1258,7 @@ static VALUE_PAIR *json_pairmake_leaf(rlm_rest_t *instance,
* @param[in] object containing root node, or parent node.
* @param[in] level Current nesting level.
* @param[in] max_attrs counter, decremented after each VALUE_PAIR is created,
* when 0 no more attributes will be processed.
* when 0 no more attributes will be processed.
* @return VALUE_PAIR or NULL on error.
*/
static VALUE_PAIR *json_pairmake(rlm_rest_t *instance,
Expand Down Expand Up @@ -1483,7 +1483,7 @@ static VALUE_PAIR *json_pairmake(rlm_rest_t *instance,
*
* Converts the raw JSON string into a json-c object tree and passes it to
* json_pairmake. After the tree has been parsed json_object_put is called
* which decrements the reference, count to the root node by one, and frees
* which decrements the reference count of the root node by one, and frees
* the entire tree.
*
* @see rest_encode_json
Expand Down Expand Up @@ -1511,7 +1511,7 @@ static int rest_decode_json(rlm_rest_t *instance,
* Empty response?
*/
while (isspace(*p)) p++;
if (p == NULL) return FALSE;
if (p == '\0') return FALSE;

json = json_tokener_parse(p);
if (!json) {
Expand Down Expand Up @@ -1794,7 +1794,7 @@ static size_t rest_write_body(void *ptr, size_t size, size_t nmemb,
* @see rest_write_header
*
* @param[in] request Current request.
* @param[in] data to initialise.
* @param[in] ctx data to initialise.
* @param[in] type Default http_body_type to use when decoding raw data, may be
* overwritten by rest_write_header.
*/
Expand Down Expand Up @@ -1830,7 +1830,7 @@ static void rest_write_free(rlm_rest_write_t *ctx)
* @param[in] section configuration data.
* @param[in] handle rlm_rest_handle_t to configure.
* @param[in] func to pass to libcurl for chunked.
* transfers (NULL if not using chunked mode).
* transfers (NULL if not using chunked mode).
* @return TRUE on success FALSE on error.
*/
static int rest_request_config_body(rlm_rest_t *instance,
Expand Down Expand Up @@ -2348,6 +2348,7 @@ void rest_request_cleanup(UNUSED rlm_rest_t *instance,
*
* Encode special chars as per RFC 3986 section 4.
*
* @param[in] request Current request.
* @param[out] out Where to write escaped string.
* @param[in] outlen Size of out buffer.
* @param[in] raw string to be urlencoded.
Expand Down Expand Up @@ -2397,7 +2398,7 @@ ssize_t rest_uri_build(rlm_rest_t *instance, rlm_rest_section_t *section,
/*
* All URLs must contain at least <scheme>://<server>/
*/
while (q = strchr(p, '/')) {
while ((q = strchr(p, '/'))) {
p = q + 1;

if (++count == 3) {
Expand Down

0 comments on commit 3196677

Please sign in to comment.