diff options
-rw-r--r-- | src/sledjchisl/sledjchisl.c | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index 0710063..cddb167 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c | |||
@@ -9619,40 +9619,42 @@ t("BODY"); | |||
9619 | Body = xmalloc(1); | 9619 | Body = xmalloc(1); |
9620 | Body[0] = '\0'; | 9620 | Body[0] = '\0'; |
9621 | } | 9621 | } |
9622 | if (strcmp("application/json", type) == 0) | 9622 | if (NULL != type) |
9623 | { | 9623 | { |
9624 | json_char *json = (json_char*) Body; | 9624 | if (strcmp("application/json", type) == 0) |
9625 | json_value* value = json_parse(json, strtol(Length, NULL, 10)); | ||
9626 | |||
9627 | Rd->body = qhashtbl(0, 0); | ||
9628 | if (value == NULL) | ||
9629 | E("Unable to parse NULL data!"); | ||
9630 | else | ||
9631 | { | 9625 | { |
9632 | // PrintJSON(json); | 9626 | json_char *json = (json_char*) Body; |
9633 | if (value->type == json_object) | 9627 | json_value* value = json_parse(json, strtol(Length, NULL, 10)); |
9634 | { | ||
9635 | int length = value->u.object.length, x; | ||
9636 | 9628 | ||
9637 | for (x = 0; x < length; x++) | 9629 | Rd->body = qhashtbl(0, 0); |
9630 | if (value == NULL) | ||
9631 | E("Unable to parse NULL data!"); | ||
9632 | else | ||
9633 | { | ||
9634 | // PrintJSON(json); | ||
9635 | if (value->type == json_object) | ||
9638 | { | 9636 | { |
9639 | char *name = value->u.object.values[x].name; | 9637 | int length = value->u.object.length, x; |
9640 | 9638 | ||
9641 | if (value->u.object.values[x].value->type == json_string) | 9639 | for (x = 0; x < length; x++) |
9642 | { | 9640 | { |
9643 | D("%s = %s", name, value->u.object.values[x].value->u.string.ptr); | 9641 | char *name = value->u.object.values[x].name; |
9644 | Rd->body->putstr(Rd->body, name, value->u.object.values[x].value->u.string.ptr); | 9642 | |
9645 | } | 9643 | if (value->u.object.values[x].value->type == json_string) |
9646 | 9644 | { | |
9645 | D("%s = %s", name, value->u.object.values[x].value->u.string.ptr); | ||
9646 | Rd->body->putstr(Rd->body, name, value->u.object.values[x].value->u.string.ptr); | ||
9647 | } | ||
9648 | } | ||
9647 | } | 9649 | } |
9648 | } | 9650 | } |
9651 | json_value_free(value); | ||
9652 | } | ||
9653 | else | ||
9654 | { | ||
9655 | Rd->body = toknize(Body, "=&"); | ||
9656 | santize(Rd->body); | ||
9649 | } | 9657 | } |
9650 | json_value_free(value); | ||
9651 | } | ||
9652 | else | ||
9653 | { | ||
9654 | Rd->body = toknize(Body, "=&"); | ||
9655 | santize(Rd->body); | ||
9656 | } | 9658 | } |
9657 | free(Body); | 9659 | free(Body); |
9658 | 9660 | ||