Still not sure why you are using a specific error detection
filter rather than the generic one in -trunk
On Jan 5, 2006, at 2:59 PM, Ruediger Pluem wrote:
@@ -146,13 +162,20 @@
* 2) the trailer
* 3) the end-of-chunked body CRLF
*
- * If there is no EOS bucket, then do nothing.
+ * If there is no EOS bucket, or if we had seen an error
bucket with
+ * 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
+ * we do not create the last-chunk marker and set c-
>keepalive to
+ * AP_CONN_CLOSE in the core output filter.
*
* XXX: it would be nice to combine this with the end-of-
chunk
* marker above, but this is a bit more straight-forward for
* now.
*/
- if (eos != NULL) {
+ if (eos && !f->ctx) {
Code logic doesn't match comment.
+ /*
+ * Ensure that we sent an EOS bucket thru the filter chain, if
we already
+ * have sent some data. Maybe ap_proxy_backend_broke was
called and added
+ * one to the brigade already. So we should not do this in
this case.
+ */
+ if (data_sent && !r->eos_sent && APR_BRIGADE_EMPTY
(output_brigade)) {
+ e = apr_bucket_eos_create(r->connection->bucket_alloc);
+ APR_BRIGADE_INSERT_TAIL(output_brigade, e);
+ }
+
Also, if data_sent is true, then ap_proxy_backend_broke() already
sent the EOS, so why are we checking if it's true again? I
think the logic is wrong...