Class: Zenrows::Backends::NetHttp
- Defined in:
- lib/zenrows/backends/net_http.rb
Overview
Net::HTTP backend adapter (stdlib fallback)
Uses Ruby's built-in Net::HTTP when http.rb is not available. Provides basic proxy support with SSL verification disabled.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#backend_name ⇒ Symbol
Backend identifier.
-
#build_client(options = {}) ⇒ NetHttpClient, InstrumentedClient
Build a configured HTTP client wrapper.
Methods inherited from Base
#calculate_timeouts, #initialize, #ssl_context, #wrap_client
Constructor Details
This class inherits a constructor from Zenrows::Backends::Base
Instance Method Details
#backend_name ⇒ Symbol
Returns Backend identifier.
47 48 49 |
# File 'lib/zenrows/backends/net_http.rb', line 47 def backend_name :net_http end |
#build_client(options = {}) ⇒ NetHttpClient, InstrumentedClient
Build a configured HTTP client wrapper
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/zenrows/backends/net_http.rb', line 27 def build_client( = {}) opts = .dup headers = opts.delete(:headers) || {} opts[:custom_headers] = true if headers.any? proxy_config = proxy.build(opts) timeouts = calculate_timeouts(opts) client = NetHttpClient.new( proxy_config: proxy_config, headers: headers, timeouts: timeouts, ssl_context: ssl_context ) # Wrap with instrumentation if hooks registered wrap_client(client, opts) end |