Class: Rack::StreamingProxy::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/streaming_proxy/request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(destination_uri, current_request) ⇒ Request

Returns a new instance of Request.



8
9
10
11
12
# File 'lib/rack/streaming_proxy/request.rb', line 8

def initialize(destination_uri, current_request)
  @destination_uri = URI.parse(destination_uri)
  @rack_request    = current_request
  @http_request    = translate_request(current_request, @destination_uri)
end

Instance Attribute Details

#http_requestObject (readonly)

Returns the value of attribute http_request.



6
7
8
# File 'lib/rack/streaming_proxy/request.rb', line 6

def http_request
  @http_request
end

#rack_requestObject (readonly)

Returns the value of attribute rack_request.



6
7
8
# File 'lib/rack/streaming_proxy/request.rb', line 6

def rack_request
  @rack_request
end

Instance Method Details

#hostObject



14
15
16
# File 'lib/rack/streaming_proxy/request.rb', line 14

def host
  @destination_uri.host
end

#portObject



18
19
20
# File 'lib/rack/streaming_proxy/request.rb', line 18

def port
  @destination_uri.port
end

#uriObject



30
31
32
# File 'lib/rack/streaming_proxy/request.rb', line 30

def uri
  @destination_uri.to_s
end

#use_basic_auth?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/rack/streaming_proxy/request.rb', line 26

def use_basic_auth?
  @destination_uri.user && @destination_uri.password
end

#use_ssl?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/rack/streaming_proxy/request.rb', line 22

def use_ssl?
  @destination_uri.is_a? URI::HTTPS
end