util_xml.c revision d19cb7f3aad3cca26355b1125dd10ea6fe0f330a
842ae4bd224140319ae7feec1872b93dfd491143fielding/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
842ae4bd224140319ae7feec1872b93dfd491143fielding * applicable.
842ae4bd224140319ae7feec1872b93dfd491143fielding * Licensed under the Apache License, Version 2.0 (the "License");
842ae4bd224140319ae7feec1872b93dfd491143fielding * you may not use this file except in compliance with the License.
842ae4bd224140319ae7feec1872b93dfd491143fielding * 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.
49f1aab8b6762ee5b4afdb3a9cc48e7c00435dd3striker/* used for reading input blocks */
49f1aab8b6762ee5b4afdb3a9cc48e7c00435dd3strikerAP_DECLARE(int) ap_xml_parse_input(request_rec * r, apr_xml_doc **pdoc)
49f1aab8b6762ee5b4afdb3a9cc48e7c00435dd3striker apr_size_t limit_xml_body = ap_get_limit_xml_body(r);
f4c310fd2555c6faca1f980f00b161eadb089023gstein brigade = apr_brigade_create(r->pool, r->connection->bucket_alloc);
f4c310fd2555c6faca1f980f00b161eadb089023gstein /* read the body, stuffing it into the parser */
000397350b42c6266351bd618fa07df929fa7c79gstein const char *data;
f4c310fd2555c6faca1f980f00b161eadb089023gstein status = apr_bucket_read(bucket, &data, &len, APR_BLOCK_READ);
f4c310fd2555c6faca1f980f00b161eadb089023gstein "XML request body is larger than the configured "
ef3c32d4a7accb38368c7b9face2ade88d987a8bgstein /* tell the parser that we're done */
67ec15681c83d4f5e119f0742618569017beb3fbstriker /* Some parsers are stupid and return an error on blank documents. */
ef3c32d4a7accb38368c7b9face2ade88d987a8bgstein apr_xml_parser_convert_doc(r->pool, *pdoc, ap_hdrs_from_ascii);
49f1aab8b6762ee5b4afdb3a9cc48e7c00435dd3striker (void) apr_xml_parser_geterror(parser, errbuf, sizeof(errbuf));
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm /* FALLTHRU */
f4c310fd2555c6faca1f980f00b161eadb089023gstein /* make sure the parser is terminated */
f4c310fd2555c6faca1f980f00b161eadb089023gstein /* Apache will supply a default error, plus the error log above. */