]> granicus.if.org Git - apache/blob - include/mod_request.h
mod_cache: Add the cache_status hook to register the final cache
[apache] / include / mod_request.h
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements.  See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License.  You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 /**
19  * @file  mod_request.h
20  * @brief mod_request private header file
21  *
22  * @defgroup MOD_REQUEST mod_request
23  * @ingroup  APACHE_MODS
24  * @{
25  */
26
27 #ifndef MOD_REQUEST_H
28 #define MOD_REQUEST_H
29
30 #include "apr.h"
31 #include "apr_buckets.h"
32 #include "apr_optional.h"
33
34 #include "httpd.h"
35 #include "util_filter.h"
36
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 extern module AP_MODULE_DECLARE_DATA request_module;
43
44 #define KEEP_BODY_FILTER "KEEP_BODY"
45 #define KEPT_BODY_FILTER "KEPT_BODY"
46
47 /**
48  * Core per-directory configuration.
49  */
50 typedef struct {
51     apr_off_t keep_body;
52     int keep_body_set;
53 } request_dir_conf;
54
55 /**
56  * Structure to store the contents of an HTTP form of the type
57  * application/x-www-form-urlencoded.
58  * 
59  * Currently it contains the name as a char* of maximum length
60  * HUGE_STRING_LEN, and a value in the form of a bucket brigade
61  * of arbitrary length.
62  */
63 typedef struct {
64     const char *name;
65     apr_bucket_brigade *value;
66 } ap_form_pair_t;
67
68 /**
69  * Read the body and parse any form found, which must be of the
70  * type application/x-www-form-urlencoded.
71  *
72  * Name/value pairs are returned in an array, with the names as
73  * strings with a maximum length of HUGE_STRING_LEN, and the
74  * values as bucket brigades. This allows values to be arbitrarily
75  * large.
76  *
77  * All url-encoding is removed from both the names and the values
78  * on the fly. The names are interpreted as strings, while the
79  * values are interpreted as blocks of binary data, that may
80  * contain the 0 character.
81  *
82  * In order to ensure that resource limits are not exceeded, a
83  * maximum size must be provided. If the sum of the lengths of
84  * the names and the values exceed this size, this function
85  * will return HTTP_REQUEST_ENTITY_TOO_LARGE.
86  *
87  * An optional number of parameters can be provided, if the number
88  * of parameters provided exceeds this amount, this function will
89  * return HTTP_REQUEST_ENTITY_TOO_LARGE. If this value is negative,
90  * no limit is imposed, and the number of parameters is in turn
91  * constrained by the size parameter above.
92  * 
93  * This function honours any kept_body configuration, and the
94  * original raw request body will be saved to the kept_body brigade
95  * if so configured, just as ap_discard_request_body does.
96  * 
97  * NOTE: File upload is not yet supported, but can be without change
98  * to the function call.
99  */
100
101 APR_DECLARE_OPTIONAL_FN(int, ap_parse_request_form, (request_rec * r, ap_filter_t * f, 
102                                                      apr_array_header_t ** ptr,
103                                                      apr_size_t num, apr_size_t size));
104
105 APR_DECLARE_OPTIONAL_FN(void, ap_request_insert_filter, (request_rec * r));
106
107 APR_DECLARE_OPTIONAL_FN(void, ap_request_remove_filter, (request_rec * r));
108
109 #ifdef __cplusplus
110 }
111 #endif
112
113 #endif /* !MOD_REQUEST_H */
114 /** @} */