Class: Curl::SafetyConfig
- Inherits:
-
Object
- Object
- Curl::SafetyConfig
- Defined in:
- lib/curl.rb
Constant Summary collapse
- DEFAULT_PROTOCOLS =
[:http, :https].freeze
Instance Attribute Summary collapse
-
#allow_connect_to ⇒ Object
Returns the value of attribute allow_connect_to.
-
#allow_doh ⇒ Object
Returns the value of attribute allow_doh.
-
#allow_proxies ⇒ Object
Returns the value of attribute allow_proxies.
-
#allow_resolve ⇒ Object
Returns the value of attribute allow_resolve.
-
#allow_unix_socket ⇒ Object
Returns the value of attribute allow_unix_socket.
-
#max_body_bytes ⇒ Object
Returns the value of attribute max_body_bytes.
-
#network_policy ⇒ Object
Returns the value of attribute network_policy.
Instance Method Summary collapse
- #allowed_cidrs ⇒ Object
- #allowed_cidrs=(cidrs) ⇒ Object
- #allowed_hosts ⇒ Object
- #allowed_hosts=(hosts) ⇒ Object
- #allowed_proxy_hosts ⇒ Object
- #allowed_proxy_hosts=(hosts) ⇒ Object
-
#initialize ⇒ SafetyConfig
constructor
A new instance of SafetyConfig.
- #protocols ⇒ Object
- #protocols=(protocols) ⇒ Object
- #redirect_protocols ⇒ Object
- #redirect_protocols=(protocols) ⇒ Object
Constructor Details
#initialize ⇒ SafetyConfig
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_to ⇒ Object
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_doh ⇒ Object
Returns the value of attribute allow_doh.
15 16 17 |
# File 'lib/curl.rb', line 15 def allow_doh @allow_doh end |
#allow_proxies ⇒ Object
Returns the value of attribute allow_proxies.
15 16 17 |
# File 'lib/curl.rb', line 15 def allow_proxies @allow_proxies end |
#allow_resolve ⇒ Object
Returns the value of attribute allow_resolve.
15 16 17 |
# File 'lib/curl.rb', line 15 def allow_resolve @allow_resolve end |
#allow_unix_socket ⇒ Object
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_bytes ⇒ Object
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_policy ⇒ Object
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_cidrs ⇒ Object
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_hosts ⇒ Object
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_hosts ⇒ Object
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 |
#protocols ⇒ Object
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_protocols ⇒ Object
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 |