10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/skype_check/http_service.rb', line 10
def http_query(username)
begin
uri = URI(SkypeCheck.configuration.username_validator_endpoint)
param = { new_username: username }
uri.query = URI.encode_www_form(param)
http = Net::HTTP.new(uri.host, uri.port)
if uri.kind_of? URI::HTTPS
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
end
request = Net::HTTP::Get.new(uri.request_uri)
http.request(request)
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, SocketError => e
raise SkypeCheck::QueryError.new(e)
end
end
|