-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
http client never finishes in asynchronous mode on HTTP_METHOD_HEAD (IDFGH-7444) #9020
Comments
@MarcGeh Thanks for your detailed description. Could you please add |
@ESP-YJM Thanks, I can confirm that this fixes the issue. Will this fix be part of the next release? |
@MarcGeh I'm not sure, but we will fix this as soon as possible. |
FYI for anyone having this issue and not wanting to modify any files inside the esp-idf to fix it, it is also sufficient to simply set errno = 0 before each call of esp_http_client_perform(...) |
@AxelLin Not yet, userspace can avoid it, so I lowered the priority. |
Then this never get fixed. |
Any news here? |
@AxelLin Sorry to response late. The MR need add some automated test and i am busy for other projects. When I have time I will add and push this MR integration. I think this problem can be avoided at the application layer first. |
Just remind this issue was reported on May 25, 2022, which is quite long time ago. |
@AxelLin It has beed merged into master branch and it will backport to v5.x branch. |
@ESP-YJM Could you share which commit fixed this? |
@AxelLin It has merged into the internal master branch and need wait ci passed and will sync to github. |
Environment
Problem Description
When using the esp http client in asynchronous mode on a HTTPS connection with the method HTTP_METHOD_HEAD subsequent calls to esp_http_client_perform(..) will never return anything other than ESP_ERR_HTTP_EAGAIN if the connection has been established successfully and all headers have been received.
Expected Behavior
After all headers have been received esp_http_client_perform(..) should return ESP_OK just like in synchronous mode.
Actual Behavior
After all headers have been received esp_http_client_perform(..) will return ESP_ERR_HTTP_EAGAIN indefinitely.
I believe the issue is due to the behavior of esp_http_client_get_data line(..). In line 992 in esp_http_client.c this function returns 0 if the method is HTTP_METHOD_HEAD. While the client is in HTTP_STATE_RES_ON_DATA_START this function is called and since errno is not modified within it, it is most likely still set to EAGAIN from the previous transaction, which in turn causes this check in line 1181 to always be true.
Steps to reproduce
The text was updated successfully, but these errors were encountered: