diff options
author | azul <azul@riseup.net> | 2016-10-17 08:58:08 +0000 |
---|---|---|
committer | azul <azul@riseup.net> | 2016-10-17 08:58:08 +0000 |
commit | 5dae257996c480c3f7b5a220fcaf97812a560466 (patch) | |
tree | 2edc9f7b40d7b04e4cf739e6e92b200f93cd57e7 /lib/nickserver/adapters | |
parent | 6721f0732facd87404eecc288357fd1bd0de48cf (diff) | |
parent | 5967c4a568aff2c5e73e3ab933aa68d25387aeb1 (diff) |
Merge branch 'feature/log-requests-and-errors' into 'master'
Log requests and errors
proper logging
See merge request !6
Diffstat (limited to 'lib/nickserver/adapters')
-rw-r--r-- | lib/nickserver/adapters/http.rb | 21 |
1 files changed, 21 insertions, 0 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 |