Class: Stubby::Extensions::HTTP::Server
- Inherits:
-
Object
- Object
- Stubby::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.
- #restore! ⇒ Object
- #run!(session, options) ⇒ Object
- #stop! ⇒ Object
Constructor Details
#initialize ⇒ Server
Returns a new instance of Server.
189 190 191 |
# File 'lib/stubby/extensions/http.rb', line 189 def initialize @log = Logger.new(STDOUT) end |
Instance Method Details
#expand_rule(trigger, instruction, proto = 'http') ⇒ Object
203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/stubby/extensions/http.rb', line 203 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 |
#restore! ⇒ Object
222 223 224 |
# File 'lib/stubby/extensions/http.rb', line 222 def restore! # nil end |
#run!(session, options) ⇒ Object
193 194 195 196 197 198 |
# File 'lib/stubby/extensions/http.rb', line 193 def run!(session, ) return if [:http] == false @session = session HTTPApp.run!(session) end |
#stop! ⇒ Object
218 219 220 |
# File 'lib/stubby/extensions/http.rb', line 218 def stop! HTTPApp.quit! end |