Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit09ced44

Browse files
zimmerleFelipe Zimmerle
authored and
Felipe Zimmerle
committed
Supports the yajl version 2
Initially the code was made to support the yajl version 1. Theversion 2 is now the default option in most of Linux distributions.
1 parent8d4c3e4 commit09ced44

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

‎apache2/msc_json.c‎

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ int json_add_argument(modsec_rec *msr, const char *value, unsigned length)
7070
* Callback for hash key values; we use those to define the variable names
7171
* under ARGS. Whenever we reach a new key, we update the current key value.
7272
*/
73-
staticintyajl_map_key(void*ctx,constunsignedchar*key,unsignedintlength)
73+
staticintyajl_map_key(void*ctx,constunsignedchar*key,size_tlength)
7474
{
7575
modsec_rec*msr= (modsec_rec*)ctx;
7676
unsignedchar*safe_key= (unsignedchar*)NULL;
@@ -126,7 +126,7 @@ static int yajl_boolean(void *ctx, int value)
126126
/**
127127
* Callback for string values
128128
*/
129-
staticintyajl_string(void*ctx,constunsignedchar*value,unsignedintlength)
129+
staticintyajl_string(void*ctx,constunsignedchar*value,size_tlength)
130130
{
131131
modsec_rec*msr= (modsec_rec*)ctx;
132132

@@ -138,7 +138,7 @@ static int yajl_string(void *ctx, const unsigned char *value, unsigned int lengt
138138
* float/double values, but since we are not interested in using the numeric
139139
* values here, we use a generic handler which uses numeric strings
140140
*/
141-
staticintyajl_number(void*ctx,constunsignedchar*value,unsignedintlength)
141+
staticintyajl_number(void*ctx,constchar*value,size_tlength)
142142
{
143143
modsec_rec*msr= (modsec_rec*)ctx;
144144

@@ -222,19 +222,18 @@ int json_init(modsec_rec *msr, char **error_msg) {
222222
/**
223223
* yajl configuration and callbacks
224224
*/
225-
staticyajl_parser_configconfig= {0,1 };
226225
staticyajl_callbackscallbacks= {
227226
yajl_null,
228227
yajl_boolean,
229-
NULL/* yajl_integer*/,
230-
NULL/* yajl_double*/,
228+
NULL/* yajl_integer */,
229+
NULL/* yajl_double */,
231230
yajl_number,
232231
yajl_string,
233232
yajl_start_map,
234233
yajl_map_key,
235234
yajl_end_map,
236235
NULL/* yajl_start_array */,
237-
NULL/* yajl_end_array*/
236+
NULL/* yajl_end_array */
238237
};
239238

240239
if (error_msg==NULL)return-1;
@@ -261,7 +260,7 @@ int json_init(modsec_rec *msr, char **error_msg) {
261260
if (msr->txcfg->debuglog_level >=9) {
262261
msr_log(msr,9,"yajl JSON parsing callback initialization");
263262
}
264-
msr->json->handle=yajl_alloc(&callbacks,&config,NULL,msr);
263+
msr->json->handle=yajl_alloc(&callbacks,NULL,msr);
265264

266265
return1;
267266
}
@@ -275,8 +274,7 @@ int json_process_chunk(modsec_rec *msr, const char *buf, unsigned int size, char
275274

276275
/* Feed our parser and catch any errors */
277276
msr->json->status=yajl_parse(msr->json->handle,buf,size);
278-
if (msr->json->status!=yajl_status_ok&&
279-
msr->json->status!=yajl_status_insufficient_data) {
277+
if (msr->json->status!=yajl_status_ok) {
280278
/* We need to free the yajl error message later, how to do this? */
281279
*error_msg=yajl_get_error(msr->json->handle,0,buf,size);
282280
}
@@ -294,9 +292,8 @@ int json_complete(modsec_rec *msr, char **error_msg) {
294292
*error_msg=NULL;
295293

296294
/* Wrap up the parsing process */
297-
msr->json->status=yajl_parse_complete(msr->json->handle);
298-
if (msr->json->status!=yajl_status_ok&&
299-
msr->json->status!=yajl_status_insufficient_data) {
295+
msr->json->status=yajl_complete_parse(msr->json->handle);
296+
if (msr->json->status!=yajl_status_ok) {
300297
/* We need to free the yajl error message later, how to do this? */
301298
*error_msg=yajl_get_error(msr->json->handle,0,NULL,0);
302299
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp