Class: HTTPX::ProxyChannel

Inherits:
Channel
  • Object
show all
Defined in:
lib/httpx/plugins/proxy.rb

Constant Summary

Constants inherited from Channel

Channel::BUFFER_SIZE

Constants included from Loggable

Loggable::COLORS

Constants included from Registry

Registry::Error

Instance Attribute Summary

Attributes inherited from Channel

#pending, #state, #uri

Instance Method Summary collapse

Methods inherited from Channel

#addresses=, by, #close, #coalescable?, #handle_timeout_error, #interests, #match_altsvcs?, #merge, #mergeable?, #purge_pending, #unmerge, #upgrade_parser

Methods included from Callbacks

#emit, #on, #once

Methods included from Loggable

#log

Methods included from Registry

extended, included

Constructor Details

#initialize(type, uri, parameters, options, &blk) ⇒ ProxyChannel

Returns a new instance of ProxyChannel.



109
110
111
112
# File 'lib/httpx/plugins/proxy.rb', line 109

def initialize(type, uri, parameters, options, &blk)
  super(type, uri, options, &blk)
  @parameters = parameters
end

Instance Method Details

#callObject



136
137
138
139
140
141
142
# File 'lib/httpx/plugins/proxy.rb', line 136

def call
  super
  case @state
  when :connecting
    consume
  end
end

#connecting?Boolean

Returns:

  • (Boolean)


122
123
124
# File 'lib/httpx/plugins/proxy.rb', line 122

def connecting?
  super || @state == :connecting || @state == :connected
end

#match?Boolean

Returns:

  • (Boolean)


114
115
116
# File 'lib/httpx/plugins/proxy.rb', line 114

def match?(*)
  true
end

#resetObject



144
145
146
147
148
149
# File 'lib/httpx/plugins/proxy.rb', line 144

def reset
  @state = :open
  transition(:closing)
  transition(:closed)
  emit(:close)
end

#send(request, **args) ⇒ Object



118
119
120
# File 'lib/httpx/plugins/proxy.rb', line 118

def send(request, **args)
  @pending << [request, args]
end

#to_ioObject



126
127
128
129
130
131
132
133
134
# File 'lib/httpx/plugins/proxy.rb', line 126

def to_io
  case @state
  when :idle
    transition(:connecting)
  when :connected
    transition(:open)
  end
  @io.to_io
end