]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] http: don't mark a server as failed when it returns 501/505
authorWilly Tarreau <w@1wt.eu>
Mon, 15 Mar 2010 18:44:39 +0000 (19:44 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 15 Mar 2010 18:44:39 +0000 (19:44 +0100)
Those two codes can be triggered on demand by client requests.
We must not fail a server on them.

Ideally we should ignore a certain amount of status codes which do
not indicate life nor death.

src/proto_http.c

index ad44a2edbc5be7d984b28c45d0a25410e13661a6..f1ec7cd84f081ee2e782b76834cb8804ba3a34b6 100644 (file)
@@ -4503,7 +4503,11 @@ int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit)
 
        txn->status = strl2ui(msg->sol + msg->sl.st.c, msg->sl.st.c_l);
 
-       if (txn->status >= 100 && txn->status < 500)
+       /* Adjust server's health based on status code. Note: status codes 501
+        * and 505 are triggered on demand by client request, so we must not
+        * count them as server failures.
+        */
+       if (txn->status >= 100 && (txn->status < 500 || txn->status == 501 || txn->status == 505))
                health_adjust(s->srv, HANA_STATUS_HTTP_OK);
        else
                health_adjust(s->srv, HANA_STATUS_HTTP_STS);