mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-15 17:12:14 +03:00
Merge pull request #3454 from airween/v2/xmldeprfix
Fix libxml2 related deprecated issues
This commit is contained in:
@@ -1091,14 +1091,22 @@ int inject_hashed_response_body(modsec_rec *msr, int elts) {
|
|||||||
msr_log(msr, 4, "inject_hashed_response_body: Detected encoding type [%s].",
|
msr_log(msr, 4, "inject_hashed_response_body: Detected encoding type [%s].",
|
||||||
encoding ? encoding : "(none)");
|
encoding ? encoding : "(none)");
|
||||||
|
|
||||||
if (handler == NULL)
|
if (handler == NULL) {
|
||||||
handler = xmlFindCharEncodingHandler("UTF-8");
|
handler = xmlFindCharEncodingHandler("UTF-8");
|
||||||
if (handler == NULL)
|
encoding = apr_pstrdup(msr->mp, "UTF-8");
|
||||||
|
}
|
||||||
|
if (handler == NULL) {
|
||||||
handler = xmlFindCharEncodingHandler("ISO-8859-1");
|
handler = xmlFindCharEncodingHandler("ISO-8859-1");
|
||||||
if (handler == NULL)
|
encoding = apr_pstrdup(msr->mp, "ISO-8859-1");
|
||||||
|
}
|
||||||
|
if (handler == NULL) {
|
||||||
handler = xmlFindCharEncodingHandler("HTML");
|
handler = xmlFindCharEncodingHandler("HTML");
|
||||||
if (handler == NULL)
|
encoding = apr_pstrdup(msr->mp, "HTML");
|
||||||
|
}
|
||||||
|
if (handler == NULL) {
|
||||||
handler = xmlFindCharEncodingHandler("ascii");
|
handler = xmlFindCharEncodingHandler("ascii");
|
||||||
|
encoding = apr_pstrdup(msr->mp, "ascii");
|
||||||
|
}
|
||||||
|
|
||||||
if(handler == NULL) {
|
if(handler == NULL) {
|
||||||
xmlFreeDoc(msr->crypto_html_tree);
|
xmlFreeDoc(msr->crypto_html_tree);
|
||||||
@@ -1106,11 +1114,11 @@ int inject_hashed_response_body(modsec_rec *msr, int elts) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
apr_table_unset(msr->r->headers_out,"Content-Type");
|
apr_table_unset(msr->r->headers_out,"Content-Type");
|
||||||
new_ct = (char*)apr_psprintf(msr->mp, "text/html;%s",handler->name);
|
new_ct = (char*)apr_psprintf(msr->mp, "text/html;%s",encoding);
|
||||||
apr_table_set(msr->r->err_headers_out,"Content-Type",new_ct);
|
apr_table_set(msr->r->err_headers_out,"Content-Type",new_ct);
|
||||||
|
|
||||||
if (msr->txcfg->debuglog_level >= 4)
|
if (msr->txcfg->debuglog_level >= 4)
|
||||||
msr_log(msr, 4, "inject_hashed_response_body: Using content-type [%s].", handler->name);
|
msr_log(msr, 4, "inject_hashed_response_body: Using content-type [%s].", encoding);
|
||||||
|
|
||||||
output_buf = xmlAllocOutputBuffer(handler);
|
output_buf = xmlAllocOutputBuffer(handler);
|
||||||
if (output_buf == NULL) {
|
if (output_buf == NULL) {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ typedef struct xml_data xml_data;
|
|||||||
#include "modsecurity.h"
|
#include "modsecurity.h"
|
||||||
#include <libxml/xmlschemas.h>
|
#include <libxml/xmlschemas.h>
|
||||||
#include <libxml/xpath.h>
|
#include <libxml/xpath.h>
|
||||||
#include <libxml/SAX.h>
|
#include <libxml/SAX2.h>
|
||||||
|
|
||||||
/* Structures */
|
/* Structures */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user