Class: MtaSts::Fetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/mta_sts/fetcher.rb

Overview

HTTPS GET of mta-sts./.well-known/mta-sts.txt (RFC 8461 §3.3)

Defined Under Namespace

Classes: Body, CertificateError, Error, HttpError, Timeout

Constant Summary collapse

WELL_KNOWN_PATH =
"/.well-known/mta-sts.txt"
PORT =
443
OPEN_TIMEOUT =
10
READ_TIMEOUT =
10
TOTAL_TIMEOUT =

read_timeout renews per read; this one does not — stops a slow-drip body

30
MAX_BODY_BYTES =
64 * 1024
USER_AGENT =
"mta_sts/#{VERSION} (+https://github.com/mailpiece/mta_sts)"

Instance Method Summary collapse

Constructor Details

#initialize(open_timeout: OPEN_TIMEOUT, read_timeout: READ_TIMEOUT, total_timeout: TOTAL_TIMEOUT, max_body_bytes: MAX_BODY_BYTES) ⇒ Fetcher

Returns a new instance of Fetcher.



37
38
39
40
41
42
43
# File 'lib/mta_sts/fetcher.rb', line 37

def initialize(open_timeout: OPEN_TIMEOUT, read_timeout: READ_TIMEOUT,
               total_timeout: TOTAL_TIMEOUT, max_body_bytes: MAX_BODY_BYTES)
  @open_timeout = open_timeout
  @read_timeout = read_timeout
  @total_timeout = total_timeout
  @max_body_bytes = max_body_bytes
end

Instance Method Details

#fetch(host) ⇒ Object



45
46
47
# File 'lib/mta_sts/fetcher.rb', line 45

def fetch(host)
  get(normalize(host))
end