Module: HTTPX::Plugins::Proxy::ConnectionMethods
- Defined in:
- lib/httpx/plugins/proxy.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#coalescable? ⇒ Boolean
should not coalesce connections here, as the IP is the IP of the proxy.
- #connecting? ⇒ Boolean
- #initialize ⇒ Object
- #match?(uri, options) ⇒ Boolean
- #reset ⇒ Object
- #send(request) ⇒ Object
Instance Method Details
#call ⇒ Object
182 183 184 185 186 187 188 189 190 191 |
# File 'lib/httpx/plugins/proxy.rb', line 182 def call super return unless @options.proxy case @state when :connecting consume end end |
#coalescable? ⇒ Boolean
should not coalesce connections here, as the IP is the IP of the proxy
163 164 165 166 167 |
# File 'lib/httpx/plugins/proxy.rb', line 163 def coalescable?(*) return super unless @options.proxy false end |
#connecting? ⇒ Boolean
176 177 178 179 180 |
# File 'lib/httpx/plugins/proxy.rb', line 176 def connecting? return super unless @options.proxy super || @state == :connecting || @state == :connected end |
#initialize ⇒ Object
147 148 149 150 151 152 153 154 |
# File 'lib/httpx/plugins/proxy.rb', line 147 def initialize(*) super return unless @options.proxy # redefining the connection origin as the proxy's URI, # as this will be used as the tcp peer ip. @origin = URI(@options.proxy.uri.origin) end |
#match?(uri, options) ⇒ Boolean
156 157 158 159 160 |
# File 'lib/httpx/plugins/proxy.rb', line 156 def match?(uri, ) return super unless @options.proxy super && @options.proxy == .proxy end |
#reset ⇒ Object
193 194 195 196 197 198 199 200 |
# File 'lib/httpx/plugins/proxy.rb', line 193 def reset return super unless @options.proxy @state = :open transition(:closing) transition(:closed) emit(:close) end |
#send(request) ⇒ Object
169 170 171 172 173 174 |
# File 'lib/httpx/plugins/proxy.rb', line 169 def send(request) return super unless @options.proxy return super unless connecting? @pending << request end |