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

#state, #uri

Instance Method Summary collapse

Methods inherited from Channel

#addresses=, by, #close, #coalescable?, #interests, #merge, #mergeable?, #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.



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

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

Instance Method Details

#callObject



131
132
133
134
135
136
137
# File 'lib/httpx/plugins/proxy.rb', line 131

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

#match?Boolean

Returns:

  • (Boolean)


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

def match?(*)
  true
end

#resetObject



139
140
141
142
143
144
# File 'lib/httpx/plugins/proxy.rb', line 139

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

#send(request, **args) ⇒ Object



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

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

#to_ioObject



121
122
123
124
125
126
127
128
129
# File 'lib/httpx/plugins/proxy.rb', line 121

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