Module: Ritm::InterceptUtils

Included in:
HTTPForwarder, Proxy::ProxyServer
Defined in:
lib/ritm/interception/intercept_utils.rb

Overview

Interceptor callbacks calling logic shared by the HTTP Proxy Server and the SSL Reverse Proxy Server Passes request

Instance Method Summary collapse

Instance Method Details

#intercept_request(handler, request) ⇒ Object



7
8
9
10
# File 'lib/ritm/interception/intercept_utils.rb', line 7

def intercept_request(handler, request)
  return if handler.nil?
  handler.call(request)
end

#intercept_response(handler, request, response) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/ritm/interception/intercept_utils.rb', line 12

def intercept_response(handler, request, response)
  return if handler.nil?
  # TODO: Disable the automated decoding from config
  encoding = content_encoding(response)
  decoded(encoding, response) do |decoded_response|
    handler.call(request, decoded_response)
  end

  response.header.delete('content-length') if chunked?(response)
end