]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: client: Reset redirect counter when the request is retried.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sun, 21 Jan 2018 15:08:55 +0000 (16:08 +0100)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Mon, 12 Mar 2018 09:07:37 +0000 (11:07 +0200)
The absence of this reset caused problems when there was a redirect limit and
the request was retried, in which case the limit is reached too soon.

src/lib-http/http-client-request.c

index d575141b40cfca5d71387e41edd7a75daf13da60..646bfc33cd305f48cdff0350ec6caacb0e262956 100644 (file)
@@ -1491,6 +1491,7 @@ void http_client_request_redirect(struct http_client_request *req,
                return;
        }
 
+       i_assert(req->redirects <= req->client->set.max_redirects);
        if (++req->redirects > req->client->set.max_redirects) {
                if (req->client->set.max_redirects > 0) {
                        http_client_request_error(&req,
@@ -1583,6 +1584,7 @@ void http_client_request_resubmit(struct http_client_request *req)
 
        req->peer = NULL;
        req->state = HTTP_REQUEST_STATE_QUEUED;
+       req->redirects = 0;
        http_client_host_submit_request(req->host, req);
 }