]> granicus.if.org Git - apache/commitdiff
As suggested by Josh Slive, add the explicit 'default' to AcceptPathInfo.
authorWilliam A. Rowe Jr <wrowe@apache.org>
Thu, 13 Dec 2001 19:13:23 +0000 (19:13 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Thu, 13 Dec 2001 19:13:23 +0000 (19:13 +0000)
  I'll leave docs up to him.  The conf becomes a quadstate (undef != default)
  but other than that, it should make things cleaner for the user.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92459 13f79535-47bb-0310-9956-ffa450edef68

include/httpd.h
server/core.c

index 258cb407b384a9c63270ee82687e478a090efef6..aca094ace907b1f6bfb251e8a96fe488fd0204e2 100644 (file)
@@ -593,7 +593,7 @@ struct ap_method_list_t {
 #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):
  */
@@ -606,6 +606,20 @@ struct ap_method_list_t {
 #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
@@ -854,9 +868,13 @@ struct request_rec {
     /** 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
index d334b27dd2222d7f42eb0df2aee9b163fc3d7fa5..3a076243f203b58c3f551e1e3e17683eb021c6f7 100644 (file)
@@ -131,7 +131,7 @@ static void *create_core_dir_config(apr_pool_t *a, char *dir)
     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;
 
@@ -255,7 +255,7 @@ static void *merge_core_dir_configs(apr_pool_t *a, void *basev, void *newv)
     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) {
@@ -1774,11 +1774,23 @@ static const char *set_content_md5(cmd_parms *cmd, void *d_, int arg)
     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;
 }
 
@@ -2437,8 +2449,8 @@ AP_INIT_TAKE1("GprofDir", set_gprof_dir, NULL, RSRC_CONF,
 #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 */
   
@@ -2692,8 +2704,10 @@ static int core_override_type(request_rec *r)
      * 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;
 }