Class: Curl::SafetyConfig

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

Constant Summary collapse

DEFAULT_PROTOCOLS =
[:http, :https].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSafetyConfig

Returns a new instance of SafetyConfig.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/curl.rb', line 17

def initialize
  @protocols = DEFAULT_PROTOCOLS
  @redirect_protocols = nil
  @max_body_bytes = nil
  @network_policy = nil
  @allowed_hosts = nil
  @allowed_proxy_hosts = nil
  @allowed_cidrs = nil
  @allow_proxies = false
  @allow_resolve = false
  @allow_connect_to = false
  @allow_doh = false
  @allow_unix_socket = false
end

Instance Attribute Details

#allow_connect_toObject

Returns the value of attribute allow_connect_to.



15
16
17
# File 'lib/curl.rb', line 15

def allow_connect_to
  @allow_connect_to
end

#allow_dohObject

Returns the value of attribute allow_doh.



15
16
17
# File 'lib/curl.rb', line 15

def allow_doh
  @allow_doh
end

#allow_proxiesObject

Returns the value of attribute allow_proxies.



15
16
17
# File 'lib/curl.rb', line 15

def allow_proxies
  @allow_proxies
end

#allow_resolveObject

Returns the value of attribute allow_resolve.



15
16
17
# File 'lib/curl.rb', line 15

def allow_resolve
  @allow_resolve
end

#allow_unix_socketObject

Returns the value of attribute allow_unix_socket.



15
16
17
# File 'lib/curl.rb', line 15

def allow_unix_socket
  @allow_unix_socket
end

#max_body_bytesObject

Returns the value of attribute max_body_bytes.



14
15
16
# File 'lib/curl.rb', line 14

def max_body_bytes
  @max_body_bytes
end

#network_policyObject

Returns the value of attribute network_policy.



14
15
16
# File 'lib/curl.rb', line 14

def network_policy
  @network_policy
end

Instance Method Details

#allowed_cidrsObject



56
57
58
# File 'lib/curl.rb', line 56

def allowed_cidrs
  @allowed_cidrs&.map(&:dup)
end

#allowed_cidrs=(cidrs) ⇒ Object



84
85
86
# File 'lib/curl.rb', line 84

def allowed_cidrs=(cidrs)
  @allowed_cidrs = normalize_allowed_cidrs(cidrs)
end

#allowed_hostsObject



48
49
50
# File 'lib/curl.rb', line 48

def allowed_hosts
  @allowed_hosts&.map(&:dup)
end

#allowed_hosts=(hosts) ⇒ Object



76
77
78
# File 'lib/curl.rb', line 76

def allowed_hosts=(hosts)
  @allowed_hosts = normalize_allowed_hosts(hosts)
end

#allowed_proxy_hostsObject



52
53
54
# File 'lib/curl.rb', line 52

def allowed_proxy_hosts
  @allowed_proxy_hosts&.map(&:dup)
end

#allowed_proxy_hosts=(hosts) ⇒ Object



80
81
82
# File 'lib/curl.rb', line 80

def allowed_proxy_hosts=(hosts)
  @allowed_proxy_hosts = normalize_allowed_hosts(hosts)
end

#protocolsObject



32
33
34
# File 'lib/curl.rb', line 32

def protocols
  @protocols.dup
end

#protocols=(protocols) ⇒ Object



36
37
38
# File 'lib/curl.rb', line 36

def protocols=(protocols)
  @protocols = normalize_protocols(protocols)
end

#redirect_protocolsObject



40
41
42
# File 'lib/curl.rb', line 40

def redirect_protocols
  @redirect_protocols&.dup
end

#redirect_protocols=(protocols) ⇒ Object



44
45
46
# File 'lib/curl.rb', line 44

def redirect_protocols=(protocols)
  @redirect_protocols = protocols.nil? ? nil : normalize_protocols(protocols)
end