Public Class methods
new(*)
[show source]
# File lib/httpx/plugins/proxy.rb 201 def initialize(*) 202 super 203 return unless @options.proxy 204 205 # redefining the connection origin as the proxy's URI, 206 # as this will be used as the tcp peer ip. 207 proxy_uri = URI(@options.proxy.uri) 208 @origin.host = proxy_uri.host 209 @origin.port = proxy_uri.port 210 end
Public Instance methods
call()
[show source]
# File lib/httpx/plugins/proxy.rb 234 def call 235 super 236 237 return unless @options.proxy 238 239 case @state 240 when :connecting 241 consume 242 end 243 end
coalescable?(connection)
[show source]
# File lib/httpx/plugins/proxy.rb 212 def coalescable?(connection) 213 return super unless @options.proxy 214 215 if @io.protocol == "h2" && 216 @origin.scheme == "https" && 217 connection.origin.scheme == "https" && 218 @io.can_verify_peer? 219 # in proxied connections, .origin is the proxy ; Given names 220 # are stored in .origins, this is what is used. 221 origin = URI(connection.origins.first) 222 @io.verify_hostname(origin.host) 223 else 224 @origin == connection.origin 225 end 226 end
connecting?()
[show source]
# File lib/httpx/plugins/proxy.rb 228 def connecting? 229 return super unless @options.proxy 230 231 super || @state == :connecting || @state == :connected 232 end
reset()
[show source]
# File lib/httpx/plugins/proxy.rb 245 def reset 246 return super unless @options.proxy 247 248 @state = :open 249 250 super 251 emit(:close) 252 end