-
Notifications
You must be signed in to change notification settings - Fork 262
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
Support for asynchonous request handling #2
base: master
Are you sure you want to change the base?
Conversation
Hey folks, I've forked cyu's master branch and merged in this request. I then modified it to add support for Goliath (and any other server, I believe, that returns a status of -1 instead of throwing :async. My branch is here: https://github.com/sujal/rack-cors/tree/async_support. Let me know what you think. I don't have a handy test case for the "throw" case, so if you could make sure I didn't break anything, that would help. I do need think of a way to write a test for this. Not sure yet how to tackle that. |
Replacing |
Would love to see @sujal's fork make its way into rack-cors. :) |
Why will you not merge this? |
Actually it works to use async-rack instead:
|
I haven't had the opportunity to understand async handling in Rack works. I'll try to block off some time to look into this. |
Any update on this please? Will this be merged? |
c27465a
to
05e13ac
Compare
👍 |
Hi Calvin, thanks for rack-cors, loving it!
We're using asynchonous request processing in our app — you
throw :async
to tell the web server (e.g. thin) that the response will be sent later; then the web server can serve other requests, and once the response is ready, it is sent out viaenv['async.callback'].call([status, headers, body])
.I've extended rack-cors to support adding the CORS response headers to asynchonous responses as well. This is done by catching and re-throwing the
throw :async
, and by wrapping Rack's async callback in a proxy which adds the appropriate headers.Feel free to use this change if you want :)
Martin