|
|
| version 1.43, 2016/07/20 13:57:04 | version 1.45, 2016/09/29 18:49:42 |
|---|---|
| Line 95 static void set_json_value(Json *json, V | Line 95 static void set_json_value(Json *json, V |
| String* json_string(Json *json, const char *value, uint32_t length){ | String* json_string(Json *json, const char *value, uint32_t length){ |
| String::C result = json->charset !=NULL ? | String::C result = json->charset !=NULL ? |
| Charset::transcode(String::C(value, length), UTF8_charset, *json->charset) : | Charset::transcode(String::C(value, length), pa_UTF8_charset, *json->charset) : |
| String::C(pa_strdup(value, length), length); | String::C(pa_strdup(value, length), length); |
| return new String(result, json->taint); | return new String(result, json->taint); |
| } | } |
| Line 107 static Value *json_hook(Request &r, Junc | Line 107 static Value *json_hook(Request &r, Junc |
| frame.store_params(params, 2); | frame.store_params(params, 2); |
| r.execute_method(frame); | r.execute_method(frame); |
| return &frame.result().as_value(); | return &frame.result(); |
| } | } |
| static int json_callback(Json *json, int type, const char *value, uint32_t length) | static int json_callback(Json *json, int type, const char *value, uint32_t length) |
| Line 337 static void _parse(Request& r, MethodPar | Line 337 static void _parse(Request& r, MethodPar |
| } | } |
| const String::Body json_body = json_string.cstr_to_string_body_untaint(String::L_JSON, r.connection(false), &r.charsets); | const String::Body json_body = json_string.cstr_to_string_body_untaint(String::L_JSON, r.connection(false), &r.charsets); |
| const char *json_cstr = json.charset != NULL ? Charset::transcode(json_body, *json.charset, UTF8_charset).cstr() : json_body.cstr(); | const char *json_cstr = json.charset != NULL ? Charset::transcode(json_body, *json.charset, pa_UTF8_charset).cstr() : json_body.cstr(); |
| json_parser parser; | json_parser parser; |
| if(int result = json_parser_init(&parser, &config, (json_parser_callback)&json_callback, &json)) | if(int result = json_parser_init(&parser, &config, (json_parser_callback)&json_callback, &json)) |