diff --git a/.gitignore b/.gitignore index ffd3034..b388b57 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,6 @@ docs/* pkg/* Manifest *.gemspec +tmp/* diff --git a/lib/apache/mpm_prefork.rb b/lib/apache/mpm_prefork.rb index 2003a56..ddbf5fd 100644 --- a/lib/apache/mpm_prefork.rb +++ b/lib/apache/mpm_prefork.rb @@ -47,8 +47,8 @@ module Apache when String @config << "#{which} #{opts * " "}" when Array - which.each do |w| - @config << "#{w} #{opts.shift}" + which.each do |tag| + @config << "#{tag} #{opts.shift}" end end end diff --git a/lib/apache/rewrites.rb b/lib/apache/rewrites.rb index b7649c9..d0796ec 100644 --- a/lib/apache/rewrites.rb +++ b/lib/apache/rewrites.rb @@ -170,7 +170,7 @@ module Apache module RegularExpressionMatcher # Test this rewritable thing def test(from, opts = {}) - from = from.gsub(@from, @to.gsub(/\$([0-9])/) { |m| '\\' + $1 }) + from = from.gsub(@from, @to.gsub(/\$([0-9])/) { |match| '\\' + $1 }) replace_placeholders(from, opts) end @@ -179,14 +179,14 @@ module Apache end # Replace the placeholders in this rewritable thing - def replace_placeholders(s, opts) + def replace_placeholders(string, opts) opts.each do |opt, value| case value when String - s = s.gsub('%{' + opt.to_s.upcase + '}', value) + string = string.gsub('%{' + opt.to_s.upcase + '}', value) end end - s.gsub(%r{%\{[^\}]+\}}, '') + string.gsub(%r{%\{[^\}]+\}}, '') end end @@ -387,12 +387,9 @@ module Apache end result = false - case to[0..0] - when '-' - case to - when '-f' - result = opts[:files].include? source if opts[:files] - end + case to + when '-f' + result = opts[:files].include?(source) if opts[:files] else result = source[Regexp.new(to)] end diff --git a/lib/apache/ssl.rb b/lib/apache/ssl.rb index af2cd8c..650196e 100644 --- a/lib/apache/ssl.rb +++ b/lib/apache/ssl.rb @@ -3,12 +3,13 @@ module Apache def enable_ssl_engine(options = {}) self << "" self << "SSLEngine on" - options.each do |k, v| - case k + options.each do |key, value| + value = quoteize(value).first + case key when :certificate_file, :certificate_key_file - self << "SSL#{apachify(k)} #{quoteize(v).first}" + self << "SSL#{apachify(key)} #{value}" when :ca_certificate_file - self << "SSLCACertificateFile #{quoteize(v).first}" + self << "SSLCACertificateFile #{value}" end end self << ""