-
Notifications
You must be signed in to change notification settings - Fork 427
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
Use lua-http for http operations if installed #466
base: master
Are you sure you want to change the base?
Conversation
Now have a table that dispatches based on scheme.
Anyone able to review this? |
Also cleanup unused `body` and `header` variables
tsfd:write(headers:get("last-modified")) | ||
tsfd:close() | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file:close() should be added here, or else the file can be used before all contents are saved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved.
@daurnimator the new code is not covered because lua-http isn't installed on travis-ci =( |
end | ||
|
||
-- Try lua-http first | ||
if http_request_ok then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is lua-http interface going to be as stable as luasocket or maybe a version check should be added here?
This is a lot of code and each module-backend option we add multiplies the complexity of our test matrix. Supporting two implementations of the APIs in the codebase (one based on external commands, one based on Lua modules) is already a constant source of headaches, but we currently feel we have to do this because of bootstrapping. So, the pressing question is: why add yet another code path? Adding this means supporting this in the long-term, having to track new dependencies, and making sure every feature we have or add now would need to work properly on all these new scenarios. |
Indeed. I wasn't sure how best to add it to the testing matrix.
The lua-http interfaces I've used I consider stable, minus some of the error indications. |
I find the luasocket http/luasec https modules a mess; I created lua-http as a breath of fresh air.
|
You only answered why you like lua-http better than luasocket (which is obvious, since it's your module). Unfortunately, you didn't provide a convincing argument as for what what real, current problems does this fix to the point that it would justify the additional complexities I enumerated above. One alternative way to go about this would be to think how could we make the structure of LuaRocks more modular to accomodate alternative implementations of things. This, I think, would spark a wider architectural discussion. |
I think @hishamhm has a good point; we need really, really convincing arguments to add another set of complexities |
e237af3
to
0477604
Compare
@daurnimator Revisiting this, there is one killer feature which I think would be worth adding a lua-http backend to |
@hishamhm if I get time to finish off the connection pooling stuff it could. All the foundational stuff is there for it, just need to add the actual pool. |
This pull-request will make luarocks use lua-http for HTTP(S) operations if it is installed.