Module: RubyProxyHeaders
- Defined in:
- lib/ruby_proxy_headers.rb,
lib/ruby_proxy_headers/excon.rb,
lib/ruby_proxy_headers/faraday.rb,
lib/ruby_proxy_headers/faraday.rb,
lib/ruby_proxy_headers/version.rb,
lib/ruby_proxy_headers/http_gem.rb,
lib/ruby_proxy_headers/httparty.rb,
lib/ruby_proxy_headers/net_http.rb,
lib/ruby_proxy_headers/typhoeus.rb,
lib/ruby_proxy_headers/connection.rb,
lib/ruby_proxy_headers/rest_client.rb
Defined Under Namespace
Modules: ExconIntegration, FaradayAdapter, FaradayIntegration, HTTPGem, NetHTTP, RestClient, Typhoeus Classes: Connection, ProxyHeadersConnectionAdapter
Constant Summary collapse
- INVALID_HEADER_NAME_RE =
/[\r\n\0]/- INVALID_HEADER_VALUE_RE =
/[\r\n\0]/- VERSION =
'0.2.2'
Class Method Summary collapse
-
.proxy_connect_response_headers ⇒ Object
CONNECT response headers from the last Net::HTTP-based proxied HTTPS request on this thread.
-
.validate_header!(name, value) ⇒ Object
Raises ArgumentError if
nameorvaluecontain CR, LF, or NUL bytes that would allow HTTP header injection in a raw CONNECT request.
Class Method Details
.proxy_connect_response_headers ⇒ Object
CONNECT response headers from the last Net::HTTP-based proxied HTTPS request on this thread.
11 12 13 |
# File 'lib/ruby_proxy_headers.rb', line 11 def self.proxy_connect_response_headers Thread.current[:ruby_proxy_headers_connect_headers] end |
.validate_header!(name, value) ⇒ Object
Raises ArgumentError if name or value contain CR, LF, or NUL bytes
that would allow HTTP header injection in a raw CONNECT request.
17 18 19 20 21 22 23 24 |
# File 'lib/ruby_proxy_headers.rb', line 17 def self.validate_header!(name, value) if INVALID_HEADER_NAME_RE.match?(name.to_s) raise ArgumentError, "proxy CONNECT header name contains invalid characters (CR, LF, or NUL): #{name.inspect}" end if INVALID_HEADER_VALUE_RE.match?(value.to_s) raise ArgumentError, "proxy CONNECT header value contains invalid characters (CR, LF, or NUL): #{value.inspect}" end end |