Age | Commit message (Collapse) | Author |
|
|
|
So far we would error out if no host was specified in the config or
the request. It's true that we can't do local lookup if we don't
know our own domain. However we can still use HKP.
In the future we will query leaps own API for other providers. If the
host was not set in the initial request we might even proxy a request to
ourselves. Providing the Host header will prevent an infinite loop in
that case.
|
|
refactor: restructure the way we handle requests to make it more consistent.
Requests are handled at a lot of different ways in different styles right now.
Let's make this more consistent and flexible to add email lookup at other leap providers.
See merge request !2
|
|
InvalidEmailHandler - handle emails with an invalid format
LocalEmailHandler - handle emails on the local domain
EmailHandler - handle all other emails by using hkp
This is a preparation to add leap provider email lookup and remove
hkp eventually. But for now we keep the behaviour the same and only
refactor.
|
|
Lookup and InvalidSource were experiments for a design for the
dispatching. Our new dispatcher seems better.
|
|
Instead of testing the preconditions for each handler in the dispatcher
the dispatcher hands a request to one handler after the other until one of
them responds.
This is similar to the Chain of Responsibility patter but we iterate over the
'handler_chain' array instead of a linked list.
To change the order of handlers or add other handlers change the array in the
handler_chain function.
|
|
Now we have a Dispatcher and two ResponseHandlers that have the same interface.
Moving towards a Chain of Responsibility pattern.
|
|
This way we can separate the EmailHandler and the FingerprintHandler as well.
|
|
The original idea was that we would have all the celluloid related things
injected in reel_server. However it seems unlikely that we will use a
different http system anytime soon.
Removing some layers of dependency injection to reduce complexity. We
can easily bring this back if we want.
|
|
|
|
We have a specific way of encoding the thing we are looking for in the
request. I added a small helper class to access the fingerprint and
email.
This also cleans up the RequestHandler code to some extend.
|
|
Run tests on gitlab
See merge request !1
|
|
|
|
These warnings were showing on gitlab ci.
$ bundle exec rake test
/usr/local/bin/ruby -w -Ilib:test -I/builds/leap/nickserver/vendor/ruby/2.1.0/gems/rake-11.2.2/lib /builds/leap/nickserver/vendor/ruby/2.1.0/gems/rake-11.2.2/lib/rake/rake_test_loader.rb test/**/*_test.rb
/usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.12.5/lib/bundler/rubygems_integration.rb:468: warning: method redefined; discarding old find_spec_for_exe
/usr/local/lib/ruby/site_ruby/2.1.0/rubygems.rb:261: warning: previous definition of find_spec_for_exe was here
I, [2016-08-26T15:34:46.162843 #325] INFO -- : Celluloid 0.17.3 is running in BACKPORTED mode. [ http://git.io/vJf3J ]
/builds/leap/nickserver/test/unit/request_handler_test.rb:28: warning: mismatched indentations at 'end' with 'def' at 21
/builds/leap/nickserver/vendor/ruby/2.1.0/gems/celluloid-io-0.17.3/lib/celluloid/io/ssl_socket.rb:22: warning: instance variable @npn_protocols not initialized
/builds/leap/nickserver/vendor/ruby/2.1.0/gems/celluloid-io-0.17.3/lib/celluloid/io/ssl_socket.rb:22: warning: instance variable @npn_select_cb not initialized
Run options: --seed 61653
# Running:
.................../builds/leap/nickserver/vendor/ruby/2.1.0/gems/celluloid-io-0.17.3/lib/celluloid/io/ssl_socket.rb:22: warning: instance variable @npn_protocols not initialized
/builds/leap/nickserver/vendor/ruby/2.1.0/gems/celluloid-io-0.17.3/lib/celluloid/io/ssl_socket.rb:22: warning: instance variable @npn_select_cb not initialized
.../builds/leap/nickserver/vendor/ruby/2.1.0/gems/celluloid-io-0.17.3/lib/celluloid/io/ssl_socket.rb:22: warning: instance variable @npn_protocols not initialized
/builds/leap/nickserver/vendor/ruby/2.1.0/gems/celluloid-io-0.17.3/lib/celluloid/io/ssl_socket.rb:22: warning: instance variable @npn_select_cb not initialized
.................
Finished in 2.029982s, 19.2120 runs/s, 10.8375 assertions/s.
|
|
Mostly copied from the webapp just to see how it goes.
I did not carry over version restrictions from the .travis.yml file.
I hope these limitations have vanished now and i can also remove them
on travis.
|
|
By fingerprint
|
|
- add fingerprint unit tests
- add integration test
- implement by_fingerprint
|
|
|
|
in order to get key by fp as well
|
|
Use Celluloid, Reel and Celluloid I/O based http requests
|
|
I have to admit I don't completely understand what is going on here.
https://github.com/celluloid/celluloid/wiki/Frequently-Asked-Questions says
you can either use sleep after initiating the actors or call run on them.
But this might not be true for reel. At least run did not work and now
new; sleep seems to work fine.
|
|
|
|
This became possible because we now use celluloid.
Celluloid handles asynchronity without the need for callbacks
or blocks.
|
|
|
|
|
|
|
|
|
|
some tests are still broken. But at least they are running now.
|
|
|
|
Main problem right now is the outdated version of webmock.
|
|
This way the interface mimics the one of Celluloid Reels request.
request.respond status, content
|
|
refactor: separate em specifics from generic server
|
|
The request handler takes a responder (the EmServer) and an adapter as initialization arguments.
It will then respond to requests by querying the sources using the adapter and calling send_response on the responder.
|
|
|
|
|
|
Refactor em specifics into http adapter
|
|
|
|
wraps the hkp protocol
|
|
|
|
|
|
The source was really just an empty shell now that we pushed the
em specific stuff further down.
|
|
|
|
|
|
|
|
well kind of since we were yielding this is more inlining the
block and renaming the method
|
|
That's what it actually is
|
|
|
|
Rubocop
|
|
This moves all the em_http related stuff into a single adapter.
We're also not using callback and errback inside fetch_key or
server for couch requests anymore.
Changing the interface for hkp to do the same will follow.
|
|
This will randomize test order and parallelize them iirc
|