Skip to content
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

coro-http has no timeout #216

Open
edubart opened this issue Jun 15, 2017 · 2 comments
Open

coro-http has no timeout #216

edubart opened this issue Jun 15, 2017 · 2 comments

Comments

@edubart
Copy link

edubart commented Jun 15, 2017

Coro http has no timeout option, if you do a HTTP request to an unresponsive address the coroutine it will never resume.

Test case:

local http = require 'coro-http'
coroutine.wrap(function()
  http.request('GET', 'http://123.123.123.123/')
end)()

Running this example with luvit it will run forever.

This is problematic because I was running a daemon using coro-http and it got stuck forever when my network was down, even after the network became alive again.

@edubart edubart changed the title coro-http timeout coro-http has no timeout Jun 15, 2017
@halfnelson
Copy link

I hit the same problem and I made some changes to my copy of the the core coro-wrapper and coro-channel libraries to provide support for optional read timeouts. They would need to be wired through to http library, but shouldn't be too difficult. Just look for :read in there.

@creationix
Copy link
Member

@halfnelson would you like to send a PR to see if your changes can get merged here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants