Class: URLCanonicalize::HTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/url_canonicalize/http.rb

Overview

Persistent connection for possible repeated requests to the same host

Instance Method Summary collapse

Instance Method Details

#do_request(http_request) ⇒ Object



18
19
20
# File 'lib/url_canonicalize/http.rb', line 18

def do_request(http_request)
  http.request http_request
end

#fetchObject



5
6
7
# File 'lib/url_canonicalize/http.rb', line 5

def fetch
  loop { break last_known_good if handle_response }
end

#uriObject



9
10
11
# File 'lib/url_canonicalize/http.rb', line 9

def uri
  @uri ||= URLCanonicalize::URI.parse(url) # Malformed URLs will raise a URLCanonicalize exception
end

#url=(value) ⇒ Object



13
14
15
16
# File 'lib/url_canonicalize/http.rb', line 13

def url=(value)
  @url = value.to_s
  @uri = nil
end