@@ -697,45 +697,47 @@ apr_status_t modsecurity_request_body_end(modsec_rec *msr, char **error_msg) {
697697 if (msr -> txcfg -> debuglog_level >= 4 ) {
698698 msr_log (msr , 4 , "%s" , * error_msg );
699699 }
700- return -1 ;
700+ return BODY_PARSER_ERR_INVALID_BODY ;
701701 }
702702
703703 if (multipart_get_arguments (msr , "BODY" , msr -> arguments ) < 0 ) {
704704 * error_msg = "Multipart parsing error: Failed to retrieve arguments." ;
705705 msr -> msc_reqbody_error = 1 ;
706706 msr -> msc_reqbody_error_msg = * error_msg ;
707707 msr_log (msr , 2 , "%s" , * error_msg );
708- return -1 ;
708+ return BODY_PARSER_ERR_INVALID_BODY ;
709709 }
710710 }
711711 else if (strcmp (msr -> msc_reqbody_processor , "JSON" ) == 0 ) {
712712#ifdef WITH_YAJL
713- if (json_complete (msr , & my_error_msg ) < 0 && msr -> msc_reqbody_length > 0 ) {
713+ int json_parser_response = json_complete (msr , & my_error_msg );
714+ if (json_parser_response < 0 && msr -> msc_reqbody_length > 0 ) {
714715 * error_msg = apr_psprintf (msr -> mp , "JSON parser error: %s" , my_error_msg );
715716 msr -> msc_reqbody_error = 1 ;
716717 msr -> msc_reqbody_error_msg = * error_msg ;
717718 msr_log (msr , 2 , "%s" , * error_msg );
718- return -1 ;
719+ return json_parser_response ;
719720 }
720721#else
721722 * error_msg = apr_psprintf (msr -> mp , "JSON support was not enabled" );
722723 msr -> msc_reqbody_error = 1 ;
723724 msr -> msc_reqbody_error_msg = * error_msg ;
724725 msr_log (msr , 2 , "%s" , * error_msg );
725- return -1 ;
726+ return BODY_PARSER_ERR_GENERIC ;
726727#endif
727728
728729 }
729730 else if (strcmp (msr -> msc_reqbody_processor , "URLENCODED" ) == 0 ) {
730731 return modsecurity_request_body_end_urlencoded (msr , error_msg );
731732 }
732733 else if (strcmp (msr -> msc_reqbody_processor , "XML" ) == 0 ) {
733- if (xml_complete (msr , & my_error_msg ) < 0 ) {
734+ int xml_parser_response = xml_complete (msr , & my_error_msg );
735+ if (xml_parser_response < 0 ) {
734736 * error_msg = apr_psprintf (msr -> mp , "XML parser error: %s" , my_error_msg );
735737 msr -> msc_reqbody_error = 1 ;
736738 msr -> msc_reqbody_error_msg = * error_msg ;
737739 msr_log (msr , 2 , "%s" , * error_msg );
738- return -1 ;
740+ return xml_parser_response ;
739741 }
740742 }
741743 } else if (msr -> txcfg -> reqbody_buffering != REQUEST_BODY_FORCEBUF_OFF ) {
@@ -746,7 +748,7 @@ apr_status_t modsecurity_request_body_end(modsec_rec *msr, char **error_msg) {
746748 /* Note the request body no files length. */
747749 msr_log (msr , 4 , "Request body no files length: %" APR_SIZE_T_FMT , msr -> msc_reqbody_no_files_length );
748750
749- return 1 ;
751+ return BODY_PARSER_OK_SUCCESS ;
750752}
751753
752754/**
0 commit comments