From: Ian Holsman Date: Mon, 21 Jan 2002 01:43:30 +0000 (+0000) Subject: These changes are to allow caching of subrequests via a quick_handler. X-Git-Tag: 2.0.31~132 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9387a9974d34a7c42b3ffd7f11db95ee37bcb677;p=apache These changes are to allow caching of subrequests via a quick_handler. * Change SUBREQ_CORE so that it is a HTTP_HEADER (20) filter instead of a content filter (10) this allows subrequests to add content filters properly * Change subreq handling of 'handle-include' so that it splits/passes the brigade before the subreq is created. (This allows quick_handler to push content back from this phase) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92956 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 4e581a514b..02439d6146 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,10 @@ Changes with Apache 2.0.31-dev + *) Change in quick_hanlder behavior for subrequests. it now passes DONE + (as it does for a normal request). quick_handled sub-requests now work + in mod-include [Ian Holsman] + + *) Change SUBREQ_CORE so that it is a 'HTTP_HEADER' filter instead of + 'CONTENT' one, as it needs to run AFTER all content headers *) Rename BeOS MPM directive RequestsPerThread to MaxRequestsPerThread. [Lars Eilebrecht] diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c index 0d966d0f6b..6d0cc45106 100644 --- a/modules/filters/mod_include.c +++ b/modules/filters/mod_include.c @@ -1128,6 +1128,7 @@ static int handle_include(include_ctx_t *ctx, apr_bucket_brigade **bb, apr_bucket *tmp_buck; char *parsed_string; int loglevel = APLOG_ERR; + int quick_handler = 0; *inserted_head = NULL; if (ctx->flags & FLAG_PRINTING) { @@ -1144,7 +1145,13 @@ static int handle_include(include_ctx_t *ctx, apr_bucket_brigade **bb, if (!strcmp(tag, "virtual") || !strcmp(tag, "file")) { request_rec *rr = NULL; char *error_fmt = NULL; + apr_status_t rc = APR_SUCCESS; + SPLIT_AND_PASS_PRETAG_BUCKETS(*bb, ctx, f->next, rc); + if (rc != APR_SUCCESS) { + return rc; + } + parsed_string = ap_ssi_parse_string(r, ctx, tag_val, NULL, MAX_STRING_LEN, 0); if (tag[0] == 'f') { @@ -1162,6 +1169,10 @@ static int handle_include(include_ctx_t *ctx, apr_bucket_brigade **bb, else { rr = ap_sub_req_lookup_uri(parsed_string, r, f->next); } + if (rr && rr->status == DONE) { + rr->status = HTTP_OK; + quick_handler = 1; + } if (!error_fmt && rr->status != HTTP_OK) { error_fmt = "unable to include \"%s\" in parsed file %s"; @@ -1227,14 +1238,8 @@ static int handle_include(include_ctx_t *ctx, apr_bucket_brigade **bb, if (!error_fmt) { int rv; - apr_status_t rc = APR_SUCCESS; - - SPLIT_AND_PASS_PRETAG_BUCKETS(*bb, ctx, f->next, rc); - if (rc != APR_SUCCESS) { - return rc; - } - - if ((rv = ap_run_sub_req(rr))) { + + if ((quick_handler==0)&&(rv = ap_run_sub_req(rr))) { if (APR_STATUS_IS_EPIPE(rv)) { /* let's not clutter the log on a busy server */ loglevel = APLOG_INFO; diff --git a/server/core.c b/server/core.c index 713c2716ec..d76dc77d66 100644 --- a/server/core.c +++ b/server/core.c @@ -3684,7 +3684,7 @@ static void register_hooks(apr_pool_t *p) AP_FTYPE_HTTP_HEADER); ap_register_output_filter("CORE", core_output_filter, AP_FTYPE_NETWORK); ap_register_output_filter("SUBREQ_CORE", ap_sub_req_output_filter, - AP_FTYPE_CONTENT); + AP_FTYPE_HTTP_HEADER); ap_old_write_func = ap_register_output_filter("OLD_WRITE", ap_old_write_filter, AP_FTYPE_CONTENT - 10); } diff --git a/server/request.c b/server/request.c index 52bb3a3832..99db38454a 100644 --- a/server/request.c +++ b/server/request.c @@ -146,10 +146,7 @@ AP_DECLARE(int) ap_process_request_internal(request_rec *r) access_status = ap_run_quick_handler(r); if (access_status != DECLINED) { if (access_status == OK) { - if (!r->main) - return DONE; - else - return OK; + return DONE; } else { return access_status;