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: Fixed bug, so user-agent header now is added to HTTP request #674
Conversation
This commit add minor fix, so user-agent header now is added for HTTP requests.
as_asciiz() allocs pkg memory, so if it is not only one at startup, but every time for each http query, then this commit is introducing a pkg meamory leak. Note that the modparams are zero-terminated strings, even if they are stored in str struct, so the .s field can be used for functions expecting zero-terminated strings. |
After clarification from Olle it looks like that this pull request should be closed, cause he never intended to add header User-Agent with http_client_query function. Meanwhile it looks like there are still bug, cause http_connect function do not adds User-Agent header anyway. |
No discussion here on this tracker item. Was it on mailing lists? |
The bug with as_asciiz may be mine, I need to check that throughout the code. Thanks for the feedback! I run http_connect with user defined headers in my tests. Will check if something broke that part. Thanks Jurij for the feedback. |
This code make http_connect to send user_agent. Not sure if this is correct. :) |
Daniel: The http_client_query was meant to duplicate existing behaviour, including limitations. All new features only go to the http_connect part. Adding all features to the old function doesn't make sense to me. I will document that better. Jurij: Thanks, will check the code. Something must have gone wrong in my merges. |
@os11k - see https://guides.github.com/features/mastering-markdown/ (link is also below the comments form) in order to see the Markdown format that you can use to properly wrap patches and code in the comments. @oej - I think that the http_query name is more suggestive and needs to be preserved if we remove from the utils module and see no reason not to enhance it. But it can be made just an alias to http_connect() function if it has the same parameters, whenever it is removed from utils. |
http_connect has different parameters as it uses the connection configuration paradigm. http_query is just saved for backwards compatibility, nothing else. I agree on preservation, but not maintaining it or adding new stuff to it. Keep it as it is, focus on the new code that is far ahead from http_query in features. |
- based on GH #674, by Jurijs Ivolga - useful for simplified upgrade of the configs using utils version of the http query to the http_client module
Closing this one -- I actually committed a fixed version of this patch -- it was useful recently when migrating a config, as the new config function interface makes it a more complex migration process from utils module. |
This commit add minor fix, so user-agent header now is added for HTTP requests.
I'm not a C programmer, but this fix makes it work. I highly recommend to review this fix. :)