-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
Allow http client cancel request (IDFGH-8426) #9892
Comments
I use |
@kayzen9 I don't think you can cancel http request properly unless Espressif support this API in esp-idf. |
Hello @hoangdovan , |
@hmalpani OP seems to know it's not supported, hence the Feature Request label. |
@hmalpani You mean esp-idf will not support this feature in the future? |
Hello @hoangdovan esp_http_client supports requests in both blocking and non-blocking manner. To add support for canceling the HTTP request, we will need to spawn a background task that will consume the server's response. It should be a nonblocking API for this purpose. It should then send some event to inform the client that the request has been canceled. This implementation seems like it will complicate the component. I had a discussion internally and we recommend canceling the HTTP request on the user application side as more feasible. Also in case you have some method to cancel the HTTP request, please feel free to raise a PR. I will be happy to take a look at it. |
Hello @hmalpani now I'm digging into esp-idf source code too, to find if there is any idea for cancel http request. But if something like you claim: "To add support for canceling the HTTP request, we will need to spawn a background task that will consume the server's response", I think the cost to do this is too big. It will increase memory using, CPU still need to working to handle response from server which we want to cancel. |
Hello @hoangdovan |
Hello @hmalpani |
Hello @hoangdovan |
@hmalpani |
Is your feature request related to a problem?
Sometime we need cancel a http request which already sent out (receiving response not completed yet). But the current esp-idf http client API does not include any function to allow cancel http request. So if the response from server is so long, program will be stuck there, waiting until response completed.
Describe the solution you'd like.
Http client API should add function to allow cancel http request which already sent out, discard response so CPU can be free and do another task immediately.
Describe alternatives you've considered.
No response
Additional context.
No response
The text was updated successfully, but these errors were encountered: