Sha256: 7d5267023e3c9a39daf7bf2a254f830699c336d687713e60dedd8c278d25acde

Contents?: true

Size: 778 Bytes

Versions: 7

Compression:

Stored size: 778 Bytes

Contents

class Http2::GetRequest
  def initialize(http2, args)
    @http2, @args, @debug, @nl = http2, http2.parse_args(args), http2.debug, http2.nl
  end

  def execute
    @http2.mutex.synchronize do
      puts "Http2: Writing headers: #{header_string}" if @debug
      @http2.connection.write(header_string)

      puts "Http2: Reading response." if @debug
      resp = @http2.read_response(@args)

      puts "Http2: Done with get request." if @debug
      return resp
    end
  end

private

  def method
    if @args[:method]
      @args[:method].to_s.upcase
    else
      "GET"
    end
  end

  def header_string
    header_str = "#{method} /#{@args[:url]} HTTP/1.1#{@nl}"
    header_str << @http2.header_str(@http2.default_headers(@args), @args)
    header_str << @nl
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
http2-0.0.31 include/get_request.rb
http2-0.0.30 include/get_request.rb
http2-0.0.29 include/get_request.rb
http2-0.0.28 include/get_request.rb
http2-0.0.27 include/get_request.rb
http2-0.0.26 include/get_request.rb
http2-0.0.25 include/get_request.rb