lib/httpx/io/ssl.rb in httpx-0.6.3 vs lib/httpx/io/ssl.rb in httpx-0.6.4

- old
+ new

@@ -5,25 +5,23 @@ module HTTPX class SSL < TCP TLS_OPTIONS = if OpenSSL::SSL::SSLContext.instance_methods.include?(:alpn_protocols) { alpn_protocols: %w[h2 http/1.1] } else + # :nocov: {} + # :nocov: end def initialize(_, _, options) @ctx = OpenSSL::SSL::SSLContext.new ctx_options = TLS_OPTIONS.merge(options.ssl) @ctx.set_params(ctx_options) unless ctx_options.empty? super @state = :negotiated if @keep_open end - def scheme - "https" - end - def protocol @io.alpn_protocol || super rescue StandardError super end @@ -66,10 +64,11 @@ transition(:negotiated) rescue ::IO::WaitReadable, ::IO::WaitWritable end + # :nocov: if RUBY_VERSION < "2.3" def read(*) super rescue ::IO::WaitWritable 0 @@ -91,14 +90,17 @@ rescue EOFError nil end end end + # :nocov: + # :nocov: def inspect id = @io.closed? ? "closed" : @io.to_io.fileno "#<SSL(fd: #{id}): #{@ip}:#{@port} state: #{@state}>" end + # :nocov: private def transition(nextstate) case nextstate