summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/nickserver/adapters/http.rb21
-rw-r--r--lib/nickserver/source.rb4
-rw-r--r--test/support/http_stub_helper.rb2
3 files changed, 24 insertions, 3 deletions
diff --git a/lib/nickserver/adapters/http.rb b/lib/nickserver/adapters/http.rb
new file mode 100644
index 0000000..b0ba728
--- /dev/null
+++ b/lib/nickserver/adapters/http.rb
@@ -0,0 +1,21 @@
+require 'nickserver/adapters'
+require 'nickserver/config'
+require 'http'
+
+module Nickserver::Adapters
+ class Http
+
+ def get(url, options = {})
+ response = HTTP.get url,
+ params: options[:query],
+ ssl_context: ctx
+ return response.code, response.to_s
+ end
+
+ def ctx
+ OpenSSL::SSL::SSLContext.new.tap do |ctx|
+ ctx.ca_file = Nickserver::Config.hkp_ca_file
+ end
+ end
+ end
+end
diff --git a/lib/nickserver/source.rb b/lib/nickserver/source.rb
index edc57e9..ca2c34c 100644
--- a/lib/nickserver/source.rb
+++ b/lib/nickserver/source.rb
@@ -1,9 +1,9 @@
-require 'nickserver/adapters/celluloid_http'
+require 'nickserver/adapters/http'
module Nickserver
class Source
- def initialize(adapter = Nickserver::Adapters::CelluloidHttp.new)
+ def initialize(adapter = Nickserver::Adapters::Http.new)
@adapter = adapter
end
diff --git a/test/support/http_stub_helper.rb b/test/support/http_stub_helper.rb
index cb9b578..808fd01 100644
--- a/test/support/http_stub_helper.rb
+++ b/test/support/http_stub_helper.rb
@@ -1,7 +1,7 @@
module HttpStubHelper
def stubbing_http
- Nickserver::Adapters::CelluloidHttp.stub :new, adapter do
+ Nickserver::Adapters::Http.stub :new, adapter do
yield
end
adapter.verify