#endif /* APR_CHARSET_EBCDIC */
/**
- * @defgroup values_requet_rec_body Possible values for request_rec.read_body
+ * @defgroup values_request_rec_body Possible values for request_rec.read_body
* @{
* Possible values for request_rec.read_body (set by handling module):
*/
#define REQUEST_CHUNKED_DECHUNK 2
/** @} */
+/**
+ * @defgroup values_request_rec_used_path_info Possible values for request_rec.used_path_info
+ * @{
+ * Possible values for request_rec.used_path_info:
+ */
+
+/** Accept request given path_info */
+#define AP_REQ_ACCEPT_PATH_INFO 0
+/** Send 404 error if path_info was given */
+#define AP_REQ_REJECT_PATH_INFO 1
+/** Module's choice for handling path_info */
+#define AP_REQ_DEFAULT_PATH_INFO 2
+/** @} */
+
/*
* Things which may vary per file-lookup WITHIN a request ---
* e.g., state of MIME config. Basically, the name of an object, info
/** components of uri, dismantled */
apr_uri_t parsed_uri;
- /** Flag for the core handler to permit path_info on the current
- filename, to be consumed by some filter. Unless this is
- toggled, path_info requests are rejected by the core */
+ /** Flag for the handler to accept or reject path_info on
+ * the current request. All modules should respect the
+ * AP_REQ_ACCEPT_PATH_INFO and AP_REQ_REJECT_PATH_INFO
+ * values, while AP_REQ_DEFAULT_PATH_INFO indicates they
+ * may follow existing conventions. This is set to the
+ * user's preference upon HOOK_VERY_FIRST of the fixups.
+ */
int used_path_info;
/* Various other config info which may change with .htaccess files
conf->override = dir ? OR_UNSET : OR_UNSET|OR_ALL;
conf->content_md5 = 2;
- conf->accept_path_info = 2;
+ conf->accept_path_info = AP_REQ_DEFAULT_PATH_INFO;
conf->use_canonical_name = USE_CANONICAL_NAME_UNSET;
if ((new->content_md5 & 2) == 0) {
conf->content_md5 = new->content_md5;
}
- if ((new->accept_path_info & 2) == 0) {
+ if (new->accept_path_info != 3) {
conf->accept_path_info = new->accept_path_info;
}
if (new->use_canonical_name != USE_CANONICAL_NAME_UNSET) {
return NULL;
}
-static const char *set_accept_path_info(cmd_parms *cmd, void *d_, int arg)
+static const char *set_accept_path_info(cmd_parms *cmd, void *d_, const char *arg)
{
core_dir_config *d=d_;
-
- d->accept_path_info = arg != 0;
+
+ if (strcasecmp(arg, "on") == 0) {
+ d->accept_path_info = AP_REQ_ACCEPT_PATH_INFO;
+ }
+ else if (strcasecmp(arg, "off") == 0) {
+ d->accept_path_info = AP_REQ_REJECT_PATH_INFO;
+ }
+ else if (strcasecmp(arg, "default") == 0) {
+ d->accept_path_info = AP_REQ_DEFAULT_PATH_INFO;
+ }
+ else {
+ return "AcceptPathInfo must be set to on, off or default";
+ }
+
return NULL;
}
#endif
AP_INIT_TAKE1("AddDefaultCharset", set_add_default_charset, NULL, OR_FILEINFO,
"The name of the default charset to add to any Content-Type without one or 'Off' to disable"),
-AP_INIT_FLAG("AcceptPathInfo", set_accept_path_info, NULL, OR_FILEINFO,
- "whether or not files with PATH_INFO will be served by the core handler"),
+AP_INIT_TAKE1("AcceptPathInfo", set_accept_path_info, NULL, OR_FILEINFO,
+ "Set to on or off for PATH_INFO to be accepted by handlers, or default for the per-handler preference"),
/* Old resource config file commands */
* if the value is no longer undefined (2), so any module changing
* the value prior to the fixup phase OVERRIDES the user's choice.
*/
- if (r->used_path_info == 2)
+ if ((r->used_path_info == AP_REQ_DEFAULT_PATH_INFO)
+ && (conf->accept_path_info != 3)) {
r->used_path_info = conf->accept_path_info;
+ }
return OK;
}