On Sep 25, 2011, at 11:21 PM, Davanum Srinivas wrote: Nice catch Davanum! ACK.
Btw. I think this method should go to a separate Rack middleware file, like (server/lib/sinatra/sinatra_check_host.rb) or to server.rb directly. The sinatra_verbose module is designed to do just 'logging' and debugging stuff. -- Michal > --- > server/lib/sinatra/sinatra_verbose.rb | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/server/lib/sinatra/sinatra_verbose.rb > b/server/lib/sinatra/sinatra_verbose.rb > index c016ec0..043463a 100644 > --- a/server/lib/sinatra/sinatra_verbose.rb > +++ b/server/lib/sinatra/sinatra_verbose.rb > @@ -39,6 +39,13 @@ module Sinatra > > end > > + def check_host_header > + disable :logging > + before { > + halt 400, "Unable to find HTTP Host header" if @env['HTTP_HOST'] == > nil > + } > + end > + > def enable_verbose_logging! > disable :logging > before { > @@ -62,6 +69,7 @@ module Sinatra > def self.registered(app) > app.helpers VerboseLogger::Helpers > app.enable_verbose_logging! if ENV['API_VERBOSE'] > + app.check_host_header > end > end > end > -- > 1.7.1 > ------------------------------------------------------ Michal Fojtik, mfoj...@redhat.com Deltacloud API: http://deltacloud.org