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
192 193 194 195 196 197 198 199 200 201 |
# File 'lib/httpx/plugins/proxy.rb', line 192 def call super return unless .proxy case @state when :connecting consume end end |
#coalescable? ⇒ Boolean
should not coalesce connections here, as the IP is the IP of the proxy
173 174 175 176 177 |
# File 'lib/httpx/plugins/proxy.rb', line 173 def coalescable?(*) return super unless .proxy false end |
#connecting? ⇒ Boolean
186 187 188 189 190 |
# File 'lib/httpx/plugins/proxy.rb', line 186 def connecting? return super unless .proxy super || @state == :connecting || @state == :connected end |
#initialize ⇒ Object
157 158 159 160 161 162 163 164 |
# File 'lib/httpx/plugins/proxy.rb', line 157 def initialize(*) super return unless .proxy # redefining the connection origin as the proxy's URI, # as this will be used as the tcp peer ip. @origin = URI(.proxy.uri.origin) end |
#match?(uri, options) ⇒ Boolean
166 167 168 169 170 |
# File 'lib/httpx/plugins/proxy.rb', line 166 def match?(uri, ) return super unless .proxy super && .proxy == .proxy end |
#reset ⇒ Object
203 204 205 206 207 208 209 210 |
# File 'lib/httpx/plugins/proxy.rb', line 203 def reset return super unless .proxy @state = :open transition(:closing) transition(:closed) emit(:close) end |
#send(request) ⇒ Object
179 180 181 182 183 184 |
# File 'lib/httpx/plugins/proxy.rb', line 179 def send(request) return super unless .proxy return super unless connecting? @pending << request end |