module H2
Constants
- ACCEPT_ENCODING_KEY
- ALPN_OPENSSL_MIN_VERSION
- AUTHORITY_KEY
http/2 psuedo-headers
- CONTENT_ENCODING_KEY
- CONTENT_LENGTH_KEY
- CONTENT_TYPE_KEY
- DEFLATE_ENCODING
- EVENT_SOURCE_CONTENT_TYPE
- GZIP_ENCODING
- Logger
- METHOD_KEY
- PATH_KEY
- REQUEST_METHODS
- SCHEME_KEY
- STATUS_KEY
- USER_AGENT
- VERSION
Public Class Methods
alpn?()
click to toggle source
# File lib/h2/version.rb, line 8 def alpn? exceptionless_io? && OpenSSL::OPENSSL_VERSION_NUMBER >= ALPN_OPENSSL_MIN_VERSION end
exceptionless_io?()
click to toggle source
# File lib/h2/version.rb, line 12 def exceptionless_io? RUBY_VERSION >= '2.3' && !jruby? end
jruby?()
click to toggle source
# File lib/h2/version.rb, line 16 def jruby? return @jruby if defined? @jruby @jruby = RUBY_ENGINE == 'jruby' end
Private Class Methods
request(host: nil, port: nil, url: nil, method:, path: '/', headers: {})
click to toggle source
creates a H2::Client
and initiates a H2::Stream
by making a request with the given HTTP method
@param [String] host IP address or hostname @param [Integer] port TCP port @param [String,URI] url full URL to parse (optional: existing URI
instance) @param [Symbol] method HTTP request method @param [String] path request path @param [Hash] headers request headers @param [Hash] params request query string parameters @param [String] body request body @param [Hash,FalseClass] tls TLS options (optional: false
do not use TLS) @option tls [String] :cafile path to CA file
@yield [H2::Stream]
@return [H2::Stream]
# File lib/h2.rb, line 76 def request host: nil, port: nil, url: nil, method:, path: '/', headers: {}, params: {}, body: nil, tls: {}, &block raise ArgumentError if url.nil? && (host.nil? || port.nil?) if url url = URI.parse url unless URI === url host = url.host port = url.port path = url.request_uri end c = Client.new host: host, port: port, tls: tls c.__send__ method, path: path, headers: headers, params: params, body: body, &block end