Hello,

In the server_response function of httpd, the if comparison to
srv_conf->maxrequests is using the wrong value. The value is derived from the
first server configuration in httpd.conf, since we still don't know which server
name the client is requesting.

This small diff moves srv_conf->maxrequests usage in server_response to
where we finally know which configured server config to actually use.
This ensures we are not using the first configured server config in the
queue.

Thanks,

Tracey

-- 

Tracey Emery

diff e80014c68b2561493718bbcef6e7fcb172d7f885 /usr/src
blob - 326daa6a687ff7159adc744f66b38e6ea9e266eb
file + usr.sbin/httpd/server_http.c
--- usr.sbin/httpd/server_http.c
+++ usr.sbin/httpd/server_http.c
@@ -1232,13 +1232,6 @@ server_response(struct httpd *httpd, struct client *cl
                        clt->clt_persist = 0;
        }
 
-       if (clt->clt_persist >= srv_conf->maxrequests)
-               clt->clt_persist = 0;
-
-       /* pipelining should end after the first "idempotent" method */
-       if (clt->clt_pipelining && clt->clt_toread > 0)
-               clt->clt_persist = 0;
-
        /*
         * Do we have a Host header and matching configuration?
         * XXX the Host can also appear in the URL path.
@@ -1291,6 +1284,13 @@ server_response(struct httpd *httpd, struct client *cl
                        goto fail;
                srv_conf = clt->clt_srv_conf;
        }
+
+       if (clt->clt_persist >= srv_conf->maxrequests)
+               clt->clt_persist = 0;
+
+       /* pipelining should end after the first "idempotent" method */
+       if (clt->clt_pipelining && clt->clt_toread > 0)
+               clt->clt_persist = 0;
 
        if ((desc->http_host = strdup(hostname)) == NULL)
                goto fail;

Reply via email to