]> granicus.if.org Git - apache/commitdiff
Allow modules to specify the first module for a sub-request. This allows
authorRyan Bloom <rbb@apache.org>
Wed, 22 Nov 2000 19:38:07 +0000 (19:38 +0000)
committerRyan Bloom <rbb@apache.org>
Wed, 22 Nov 2000 19:38:07 +0000 (19:38 +0000)
modules to not have to muck with the output_filter after it creates the
sub-request.  Without this change, modules that create a sub-request have
to manually edit the output_filters, and therefore skip the sub-request
output_filter.  If they skip the sub-request output_filter, then we end
up sending multiple EOS buckets to the core_output_filter.

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

include/http_request.h
modules/generators/mod_autoindex.c
modules/http/http_core.c
modules/http/http_request.c
modules/mappers/mod_dir.c
modules/mappers/mod_negotiation.c
server/util_script.c

index b1402b346caa2b8caccc0b52f98e7634e1749991..fb8101171884603ea872c718a14308d892f8a895 100644 (file)
@@ -95,33 +95,43 @@ extern "C" {
  * inspected to find information about the requested URI
  * @param new_file The URI to lookup
  * @param r The current request
+ * @param next_filter The first filter the sub_request should use.  If this is
+ *                    NULL, it defaults to the first filter for the main request
  * @return The new request record
  * @deffunc request_rec * ap_sub_req_lookup_uri(const char *new_file, const request_rec *r)
  */
 AP_DECLARE(request_rec *) ap_sub_req_lookup_uri(const char *new_file,
-                                             const request_rec *r);
+                                                const request_rec *r,
+                                                ap_filter_t *next_filter);
+
 /**
  * Create a sub request for the given file.  This sub request can be
  * inspected to find information about the requested file
  * @param new_file The URI to lookup
  * @param r The current request
+ * @param next_filter The first filter the sub_request should use.  If this is
+ *                    NULL, it defaults to the first filter for the main request
  * @return The new request record
  * @deffunc request_rec * ap_sub_req_lookup_file(const char *new_file, const request_rec *r)
  */
 AP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file,
-                                              const request_rec *r);
+                                              const request_rec *r,
+                                              ap_filter_t *next_filter);
 /**
  * Create a sub request for the given URI using a specific method.  This
  * sub request can be inspected to find information about the requested URI
  * @param method The method to use in the new sub request
  * @param new_file The URI to lookup
  * @param r The current request
+ * @param next_filter The first filter the sub_request should use.  If this is
+ *                    NULL, it defaults to the first filter for the main request
  * @return The new request record
  * @deffunc request_rec * ap_sub_req_method_uri(const char *method, const char *new_file, const request_rec *r)
  */
 AP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method,
                                                 const char *new_file,
