]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] set s->srv_error according to the analysers
authorWilly Tarreau <w@1wt.eu>
Sun, 16 Aug 2009 20:45:38 +0000 (22:45 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 16 Aug 2009 20:45:38 +0000 (22:45 +0200)
s->srv_error was set depending on the frontend's protocol. Now it is
set by the HTTP analyser, so that even when switching from a TCP
frontend to an HTTP backend, we can have HTTP error messages.

src/client.c
src/proto_http.c

index c4891686acdf872e164022ff6d3238a996930871..ec8f1201780a65600c9189ae8c4d7fb0f7d9c278 100644 (file)
@@ -231,10 +231,8 @@ int event_accept(int fd) {
                else
                        s->do_log = tcp_sess_log;
 
-               if (p->mode == PR_MODE_HTTP)
-                       s->srv_error = http_return_srv_error;
-               else
-                       s->srv_error = default_srv_error;
+               /* default error reporting function, may be changed by analysers */
+               s->srv_error = default_srv_error;
 
                s->logs.accept_date = date; /* user-visible date for logging */
                s->logs.tv_accept = now;  /* corrected date for internal use */
index 0fb759a323e30224dafb7b8be61a023dc96ee2d5..e495d32bbcdec288a9eea0dab1d65e431db768da 100644 (file)
@@ -1789,6 +1789,9 @@ int http_wait_for_request(struct session *s, struct buffer *req, int an_bit)
                req->l,
                req->analysers);
 
+       /* we're speaking HTTP here, so let's speak HTTP to the client */
+       s->srv_error = http_return_srv_error;
+
        if (likely(req->lr < req->r))
                http_msg_analyzer(req, msg, &txn->hdr_idx);