Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the number of esp_http_client authorization retries (IDFGH-3445) #5407

Closed
kaelef opened this issue Jun 6, 2020 · 3 comments
Closed
Labels
Type: Feature Request Feature request for IDF

Comments

@kaelef
Copy link

kaelef commented Jun 6, 2020

Is your feature request related to a problem? Please describe.

esp_http_client currently retries authorization attempts up to the maximum number of redirects. This is a problem because if an incorrect password is provided, esp_http_client will retry that incorrect password 10 times by default. This is likely to trigger an account lock-out on many servers.

Describe the solution you'd like

esp_http_client should only retry an authorization failure once, and only if the current authorization type is set to HTTP_AUTH_TYPE_NONE. It can then attempt to set DIGEST or BASIC once based on the server response.

This change can be made easily by adding a check in esp_http_client_add_auth()
if (client->connection_info.auth_type != HTTP_AUTH_TYPE_NONE) return;

Describe alternatives you've considered

The current implementation provides no alternatives, so I have made a copy of esp_http_client and modified it. I would like not to have my own version of esp_http_client, though.

Additional context

@kaelef kaelef added the Type: Feature Request Feature request for IDF label Jun 6, 2020
@github-actions github-actions bot changed the title Change the number of esp_http_client authorization retries Change the number of esp_http_client authorization retries (IDFGH-3445) Jun 6, 2020
@Alvin1Zhang
Copy link
Collaborator

@kaelef Thanks for raising this feature request.

@shubhamkulkarni97
Copy link
Contributor

@kaelef,

Can you try patch attached below?

It adds a configuration in esp_http_client_config_t to set maximum number of authorization attempts (by default, its value is 10).

Setting max_authorization_retries to 1 will solve your issue.

Please let us know if the patch works for you.
authorization_retries.patch.zip

@kaelef
Copy link
Author

kaelef commented Jun 11, 2020

Yes, this will work - thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Request Feature request for IDF
Projects
None yet
Development

No branches or pull requests

3 participants