From: Stephan Bosch Date: Sun, 21 Jan 2018 15:08:55 +0000 (+0100) Subject: lib-http: client: Reset redirect counter when the request is retried. X-Git-Tag: 2.3.1~96 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6d1afbe2471d1fc1d6eef07c2b218d5ec79dbd16;p=thirdparty%2Fdovecot%2Fcore.git lib-http: client: Reset redirect counter when the request is retried. 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. --- diff --git a/src/lib-http/http-client-request.c b/src/lib-http/http-client-request.c index d575141b40..646bfc33cd 100644 --- a/src/lib-http/http-client-request.c +++ b/src/lib-http/http-client-request.c @@ -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); }