Class: Extensions::HTTP::Server
- Inherits:
-
Object
- Object
- Extensions::HTTP::Server
- Defined in:
- lib/stubby/extensions/http.rb
Direct Known Subclasses
Instance Method Summary collapse
- #expand_rule(trigger, instruction, proto = 'http') ⇒ Object
-
#initialize ⇒ Server
constructor
A new instance of Server.
- #run!(session, options) ⇒ Object
- #stop! ⇒ Object
Constructor Details
#initialize ⇒ Server
Returns a new instance of Server.
188 189 190 |
# File 'lib/stubby/extensions/http.rb', line 188 def initialize @log = Logger.new(STDOUT) end |
Instance Method Details
#expand_rule(trigger, instruction, proto = 'http') ⇒ Object
202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/stubby/extensions/http.rb', line 202 def (trigger, instruction, proto='http') u = URI.parse(instruction) (if u.scheme.nil? { trigger => "http-proxy://#{instruction}" } elsif u.scheme == "http" u.scheme = "http-proxy" { trigger => u.to_s } else { trigger => instruction } end).merge({ "#{trigger.gsub(proto + "://", "dns://")}/a" => "dns-a://#{STUBBY_MASTER}" }) end |
#run!(session, options) ⇒ Object
192 193 194 195 196 197 |
# File 'lib/stubby/extensions/http.rb', line 192 def run!(session, ) return if [:http] == false @session = session HTTPApp.run!(session) end |
#stop! ⇒ Object
217 218 219 |
# File 'lib/stubby/extensions/http.rb', line 217 def stop! HTTPApp.quit! end |