From 3d4873b9f00dc977575e628e8a1e18cc869d75f0 Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Tue, 3 Oct 2000 22:08:38 +0000 Subject: [PATCH] Change ap_send_fd() so that it returns a proper apr_status_t value instead of the number of bytes sent. default_handler() ignores the ap_send_fd() return code, but mod_file_cache doesn't. When mod_file_cache's handler called ap_send_fd(), the client would get the desired file plus an error document (500 internal server error), which was delivered because mod_file_cache's handler returned an error since ap_send_fd() returned non-zero. Also in this commit is a hack to be able to compile when APACHE_XLATE is defined. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86380 13f79535-47bb-0310-9956-ffa450edef68 --- modules/http/http_protocol.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index b0fd3979ad..2e6b6feafb 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -890,7 +890,7 @@ static int getline(char *s, int n, conn_rec *c, int fold) int length; ap_bucket_brigade *b; ap_bucket *e; -#ifdef APACHE_XLATE +#ifdef APACHE_XLATE_XXX /* When getline() is called, the HTTP protocol is in a state * where we MUST be reading "plain text" protocol stuff, * (Request line, MIME headers, Chunk sizes) regardless of @@ -988,7 +988,7 @@ static int getline(char *s, int n, conn_rec *c, int fold) break; /* if not, input line exceeded buffer size */ } } -#ifdef APACHE_XLATE +#ifdef APACHE_XLATE_XXX /* restore translation handle */ AP_POP_INPUTCONVERSION_STATE(in); #endif /*APACHE_XLATE*/ @@ -2566,6 +2566,7 @@ API_EXPORT(apr_status_t) ap_send_fd(apr_file_t *fd, request_rec *r, apr_off_t of { ap_bucket_brigade *bb = NULL; ap_bucket *b; + apr_status_t rv; bb = ap_brigade_create(r->pool); b = ap_bucket_create_file(fd, offset, len); @@ -2576,9 +2577,15 @@ API_EXPORT(apr_status_t) ap_send_fd(apr_file_t *fd, request_rec *r, apr_off_t of b = ap_bucket_create_eos(); AP_BRIGADE_INSERT_TAIL(bb, b); #endif - ap_pass_brigade(r->output_filters, bb); + rv = ap_pass_brigade(r->output_filters, bb); + if (rv != APR_SUCCESS) { + *nbytes = 0; /* no way to tell how many were actually sent */ + } + else { + *nbytes = len; + } - return len; + return rv; } #if 0 /* Leave the old implementation around temporarily for reference purposes */ -- 2.40.0