Class: Protocol::HTTP1::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/rangescan/monkey_patch.rb

Instance Method Summary collapse

Instance Method Details

#write_request(authority, method, path, version, headers) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rangescan/monkey_patch.rb', line 8

def write_request(authority, method, path, version, headers)
  host = authority
  if headers.include?("host")
    host = headers["host"]
    headers.delete "host"
  end

  @stream.write("#{method} #{path} #{version}\r\n")
  @stream.write("host: #{host}\r\n")

  write_headers(headers)
end