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
- #to_io ⇒ Object
Instance Method Details
#call ⇒ Object
176 177 178 179 180 181 182 183 184 |
# File 'lib/httpx/plugins/proxy.rb', line 176 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
145 146 147 148 149 |
# File 'lib/httpx/plugins/proxy.rb', line 145 def coalescable?(*) return super unless @options.proxy false end |
#connecting? ⇒ Boolean
158 159 160 161 162 |
# File 'lib/httpx/plugins/proxy.rb', line 158 def connecting? return super unless @options.proxy super || @state == :connecting || @state == :connected end |
#initialize ⇒ Object
129 130 131 132 133 134 135 136 |
# File 'lib/httpx/plugins/proxy.rb', line 129 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
138 139 140 141 142 |
# File 'lib/httpx/plugins/proxy.rb', line 138 def match?(uri, ) return super unless @options.proxy super && @options.proxy == .proxy end |
#reset ⇒ Object
186 187 188 189 190 191 192 193 |
# File 'lib/httpx/plugins/proxy.rb', line 186 def reset return super unless @options.proxy @state = :open transition(:closing) transition(:closed) emit(:close) end |
#send(request) ⇒ Object
151 152 153 154 155 156 |
# File 'lib/httpx/plugins/proxy.rb', line 151 def send(request) return super unless @options.proxy return super unless connecting? @pending << request end |
#to_io ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/httpx/plugins/proxy.rb', line 164 def to_io return super unless @options.proxy case @state when :idle transition(:connecting) when :connected transition(:open) end @io.to_io end |