Skip to content

Commit

Permalink
lib-http: client: Reset redirect counter when the request is retried.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stephanbosch authored and villesavolainen committed Mar 12, 2018
1 parent 0333014 commit 6d1afbe
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib-http/http-client-request.c
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 6d1afbe

Please sign in to comment.