diff options
Diffstat (limited to 'src/daemon/postprocessor.c')
-rw-r--r-- | src/daemon/postprocessor.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/src/daemon/postprocessor.c b/src/daemon/postprocessor.c index 241bfcdd..5e25747a 100644 --- a/src/daemon/postprocessor.c +++ b/src/daemon/postprocessor.c | |||
@@ -356,15 +356,15 @@ post_process_urlencoded (struct MHD_PostProcessor *pp, | |||
356 | /* find last position in input buffer that is part of the value */ | 356 | /* find last position in input buffer that is part of the value */ |
357 | amper = 0; | 357 | amper = 0; |
358 | while ((amper + poff < post_data_len) && | 358 | while ((amper + poff < post_data_len) && |
359 | (amper < XBUF_SIZE) && | 359 | (amper < XBUF_SIZE) && |
360 | (post_data[amper + poff] != '&') && | 360 | (post_data[amper + poff] != '&') && |
361 | (post_data[amper + poff] != '\n') && | 361 | (post_data[amper + poff] != '\n') && |
362 | (post_data[amper + poff] != '\r')) | 362 | (post_data[amper + poff] != '\r')) |
363 | amper++; | 363 | amper++; |
364 | end_of_value_found = ( (amper + poff < post_data_len) && | 364 | end_of_value_found = ((amper + poff < post_data_len) && |
365 | ( (post_data[amper + poff] == '&') || | 365 | ((post_data[amper + poff] == '&') || |
366 | (post_data[amper + poff] == '\n') || | 366 | (post_data[amper + poff] == '\n') || |
367 | (post_data[amper + poff] == '\r') ) ); | 367 | (post_data[amper + poff] == '\r'))); |
368 | /* compute delta, the maximum number of bytes that we will be able to | 368 | /* compute delta, the maximum number of bytes that we will be able to |
369 | process right now (either amper-limited of xbuf-size limited) */ | 369 | process right now (either amper-limited of xbuf-size limited) */ |
370 | delta = amper; | 370 | delta = amper; |
@@ -405,29 +405,28 @@ post_process_urlencoded (struct MHD_PostProcessor *pp, | |||
405 | MHD_http_unescape (xbuf); | 405 | MHD_http_unescape (xbuf); |
406 | 406 | ||
407 | /* finally: call application! */ | 407 | /* finally: call application! */ |
408 | if (MHD_NO == | 408 | if (MHD_NO == pp->ikvi (pp->cls, MHD_POSTDATA_KIND, (const char *) &pp[1], /* key */ |
409 | pp->ikvi (pp->cls, MHD_POSTDATA_KIND, (const char *) &pp[1], /* key */ | 409 | NULL, NULL, NULL, xbuf, pp->value_offset, |
410 | NULL, NULL, NULL, xbuf, pp->value_offset, xoff)) | 410 | xoff)) |
411 | { | 411 | { |
412 | pp->state = PP_Error; | 412 | pp->state = PP_Error; |
413 | return MHD_NO; | 413 | return MHD_NO; |
414 | } | 414 | } |
415 | pp->value_offset += xoff; | 415 | pp->value_offset += xoff; |
416 | 416 | ||
417 | /* are we done with the value? */ | 417 | /* are we done with the value? */ |
418 | if (end_of_value_found) | 418 | if (end_of_value_found) |
419 | { | 419 | { |
420 | /* we found the end of the value! */ | 420 | /* we found the end of the value! */ |
421 | if ((post_data[poff] == '\n') || | 421 | if ((post_data[poff] == '\n') || (post_data[poff] == '\r')) |
422 | (post_data[poff] == '\r')) | 422 | { |
423 | { | 423 | pp->state = PP_ExpectNewLine; |
424 | pp->state = PP_ExpectNewLine; | 424 | } |
425 | } | 425 | else |
426 | else | 426 | { |
427 | { | 427 | poff++; /* skip '&' */ |
428 | poff++; /* skip '&' */ | 428 | pp->state = PP_Init; |
429 | pp->state = PP_Init; | 429 | } |
430 | } | ||
431 | } | 430 | } |
432 | break; | 431 | break; |
433 | case PP_ExpectNewLine: | 432 | case PP_ExpectNewLine: |