class Stubby::Extensions::HTTP::Server
Public Class Methods
new()
click to toggle source
# File lib/stubby/extensions/http.rb, line 189 def initialize @log = Logger.new(STDOUT) end
Public Instance Methods
expand_rule(trigger, instruction, proto='http')
click to toggle source
blah.com => localhost:3000
>¶ ↑
blah.com => http-proxy://localhost:3000
# File lib/stubby/extensions/http.rb, line 203 def expand_rule(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
restore!()
click to toggle source
# File lib/stubby/extensions/http.rb, line 222 def restore! # nil end
run!(session, options)
click to toggle source
# File lib/stubby/extensions/http.rb, line 193 def run!(session, options) return if options[:http] == false @session = session HTTPApp.run!(session) end
stop!()
click to toggle source
# File lib/stubby/extensions/http.rb, line 218 def stop! HTTPApp.quit! end