Class: MiddleSquid::Adapters::Squid
- Inherits:
-
MiddleSquid::Adapter
- Object
- MiddleSquid::Adapter
- MiddleSquid::Adapters::Squid
- Defined in:
- lib/middle_squid/adapters/squid.rb
Overview
Adapter for the Squid HTTP Proxy.
Options:
- concurrency
-
Whether to expect a channel ID from Squid.
Enable this option if the concurrency option is set to > 0 in Squid’s / url_rewrite_children directive.
Extra data is configured in Squid with the / url_rewrite_extras directive.
Instance Attribute Summary
Attributes inherited from MiddleSquid::Adapter
Instance Method Summary collapse
Methods inherited from MiddleSquid::Adapter
Constructor Details
This class inherits a constructor from MiddleSquid::Adapter
Instance Method Details
#input(line) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/middle_squid/adapters/squid.rb', line 22 def input(line) parts = line.split @chan_id = @options[:concurrency] ? parts.shift : nil url, *extras = parts extras.map! {|str| URI.unescape str } handle url, extras end |
#output(action, options) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/middle_squid/adapters/squid.rb', line 33 def output(action, ) case action when :accept reply 'ERR' when :redirect reply 'OK', status: [:status], url: [:url] when :replace reply 'OK', :'rewrite-url' => [:url] else raise Error, "unsupported action: #{action}" end end |