util_xml.c revision 1715880355ef7f574cae2e8f973411b51acedede
08cb74ca432a8c24e39f17dedce527e6a47b8001jerenkrantz/* Licensed to the Apache Software Foundation (ASF) under one or more
08cb74ca432a8c24e39f17dedce527e6a47b8001jerenkrantz * contributor license agreements. See the NOTICE file distributed with
b0fb330a8581c8bfab5e523084f9f39264a52b12gstein * this work for additional information regarding copyright ownership.
71da3cca78eea6010f89b139ecadb79e6d213c4fnd * The ASF licenses this file to You under the Apache License, Version 2.0
71da3cca78eea6010f89b139ecadb79e6d213c4fnd * (the "License"); you may not use this file except in compliance with
71da3cca78eea6010f89b139ecadb79e6d213c4fnd * the License. You may obtain a copy of the License at
71da3cca78eea6010f89b139ecadb79e6d213c4fnd * Unless required by applicable law or agreed to in writing, software
71da3cca78eea6010f89b139ecadb79e6d213c4fnd * distributed under the License is distributed on an "AS IS" BASIS,
71da3cca78eea6010f89b139ecadb79e6d213c4fnd * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
71da3cca78eea6010f89b139ecadb79e6d213c4fnd * See the License for the specific language governing permissions and
71da3cca78eea6010f89b139ecadb79e6d213c4fnd * limitations under the License.
f4c310fd2555c6faca1f980f00b161eadb089023gstein/* used for reading input blocks */
f4c310fd2555c6faca1f980f00b161eadb089023gstein/* we know core's module_index is 0 */
98e9c4a310bb623ff788680f88b6bd200ff36a24wroweAP_DECLARE(int) ap_xml_parse_input(request_rec * r, apr_xml_doc **pdoc)
f4c310fd2555c6faca1f980f00b161eadb089023gstein apr_size_t limit_xml_body = ap_get_limit_xml_body(r);
f4c310fd2555c6faca1f980f00b161eadb089023gstein brigade = apr_brigade_create(r->pool, r->connection->bucket_alloc);
5b03ba47ff7225cacb131f14b019332af27da960gstein /* read the body, stuffing it into the parser */
5b03ba47ff7225cacb131f14b019332af27da960gstein result = ap_map_http_request_error(status, HTTP_BAD_REQUEST);
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm const char *data;
f4c310fd2555c6faca1f980f00b161eadb089023gstein status = apr_bucket_read(bucket, &data, &len, APR_BLOCK_READ);
6f15570e3adc0faf87bf55f70857028276fc9e32wrowe ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00539)
6f15570e3adc0faf87bf55f70857028276fc9e32wrowe "XML request body is larger than the configured "
6f15570e3adc0faf87bf55f70857028276fc9e32wrowe /* tell the parser that we're done */
f4c310fd2555c6faca1f980f00b161eadb089023gstein /* Some parsers are stupid and return an error on blank documents. */
f4c310fd2555c6faca1f980f00b161eadb089023gstein ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00540)
f4c310fd2555c6faca1f980f00b161eadb089023gstein apr_xml_parser_convert_doc(r->pool, *pdoc, ap_hdrs_from_ascii);
f4c310fd2555c6faca1f980f00b161eadb089023gstein (void) apr_xml_parser_geterror(parser, errbuf, sizeof(errbuf));
58fd79b56eb624bf011772994e9761d3c2e228c1orlikowski ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00541)
f4c310fd2555c6faca1f980f00b161eadb089023gstein /* FALLTHRU */
f4c310fd2555c6faca1f980f00b161eadb089023gstein /* make sure the parser is terminated */
58fd79b56eb624bf011772994e9761d3c2e228c1orlikowski /* Apache will supply a default error, plus the error log above. */