summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/nickserver/couch/fetch_key.rb2
-rw-r--r--lib/nickserver/daemon.rb4
-rw-r--r--lib/nickserver/hkp/fetch_key.rb4
-rw-r--r--lib/nickserver/hkp/fetch_key_info.rb4
-rw-r--r--lib/nickserver/server.rb12
5 files changed, 13 insertions, 13 deletions
diff --git a/lib/nickserver/couch/fetch_key.rb b/lib/nickserver/couch/fetch_key.rb
index c671515..3fe2a63 100644
--- a/lib/nickserver/couch/fetch_key.rb
+++ b/lib/nickserver/couch/fetch_key.rb
@@ -24,7 +24,7 @@ module Nickserver; module Couch
#
def couch_request(uid)
query = {"reduce" => "false", "key" => "\"#{uid}\""}
- request = EventMachine::HttpRequest.new(FetchKey.couch_url).get(:timeout => @timeout, :query => query)
+ request = EventMachine::HttpRequest.new(FetchKey.couch_url).get(timeout: @timeout, query: query)
request.callback {|http|
if http.response_header.status != 200
self.fail http.response_header.status, 'Unknown Error'
diff --git a/lib/nickserver/daemon.rb b/lib/nickserver/daemon.rb
index 36fe581..7d0f02a 100644
--- a/lib/nickserver/daemon.rb
+++ b/lib/nickserver/daemon.rb
@@ -105,7 +105,7 @@ module Nickserver
def kill_pid
file = Config.pid_file
- if File.exists?(file)
+ if File.exist?(file)
pid = pid_from_file(file)
if pid
Process.kill('TERM', pid)
@@ -164,7 +164,7 @@ module Nickserver
#
def redirect_output
if log_path = Config.log_file
- FileUtils.mkdir_p File.dirname(log_path), :mode => 0755
+ FileUtils.mkdir_p File.dirname(log_path), mode: 0755
FileUtils.touch log_path
File.chmod(0600, log_path)
if Config.user && Process::Sys.getuid == 0
diff --git a/lib/nickserver/hkp/fetch_key.rb b/lib/nickserver/hkp/fetch_key.rb
index c24b2c7..44621d3 100644
--- a/lib/nickserver/hkp/fetch_key.rb
+++ b/lib/nickserver/hkp/fetch_key.rb
@@ -26,8 +26,8 @@ module Nickserver; module HKP
# fetches ascii armored OpenPGP public key from the keyserver
#
def get_key_by_fingerprint(key_id)
- params = {:op => 'get', :search => "0x" + key_id, :exact => 'on', :options => 'mr'}
- http = EventMachine::HttpRequest.new(Config.hkp_url).get(:query => params)
+ params = {op: 'get', search: "0x" + key_id, exact: 'on', options: 'mr'}
+ http = EventMachine::HttpRequest.new(Config.hkp_url).get(query: params)
http.callback {
if http.response_header.status != 200
self.fail http.response_header.status, "HKP Request failed"
diff --git a/lib/nickserver/hkp/fetch_key_info.rb b/lib/nickserver/hkp/fetch_key_info.rb
index bc12488..2448bb1 100644
--- a/lib/nickserver/hkp/fetch_key_info.rb
+++ b/lib/nickserver/hkp/fetch_key_info.rb
@@ -10,8 +10,8 @@ module Nickserver; module HKP
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|
+ 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?
diff --git a/lib/nickserver/server.rb b/lib/nickserver/server.rb
index 9487b43..32afdae 100644
--- a/lib/nickserver/server.rb
+++ b/lib/nickserver/server.rb
@@ -21,7 +21,7 @@ module Nickserver
#
def self.start(opts={})
Nickserver::Config.load
- options = {:host => '127.0.0.1', :port => Nickserver::Config.port.to_i}.merge(opts)
+ options = {host: '127.0.0.1', port: Nickserver::Config.port.to_i}.merge(opts)
unless defined?(TESTING)
puts "Starting nickserver #{options[:host]}:#{options[:port]}"
end
@@ -51,15 +51,15 @@ module Nickserver
private
def send_error(msg = "not supported")
- send_response(:status => 500, :content => "500 #{msg}\n")
+ send_response(status: 500, content: "500 #{msg}\n")
end
def send_not_found(msg = "Not Found")
- send_response(:status => 404, :content => "404 #{msg}\n")
+ send_response(status: 404, content: "404 #{msg}\n")
end
def send_response(opts = {})
- options = {:status => 200, :content_type => 'text/plain', :content => ''}.merge(opts)
+ options = {status: 200, content_type: 'text/plain', content: ''}.merge(opts)
response = EM::DelegatedHttpResponse.new(self)
response.status = options[:status]
response.content_type options[:content_type]
@@ -69,7 +69,7 @@ module Nickserver
def send_key(uid)
get_key_from_uid(uid) do |key|
- send_response :content => format_response(:address => uid, :openpgp => key)
+ send_response content: format_response(address: uid, openpgp: key)
end
end
@@ -98,7 +98,7 @@ module Nickserver
if status == 404
send_not_found
else
- send_response(:status => status, :content => msg)
+ send_response(status: status, content: msg)
end
}
end