summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2016-09-24 12:00:56 +0200
committerAzul <azul@riseup.net>2016-09-24 12:02:12 +0200
commit5a93f2d29c96e649440101f2d1ca28247631b59e (patch)
tree5e7043e08d81ffb4746461c5c3f7f9d603a0615b /lib
parentc32bce3399eb1bca8987a49ecc89700458803250 (diff)
use plain http.rb rather than celluloid i/o
Turns out http.rb does not support celluloid i/o andymore and we were not making use of it anyway. Here's what https://github.com/httprb/http/wiki/Thread-Safety says: (NOTE: this gem previously supported Celluloid::IO, but that support was removed to add the current timeout backend. It may be added back in a future version) So now we have a plain http.rb adapter and use that as the default. This prevents actors from crashing in the adapter (as we don't have any).
Diffstat (limited to 'lib')
-rw-r--r--lib/nickserver/adapters/http.rb21
-rw-r--r--lib/nickserver/source.rb4
2 files changed, 23 insertions, 2 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