-
Notifications
You must be signed in to change notification settings - Fork 306
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
Pycurl ignores SIGINT when HEADERFUNCTION is used #413
Comments
Thanks for the reproduce code. I suppose the debugfunction callback in pycurl needs to check Python exceptions prior to returning. The catch here is that libcurl does not allow debug callback to fail - hence I imagine pycurl would need to store the failure flag and fail the overarching perform. This potentially causes its own issues as, for example, the perform might be for a POST/PUT/DELETE which completely succeeded but pycurl would report failure due to the debug callback failing. This delayed failure may be even more complicated/less feasible for async calls (multi interface). |
Oleg, is there any other way to get HTTP headers of request? |
If you are referring to the headers that libcurl sends by default, I do not recall coming across an API facility to retrieve those. |
Yeah, the only way I found is using VERBOSE flag and debug callback that receives various debug info including outgoing headers. |
Sent this upstream, curl/curl#1151. The situation is rather messy to resolve in pycurl alone. |
OK, let's forget about DEBUGFUNCTION and VERBOSE. These things are not commonly used. The HEADERFUNCTION :)
Start the script, then start pressing Ctrl+C. You'll see that In practice such pycurl behaviour leads to different errors. For example, I can't stop execution of Grab tests because most of my Ctrl+C signals are caught by HEADERFUNCTION and converted into pycurl.error which is not fatal for unittest runner. That is true for WRITEFUNCTION also. |
Yep, agree with you there. |
I found workaround. |
Minimal python 3 code to reproduce the problem
When I run it and press Ctrl + C the script does not stop working. I have to press Ctrl + C and wait a few second until accidentally one of SIGINT signals is processed correctly. Example of script output:
The text was updated successfully, but these errors were encountered: