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

Expose Webmachine::Application to adapters #154

Merged
merged 1 commit into from
Mar 17, 2014
Merged

Conversation

Asmod4n
Copy link
Member

@Asmod4n Asmod4n commented Feb 25, 2014

In order to implement secure Proxy support i need to get a hold of the application instance in every adapter, this adds that.

It also changes specs so each adapter gets its own random Port which fixes some #126 issues.

let(:adapter) do
described_class.new(configuration, dispatcher)
server = TCPServer.new('0.0.0.0', 0)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's some duplication here. it looks like the shared examples for adapter_lint also look for an available port and assign that in before(:all) as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reel runs it's tests twice. One for the normal lint and another time for websockets. That's also the reason for the bind errors because the websocket test tries to run on the same port before the normal test server has shut down.

Von einem mobilen Gerät gesendet

Am 25.02.2014 um 06:58 schrieb Robert [email protected]:

In spec/webmachine/adapters/reel_spec.rb:

let(:adapter) do

  • described_class.new(configuration, dispatcher)
  • server = TCPServer.new('0.0.0.0', 0)
    there's some duplication here. it looks like the shared examples for adapter_lint also look for an available port and assign that in before(:all) as well.


Reply to this email directly or view it on GitHub.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you think this commit could help? ebe22fc

it_should_behave_like :adapter_lint is scoped to its own context block, so the before(:all) /after(:all) filter setup in the shared examples for adapter lint wouldn't be run for the web socket examples and the web socket examples seem to take care of their own setup.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it passed twice on travis.

@ghost
Copy link

ghost commented Feb 26, 2014

sometimes a local copy of rbx-head fails randomly with:

.E, [2014-02-26T02:25:33.230133 #70649] ERROR -- : Reel::Server crashed!
ArgumentError: Data object has already been freed
        /Users/robert/.gem/rbx/2.1.0/gems/reel-0.4.0/lib/reel/request_parser.rb:46:in `readpartial'
        /Users/robert/.gem/rbx/2.1.0/gems/reel-0.4.0/lib/reel/request_parser.rb:39:in `current_request'
        /Users/robert/.gem/rbx/2.1.0/gems/reel-0.4.0/lib/reel/connection.rb:57:in `request'
        /Users/robert/.gem/rbx/2.1.0/gems/reel-0.4.0/lib/reel/connection.rb:73:in `each_request'
        /Users/robert/code/webmachine-ruby/lib/webmachine/adapters/reel.rb:39:in `process'

@ghost
Copy link

ghost commented Feb 26, 2014

this looks good to me. ready for merge? anyone else have thoughts?

@Asmod4n
Copy link
Member Author

Asmod4n commented Feb 26, 2014

Have a PR for jruby-http-kit ready.

Von einem mobilen Gerät gesendet

Am 26.02.2014 um 07:31 schrieb Robert [email protected]:

this looks good to me. ready for merge? anyone else have thoughts?


Reply to this email directly or view it on GitHub.

@seancribbs
Copy link
Member

@robgleeson I'm generally unopposed to this in concept, but I want a chance to read the code carefully before we merge. EOD tomorrow should be long enough, thanks!

@Asmod4n
Copy link
Member Author

Asmod4n commented Mar 16, 2014

@seancribbs got around to take a look yet?

@@ -1,5 +1,5 @@
require 'i18n'

I18n.enforce_available_locales = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please wrap this in a if ... respond_to?. Older versions of i18n break.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other option is to bump the minimum required version in the Gemfile or gemspec.

@seancribbs
Copy link
Member

Aside from the version compatibility thing, I'm 👍 on this. It will also enable other things we might desire in the future.

Also randomly assignes a port when running RSpec
@Asmod4n
Copy link
Member Author

Asmod4n commented Mar 16, 2014

what comes to mind is temporary urls, because you can now change the dispatcher routes from within a resource, only thing that is missing is the deletion of routes. /cc @seancribbs

@Asmod4n
Copy link
Member Author

Asmod4n commented Mar 16, 2014

Will merge this tomorrow morning, @nLight might want to take a look first, will create a PR for https://github.com/nLight/jruby-http-kit afterwards.

@nLight
Copy link

nLight commented Mar 17, 2014

Looks good to me!

Asmod4n added a commit that referenced this pull request Mar 17, 2014
Expose Webmachine::Application to adapters
@Asmod4n Asmod4n merged commit 18c5929 into master Mar 17, 2014
@ghost ghost deleted the expose_application branch March 17, 2014 12:00
@ghost ghost mentioned this pull request Jun 14, 2014
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

Successfully merging this pull request may close these issues.

3 participants