util_xml.c revision c364a517c4f0db3d0a33c662c02f2d567a33e135
842ae4bd224140319ae7feec1872b93dfd491143fielding/* Copyright 2000-2004 The Apache Software Foundation
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
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding * Unless required by applicable law or agreed to in writing, software
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * distributed under the License is distributed on an "AS IS" BASIS,
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * See the License for the specific language governing permissions and
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * limitations under the License.
cccd31fa4a72fe23cc3249c06db181b274a55a69gstein/* used for reading input blocks */
573394373c777e1624a481160f3d02f8fb09f3ffrjungAP_DECLARE(int) ap_xml_parse_input(request_rec * r, apr_xml_doc **pdoc)
cccd31fa4a72fe23cc3249c06db181b274a55a69gstein apr_size_t limit_xml_body = ap_get_limit_xml_body(r);
1b21d7b3d97def358b2e923655edeb16613a1c31gstein brigade = apr_brigade_create(r->pool, r->connection->bucket_alloc);
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding /* read the body, stuffing it into the parser */
7184de27ec1d62a83c41cdeac0953ca9fd661e8csf const char *data;
a7318397b355119d990d1f311b951dea2aafc53arbb status = apr_bucket_read(bucket, &data, &len, APR_BLOCK_READ);
8a3228198adb03e6996f7738c361a612777ecab6aaron "XML request body is larger than the configured "
0f57a69cc84c59eacda1179763ae42ca88f1a577wrowe /* tell the parser that we're done */
82d2a5debc5a6ed2118ac5916d9ba36ad0b5d78btrawick /* Some parsers are stupid and return an error on blank documents. */
f3a0be90718c1fa5da1bf25e38974d2db3ef8a30jorton apr_xml_parser_convert_doc(r->pool, *pdoc, ap_hdrs_from_ascii);
f3a0be90718c1fa5da1bf25e38974d2db3ef8a30jorton (void) apr_xml_parser_geterror(parser, errbuf, sizeof(errbuf));
f3a0be90718c1fa5da1bf25e38974d2db3ef8a30jorton /* FALLTHRU */
7117ace448072813fa6eb7180ef206fc2e8fcfc7wrowe /* make sure the parser is terminated */
f3a0be90718c1fa5da1bf25e38974d2db3ef8a30jorton /* Apache will supply a default error, plus the error log above. */