httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvaug...@aventail.com
Subject Re: redirect in post-read phase
Date Tue, 18 May 1999 00:26:41 GMT
A quick grep of the source[1] reveals that every occurance of
ap_send_error_response() contains after it a call to ap_rflush(), except
the one located at the bottom of ap_die() which is the one called when
something other than an OK is returned by a module's post-read phase
handler.

Should perhaps the last call in ap_send_error_response() be a call to
ap_rflush()? Doing this solves my problem at least. Not sure about other
PRs. Sorry.

--- http_protocol.c.orig	Mon May 17 17:23:58 1999
+++ http_protocol.c	Mon May 17 17:24:41 1999
@@ -949,7 +949,6 @@
             ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
                          "request failed: URI too long");
             ap_send_error_response(r, 0);
-            ap_rflush(r);
             ap_log_transaction(r);
             return r;
         }
@@ -963,7 +962,6 @@
             ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
                          "request failed: error reading the headers");
             ap_send_error_response(r, 0);
-            ap_rflush(r);
             ap_log_transaction(r);
             return r;
         }
@@ -983,7 +981,6 @@
             r->header_only = 0;
             r->status = HTTP_BAD_REQUEST;
             ap_send_error_response(r, 0);
-            ap_rflush(r);
             ap_log_transaction(r);
             return r;
         }
@@ -1016,7 +1013,6 @@
                       "client sent HTTP/1.1 request without hostname "
                       "(see RFC2068 section 9, and 14.23): %s", r->uri);
         ap_send_error_response(r, 0);
-        ap_rflush(r);
         ap_log_transaction(r);
         return r;
     }
@@ -1037,7 +1033,6 @@
                           "client sent an unrecognized expectation value of "
                           "Expect: %s", expect);
             ap_send_error_response(r, 0);
-            ap_rflush(r);
             (void) ap_discard_request_body(r);
             ap_log_transaction(r);
             return r;
@@ -2613,4 +2608,5 @@
     }
     ap_kill_timeout(r);
     ap_finalize_request_protocol(r);
+    ap_rflush(r);
 }

-Tom

[1] [tvaughan@rehab apache_1.3.6]$ find . -name *.[ch] -print | xargs grep -n ap_send_error_response
./src/include/ap_compat.h:334:#define send_error_response            ap_send_error_response
./src/include/http_protocol.h:106:void ap_send_error_response(request_rec *r, int recursive_error);
./src/main/http_protocol.c:951:            ap_send_error_response(r, 0);
./src/main/http_protocol.c:965:            ap_send_error_response(r, 0);
./src/main/http_protocol.c:985:            ap_send_error_response(r, 0);
./src/main/http_protocol.c:1018:        ap_send_error_response(r, 0);
./src/main/http_protocol.c:1039:            ap_send_error_response(r, 0);
./src/main/http_protocol.c:2256:void ap_send_error_response(request_rec *r, int recursive_error)
./src/main/http_request.c:1050:    ap_send_error_response(r, recursive_error);
./src/modules/proxy/proxy_util.c:844:    /* Allow the "error-notes" string to be printed by
ap_send_error_response() */

tvaughan@aventail.com writes:

> I apologize for the x-post (I sent this to apache-modules@covalent.net
> yesterday), but I am just far too impatient. Not that a response is
> guaranteed on this list, but my odds are at least better. 
> 
> <X-POST>
> Anybody have any idea why something like this:
> 
>         if (cookie was found)
>                 return DECLINED;
> 
>         location = ap_psprintf(r->pool,
>                                "%s://%s:%d%s?request=%s",
>                                ap_http_method(r),
>                                ap_get_server_name(r),
>                                ap_get_server_port(r),
>                                sconfig->authenticator,
>                                r->unparsed_uri);
> 
>         ap_table_setn(r->headers_out, "Location", location);
>         return REDIRECT;
> 
> would cause NOTHING to be sent to the client? Can a redirect be done in the 
> post-read phase? I haven't traced this down all the way, but it appears
> that apache is going through all the right motions to send the header out,
> it's just that nothing is being write()'d.
> </X-POST>
> 
> -Tom
> 
> -- 
> Tom Vaughan <tvaughan at aventail dot com>
> 

-- 
Tom Vaughan <tvaughan at aventail dot com>

Mime
View raw message