-                                                const request_rec *r);
+                                                const request_rec *r,
+                                                ap_filter_t *next_filter);
 /**
  * An output filter to strip EOS buckets from sub-requests.  This always
  * has to be inserted at the end of a sub-requests filter stack.
index ed44bdbaaba5ce83b3d28c0796ab3db759b7a8bb..e0afbc4f8f427b268b932e16efc432b2b998deba 100644 (file)
@@ -974,7 +974,7 @@ static void emit_head(request_rec *r, char *header_fname, int suppress_amble,
      * pretend there's nothing there.
      */
     if ((header_fname != NULL)
-       && (rr = ap_sub_req_lookup_uri(header_fname, r))
+       && (rr = ap_sub_req_lookup_uri(header_fname, r, NULL))
        && (rr->status == HTTP_OK)
        && (rr->filename != NULL)
        && rr->finfo.filetype == APR_REG) {
@@ -1057,7 +1057,7 @@ static void emit_tail(request_rec *r, char *readme_fname, int suppress_amble)
      * pretend there's nothing there.
      */
     if ((readme_fname != NULL)
-       && (rr = ap_sub_req_lookup_uri(readme_fname, r))
+       && (rr = ap_sub_req_lookup_uri(readme_fname, r, NULL))
        && (rr->status == HTTP_OK)
        && (rr->filename != NULL)
        && rr->finfo.filetype == APR_REG) {
@@ -1184,7 +1184,7 @@ static struct ent *make_autoindex_entry(char *name, int autoindex_opts,
     p->version_sort = autoindex_opts & VERSION_SORT;
 
     if (autoindex_opts & FANCY_INDEXING) {
-        request_rec *rr = ap_sub_req_lookup_file(name, r);
+        request_rec *rr = ap_sub_req_lookup_file(name, r, NULL);
 
        if (rr->finfo.protection != 0) {
            p->lm = rr->finfo.mtime;
index a9dfd1faf2812907b2b6b91c8e528dffe7ecf4b6..f6c7e99c19b380b847f0c47a6a05e2127191bfad 100644 (file)
@@ -3009,7 +3009,7 @@ static int default_handler(request_rec *r)
     ap_set_last_modified(r);
     ap_set_etag(r);
     apr_table_setn(r->headers_out, "Accept-Ranges", "bytes");
-    ap_set_content_length(r, r->finfo.size);
+    ap_set_content_length(r, r->finfo.size); 
     if ((errstatus = ap_meets_conditions(r)) != OK) {
         apr_close(fd);
         return errstatus;
index 17bdf53838baff09a6dab641f872594f5eab7383..3da29e49eaca6c6e2e4ec53e340f45b0d0ac92a2 100644 (file)
@@ -806,7 +806,8 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_sub_req_output_filter(ap_filter_t *f,
 
 AP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method,
                                                 const char *new_file,
-                                                const request_rec *r)
+                                                const request_rec *r,
+                                                ap_filter_t *next_filter)
 {
     request_rec *rnew;
     int res;
@@ -830,7 +831,12 @@ AP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method,
     ap_copy_method_list(rnew->allowed_methods, r->allowed_methods);
 
     /* start with the same set of output filters */
-    rnew->output_filters = r->output_filters;
+    if (next_filter) {
+        rnew->output_filters = next_filter;
+    }
+    else {
+        rnew->output_filters = r->output_filters;
+    }
     ap_add_output_filter("SUBREQ_CORE", NULL, rnew, rnew->connection); 
 
     /* no input filters for a subrequest */
@@ -902,13 +908,15 @@ AP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method,
 }
 
 AP_DECLARE(request_rec *) ap_sub_req_lookup_uri(const char *new_file,
-                                                const request_rec *r)
+                                                const request_rec *r,
+                                                ap_filter_t *next_filter)
 {
-    return ap_sub_req_method_uri("GET", new_file, r);
+    return ap_sub_req_method_uri("GET", new_file, r, next_filter);
 }
 
 AP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file,
-                                              const request_rec *r)
+                                              const request_rec *r,
+                                              ap_filter_t *next_filter)
 {
     request_rec *rnew;
     int res;
@@ -932,7 +940,12 @@ AP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file,
     ap_copy_method_list(rnew->allowed_methods, r->allowed_methods);
 
     /* start with the same set of output filters */
-    rnew->output_filters = r->output_filters;
+    if (next_filter) {
+        rnew->output_filters = next_filter;
+    }
+    else {
+        rnew->output_filters = r->output_filters;
+    }
     ap_add_output_filter("SUBREQ_CORE", NULL, rnew, rnew->connection); 
 
     /* no input filters for a subrequest */
index 16926e3950445d917c94ca357a9ed2ac041955d4..76ccdc3ea986fd976dc5fc722e178a313fba1666 100644 (file)
@@ -161,7 +161,7 @@ static int handle_dir(request_rec *r)
 
     for (; num_names; ++names_ptr, --num_names) {
         char *name_ptr = *names_ptr;
-        request_rec *rr = ap_sub_req_lookup_uri(name_ptr, r);
+        request_rec *rr = ap_sub_req_lookup_uri(name_ptr, r, r->output_filters);
 
         if (rr->status == HTTP_OK && rr->finfo.filetype == APR_REG) {
             char *new_uri = ap_escape_uri(r->pool, rr->uri);
index 02c2c12e01275466177b4c2ece5c70f7cbcb28c8..c8919fcbb6285804eaa06af4eb43375ffb12bbca 100644 (file)
@@ -949,7 +949,7 @@ static int read_types_multi(negotiation_state *neg)
          * which we'll be slapping default_type on later).
          */
 
-        sub_req = ap_sub_req_lookup_file(d_name, r);
+        sub_req = ap_sub_req_lookup_file(d_name, r, NULL);
 
         /* If it has a handler, we'll pretend it's a CGI script,
          * since that's a good indication of the sort of thing it
@@ -2314,7 +2314,7 @@ static int setup_choice_response(request_rec *r, negotiation_state *neg,
     if (!variant->sub_req) {
         int status;
 
-        sub_req = ap_sub_req_lookup_file(variant->file_name, r);
+        sub_req = ap_sub_req_lookup_file(variant->file_name, r, NULL);
         status = sub_req->status;
 
         if (status != HTTP_OK && 
@@ -2625,7 +2625,7 @@ static int handle_multi(request_rec *r)
          * a sub_req structure yet.  Get one now.
          */
 
-        sub_req = ap_sub_req_lookup_file(best->file_name, r);
+        sub_req = ap_sub_req_lookup_file(best->file_name, r, NULL);
         if (sub_req->status != HTTP_OK) {
             res = sub_req->status;
             ap_destroy_sub_req(sub_req);
index 2c03feb72bb6f32b53e36c1f3a90e87ec02db35b..786a005cc55eca0a0b91ed583c267e3a9067c35d 100644 (file)
@@ -351,7 +351,8 @@ AP_DECLARE(void) ap_add_cgi_vars(request_rec *r)
         */
        request_rec *pa_req;
 
-       pa_req = ap_sub_req_lookup_uri(ap_escape_uri(r->pool, r->path_info), r);
+       pa_req = ap_sub_req_lookup_uri(ap_escape_uri(r->pool, r->path_info), r,
+                                       NULL);
 
        if (pa_req->filename) {
 #ifdef WIN32