httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruediger Pluem <rpl...@apache.org>
Subject Re: AW: AW: AW: 2.2 mod_http_proxy and "partial" pages
Date Thu, 05 Jan 2006 11:48:25 GMT


On 01/03/2006 06:15 PM, Jim Jagielski wrote:
> 
> On Jan 2, 2006, at 4:18 PM, Ruediger Pluem wrote:
> 
>>
>> 1. Proposal
>> If a subrequest has a broken backend also set r->no_cache for the 
>> main request
>> and ensure that the chunk filter does not sent the last chunk  marker
>> in this case.
>>
>> 2. Proposal
>> If a subrequest has a broken backend do not sent the error bucket. 
>> Only set r->no_cache
>> to ensure that this subrequest response does not get cached.
>>
> 

I am currently working on proposal #1. In order to ensure that the chunk
filter does not sent a last chunk marker in this case I try to memorize
a seen error bucket in the filter context.
But I remember myself that there had been casting issues in the past that
created compiler warnings especially with gcc 4. The patch below compiles
fine with my gcc 3.2.2 with -Wall. So if someone could give a comment
if

f->ctx = (void *)(1)

is fine it would be great.

Regards

RĂ¼diger


Index: chunk_filter.c
===================================================================
--- chunk_filter.c      (Revision 366160)
+++ chunk_filter.c      (Arbeitskopie)
@@ -47,7 +47,6 @@
     apr_bucket_brigade *more;
     apr_bucket *e;
     apr_status_t rv;
-    int bad_gateway_seen = 0;

     for (more = NULL; b; b = more, more = NULL) {
         apr_off_t bytes = 0;
@@ -71,8 +70,11 @@
             if (AP_BUCKET_IS_ERROR(e)
                 && (((ap_bucket_error *)(e->data))->status
                     == HTTP_BAD_GATEWAY)) {
-                /* We had a broken backend. Memorize this. */
-                bad_gateway_seen = 1;
+                /*
+                 * We had a broken backend. Memorize this in the filter
+                 * context.
+                 */
+                f->ctx = (void *)(1);
                 continue;
             }
             if (APR_BUCKET_IS_FLUSH(e)) {
@@ -155,7 +157,8 @@
          *   3) the end-of-chunked body CRLF
          *
          * If there is no EOS bucket, or if we had seen an error bucket with
-         * status HTTP_BAD_GATEWAY then do nothing.
+         * status HTTP_BAD_GATEWAY then do nothing. We have memorized an
+         * error bucket that we had seen in the filter context.
          * The error bucket with status HTTP_BAD_GATEWAY indicates that the
          * connection to the backend (mod_proxy) broke in the middle of the
          * response. In order to signal the client that something went wrong
@@ -166,7 +169,7 @@
          * marker above, but this is a bit more straight-forward for
          * now.
          */
-        if (eos && !bad_gateway_seen) {
+        if (eos && !f->ctx) {
             /* XXX: (2) trailers ... does not yet exist */
             e = apr_bucket_immortal_create(ASCII_ZERO ASCII_CRLF
                                            /* <trailers> */





Mime
View raw message