diff options
author | azul <azul@riseup.net> | 2016-06-15 14:22:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-15 14:22:08 +0200 |
commit | 3c6dc3d7b902b46b82a3d8cd38bd3fa896024beb (patch) | |
tree | 559b3998465248138b6f24a76b6b3e55e60f3986 /lib/nickserver/hkp/fetch_key_info.rb | |
parent | 5cad637a4a2a3de6b95ff1204fc29174e18b3124 (diff) | |
parent | 93258bd6fe6247e7af67f423243eba9808e920ee (diff) |
Merge pull request #3 from azul/refactor/transport-adapters
Refactor em specifics into http adapter
Diffstat (limited to 'lib/nickserver/hkp/fetch_key_info.rb')
-rw-r--r-- | lib/nickserver/hkp/fetch_key_info.rb | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/lib/nickserver/hkp/fetch_key_info.rb b/lib/nickserver/hkp/fetch_key_info.rb deleted file mode 100644 index 2448bb1..0000000 --- a/lib/nickserver/hkp/fetch_key_info.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'em-http' - -# -# used to fetch an array of KeyInfo objects that match the given uid. -# - -module Nickserver; module HKP - class FetchKeyInfo - include EM::Deferrable - - def search(uid) - # in practice, exact=on seems to have no effect - params = {op: 'vindex', search: uid, exact: 'on', options: 'mr', fingerprint: 'on'} - EventMachine::HttpRequest.new(Config.hkp_url).get(query: params).callback {|http| - parser = ParseKeyInfo.new http.response_header, http.response - keys = parser.keys(uid) - if keys.any? - self.succeed keys - else - self.fail parser.status(uid), parser.msg(uid) - end - }.errback {|http| - self.fail 500, http.error - } - self - end - - end - -end; end |