about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-09-08 15:10:04 -0700
committerEric Wong <normalperson@yhbt.net>2009-09-08 16:02:13 -0700
commit84081b4508c51d04a4a9019fcffe0e034b0b2d39 (patch)
tree3b53874b79b0a897ac7924a245d8939859d2f565
parente9b8313d80c9ca870a25f7047454c98b81dd7c85 (diff)
downloadunicorn-84081b4508c51d04a4a9019fcffe0e034b0b2d39.tar.gz
This ensures any string literals that pop up in *our* code will
just be a bag of bytes.  This shouldn't affect/fix/break
existing apps in most cases, but most constants will always have
the "correct" encoding (none!) to be consistent with HTTP/socket
expectations.  Since this comment affects things only on a
per-source basis, it won't affect existing apps with the
exception of strings we pass to the Rack application.

This will eventually allow us to get rid of that Unicorn::Z
constant, too.
-rw-r--r--Rakefile1
-rwxr-xr-xbin/unicorn1
-rwxr-xr-xbin/unicorn_rails1
-rw-r--r--ext/unicorn_http/extconf.rb1
-rw-r--r--lib/unicorn.rb2
-rw-r--r--lib/unicorn/app/exec_cgi.rb2
-rw-r--r--lib/unicorn/app/inetd.rb2
-rw-r--r--lib/unicorn/app/old_rails.rb2
-rw-r--r--lib/unicorn/app/old_rails/static.rb2
-rw-r--r--lib/unicorn/cgi_wrapper.rb2
-rw-r--r--lib/unicorn/configurator.rb2
-rw-r--r--lib/unicorn/const.rb2
-rw-r--r--lib/unicorn/http_request.rb3
-rw-r--r--lib/unicorn/http_response.rb2
-rw-r--r--lib/unicorn/launcher.rb6
-rw-r--r--lib/unicorn/socket_helper.rb2
-rw-r--r--lib/unicorn/tee_input.rb2
-rw-r--r--lib/unicorn/util.rb2
-rw-r--r--setup.rb1
-rwxr-xr-xtest/aggregate.rb2
-rw-r--r--test/exec/test_exec.rb2
-rw-r--r--test/rails/app-1.2.3/app/controllers/application.rb2
-rw-r--r--test/rails/app-1.2.3/app/controllers/foo_controller.rb2
-rw-r--r--test/rails/app-1.2.3/app/helpers/application_helper.rb2
-rw-r--r--test/rails/app-1.2.3/config/boot.rb2
-rw-r--r--test/rails/app-1.2.3/config/environment.rb2
-rw-r--r--test/rails/app-1.2.3/config/environments/development.rb2
-rw-r--r--test/rails/app-1.2.3/config/environments/production.rb2
-rw-r--r--test/rails/app-1.2.3/config/routes.rb2
-rw-r--r--test/rails/app-2.0.2/app/controllers/application.rb2
-rw-r--r--test/rails/app-2.0.2/app/controllers/foo_controller.rb2
-rw-r--r--test/rails/app-2.0.2/app/helpers/application_helper.rb2
-rw-r--r--test/rails/app-2.0.2/config/boot.rb2
-rw-r--r--test/rails/app-2.0.2/config/environment.rb2
-rw-r--r--test/rails/app-2.0.2/config/environments/development.rb2
-rw-r--r--test/rails/app-2.0.2/config/environments/production.rb2
-rw-r--r--test/rails/app-2.0.2/config/routes.rb2
-rw-r--r--test/rails/app-2.1.2/app/controllers/application.rb2
-rw-r--r--test/rails/app-2.1.2/app/controllers/foo_controller.rb2
-rw-r--r--test/rails/app-2.1.2/app/helpers/application_helper.rb2
-rw-r--r--test/rails/app-2.1.2/config/boot.rb2
-rw-r--r--test/rails/app-2.1.2/config/environment.rb2
-rw-r--r--test/rails/app-2.1.2/config/environments/development.rb2
-rw-r--r--test/rails/app-2.1.2/config/environments/production.rb2
-rw-r--r--test/rails/app-2.1.2/config/routes.rb2
-rw-r--r--test/rails/app-2.2.2/app/controllers/application.rb2
-rw-r--r--test/rails/app-2.2.2/app/controllers/foo_controller.rb2
-rw-r--r--test/rails/app-2.2.2/app/helpers/application_helper.rb2
-rw-r--r--test/rails/app-2.2.2/config/boot.rb2
-rw-r--r--test/rails/app-2.2.2/config/environment.rb2
-rw-r--r--test/rails/app-2.2.2/config/environments/development.rb2
-rw-r--r--test/rails/app-2.2.2/config/environments/production.rb2
-rw-r--r--test/rails/app-2.2.2/config/routes.rb2
-rw-r--r--test/rails/app-2.3.3.1/app/controllers/application_controller.rb2
-rw-r--r--test/rails/app-2.3.3.1/app/controllers/foo_controller.rb2
-rw-r--r--test/rails/app-2.3.3.1/app/helpers/application_helper.rb2
-rw-r--r--test/rails/app-2.3.3.1/config/boot.rb2
-rw-r--r--test/rails/app-2.3.3.1/config/environment.rb2
-rw-r--r--test/rails/app-2.3.3.1/config/environments/development.rb2
-rw-r--r--test/rails/app-2.3.3.1/config/environments/production.rb2
-rw-r--r--test/rails/app-2.3.3.1/config/routes.rb2
-rw-r--r--test/rails/test_rails.rb2
-rw-r--r--test/test_helper.rb2
-rw-r--r--test/unit/test_configurator.rb2
-rw-r--r--test/unit/test_http_parser.rb2
-rw-r--r--test/unit/test_http_parser_ng.rb2
-rw-r--r--test/unit/test_request.rb2
-rw-r--r--test/unit/test_response.rb2
-rw-r--r--test/unit/test_server.rb2
-rw-r--r--test/unit/test_signals.rb2
-rw-r--r--test/unit/test_socket_helper.rb2
-rw-r--r--test/unit/test_tee_input.rb3
-rw-r--r--test/unit/test_upload.rb2
-rw-r--r--test/unit/test_util.rb2
74 files changed, 147 insertions, 2 deletions
diff --git a/Rakefile b/Rakefile
index 29e2d41..d06f780 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,3 +1,4 @@
+# -*- encoding: binary -*-
 
 require 'rubygems'
 require 'echoe'
diff --git a/bin/unicorn b/bin/unicorn
index 8847e81..b636bf8 100755
--- a/bin/unicorn
+++ b/bin/unicorn
@@ -1,4 +1,5 @@
 #!/home/ew/bin/ruby
+# -*- encoding: binary -*-
 require 'unicorn/launcher'
 require 'optparse'
 
diff --git a/bin/unicorn_rails b/bin/unicorn_rails
index 1fbc0e2..b7ca12f 100755
--- a/bin/unicorn_rails
+++ b/bin/unicorn_rails
@@ -1,4 +1,5 @@
 #!/home/ew/bin/ruby
+# -*- encoding: binary -*-
 require 'unicorn/launcher'
 require 'optparse'
 require 'fileutils'
diff --git a/ext/unicorn_http/extconf.rb b/ext/unicorn_http/extconf.rb
index 2435925..d65468d 100644
--- a/ext/unicorn_http/extconf.rb
+++ b/ext/unicorn_http/extconf.rb
@@ -1,3 +1,4 @@
+# -*- encoding: binary -*-
 require 'mkmf'
 
 dir_config("unicorn_http")
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index 0916891..cf0ed8c 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 require 'fcntl'
 require 'unicorn/socket_helper'
 autoload :Rack, 'rack'
diff --git a/lib/unicorn/app/exec_cgi.rb b/lib/unicorn/app/exec_cgi.rb
index 138545e..ff52d0c 100644
--- a/lib/unicorn/app/exec_cgi.rb
+++ b/lib/unicorn/app/exec_cgi.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 require 'unicorn'
 
 module Unicorn::App
diff --git a/lib/unicorn/app/inetd.rb b/lib/unicorn/app/inetd.rb
index 145cea7..f751a33 100644
--- a/lib/unicorn/app/inetd.rb
+++ b/lib/unicorn/app/inetd.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 # Copyright (c) 2009 Eric Wong
 # You can redistribute it and/or modify it under the same terms as Ruby.
 
diff --git a/lib/unicorn/app/old_rails.rb b/lib/unicorn/app/old_rails.rb
index 9b3a3b1..ba1260a 100644
--- a/lib/unicorn/app/old_rails.rb
+++ b/lib/unicorn/app/old_rails.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 # This code is based on the original Rails handler in Mongrel
 # Copyright (c) 2005 Zed A. Shaw
 # Copyright (c) 2009 Eric Wong
diff --git a/lib/unicorn/app/old_rails/static.rb b/lib/unicorn/app/old_rails/static.rb
index e3f40bf..a1f3b6b 100644
--- a/lib/unicorn/app/old_rails/static.rb
+++ b/lib/unicorn/app/old_rails/static.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 # This code is based on the original Rails handler in Mongrel
 # Copyright (c) 2005 Zed A. Shaw
 # Copyright (c) 2009 Eric Wong
diff --git a/lib/unicorn/cgi_wrapper.rb b/lib/unicorn/cgi_wrapper.rb
index bc622ea..07ed979 100644
--- a/lib/unicorn/cgi_wrapper.rb
+++ b/lib/unicorn/cgi_wrapper.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 # This code is based on the original CGIWrapper from Mongrel
 # Copyright (c) 2005 Zed A. Shaw
 # Copyright (c) 2009 Eric Wong
diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb
index 0ecd0d5..438e363 100644
--- a/lib/unicorn/configurator.rb
+++ b/lib/unicorn/configurator.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 require 'socket'
 require 'logger'
 
diff --git a/lib/unicorn/const.rb b/lib/unicorn/const.rb
index cb08593..bda6e46 100644
--- a/lib/unicorn/const.rb
+++ b/lib/unicorn/const.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 module Unicorn
 
   # Frequently used constants when constructing requests or responses.  Many times
diff --git a/lib/unicorn/http_request.rb b/lib/unicorn/http_request.rb
index 1358ccc..400a63e 100644
--- a/lib/unicorn/http_request.rb
+++ b/lib/unicorn/http_request.rb
@@ -1,4 +1,5 @@
-# coding:binary
+# -*- encoding: binary -*-
+
 require 'stringio'
 require 'unicorn_http'
 
diff --git a/lib/unicorn/http_response.rb b/lib/unicorn/http_response.rb
index 0835820..e0ff805 100644
--- a/lib/unicorn/http_response.rb
+++ b/lib/unicorn/http_response.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 require 'time'
 
 module Unicorn
diff --git a/lib/unicorn/launcher.rb b/lib/unicorn/launcher.rb
index 5ebc271..1229b84 100644
--- a/lib/unicorn/launcher.rb
+++ b/lib/unicorn/launcher.rb
@@ -1,4 +1,10 @@
+# -*- encoding: binary -*-
+
 $stdin.sync = $stdout.sync = $stderr.sync = true
+$stdin.binmode
+$stdout.binmode
+$stderr.binmode
+
 require 'unicorn'
 
 class Unicorn::Launcher
diff --git a/lib/unicorn/socket_helper.rb b/lib/unicorn/socket_helper.rb
index f8e3725..18caf69 100644
--- a/lib/unicorn/socket_helper.rb
+++ b/lib/unicorn/socket_helper.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 require 'socket'
 
 module Unicorn
diff --git a/lib/unicorn/tee_input.rb b/lib/unicorn/tee_input.rb
index e5b1964..36a76ed 100644
--- a/lib/unicorn/tee_input.rb
+++ b/lib/unicorn/tee_input.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 module Unicorn
 
   # acts like tee(1) on an input input to provide a input-like stream
diff --git a/lib/unicorn/util.rb b/lib/unicorn/util.rb
index 5454005..655a99d 100644
--- a/lib/unicorn/util.rb
+++ b/lib/unicorn/util.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 require 'fcntl'
 require 'tmpdir'
 
diff --git a/setup.rb b/setup.rb
index 424a5f3..cf1abd9 100644
--- a/setup.rb
+++ b/setup.rb
@@ -1,3 +1,4 @@
+# -*- encoding: binary -*-
 #
 # setup.rb
 #
diff --git a/test/aggregate.rb b/test/aggregate.rb
index 1c2cc5c..5eebbe5 100755
--- a/test/aggregate.rb
+++ b/test/aggregate.rb
@@ -1,4 +1,6 @@
 #!/usr/bin/ruby -n
+# -*- encoding: binary -*-
+
 BEGIN { $tests = $assertions = $failures = $errors = 0 }
 
 $_ =~ /(\d+) tests, (\d+) assertions, (\d+) failures, (\d+) errors/ or next
diff --git a/test/exec/test_exec.rb b/test/exec/test_exec.rb
index 19177fe..7a5f3bf 100644
--- a/test/exec/test_exec.rb
+++ b/test/exec/test_exec.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 # Copyright (c) 2009 Eric Wong
 require 'test/test_helper'
 
diff --git a/test/rails/app-1.2.3/app/controllers/application.rb b/test/rails/app-1.2.3/app/controllers/application.rb
index ae8cac0..e72474f 100644
--- a/test/rails/app-1.2.3/app/controllers/application.rb
+++ b/test/rails/app-1.2.3/app/controllers/application.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 class ApplicationController < ActionController::Base
   # Pick a unique cookie name to distinguish our session data from others'
   session :session_key => "_unicorn_rails_test.#{rand}"
diff --git a/test/rails/app-1.2.3/app/controllers/foo_controller.rb b/test/rails/app-1.2.3/app/controllers/foo_controller.rb
index 8d877d1..52b7947 100644
--- a/test/rails/app-1.2.3/app/controllers/foo_controller.rb
+++ b/test/rails/app-1.2.3/app/controllers/foo_controller.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 require 'digest/sha1'
 class FooController < ApplicationController
   def index
diff --git a/test/rails/app-1.2.3/app/helpers/application_helper.rb b/test/rails/app-1.2.3/app/helpers/application_helper.rb
index de6be79..d9889b3 100644
--- a/test/rails/app-1.2.3/app/helpers/application_helper.rb
+++ b/test/rails/app-1.2.3/app/helpers/application_helper.rb
@@ -1,2 +1,4 @@
+# -*- encoding: binary -*-
+
 module ApplicationHelper
 end
diff --git a/test/rails/app-1.2.3/config/boot.rb b/test/rails/app-1.2.3/config/boot.rb
index 71c7d7c..84a5c18 100644
--- a/test/rails/app-1.2.3/config/boot.rb
+++ b/test/rails/app-1.2.3/config/boot.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 unless defined?(RAILS_ROOT)
   root_path = File.join(File.dirname(__FILE__), '..')
   RAILS_ROOT = root_path
diff --git a/test/rails/app-1.2.3/config/environment.rb b/test/rails/app-1.2.3/config/environment.rb
index 2ef6b4a..e230a66 100644
--- a/test/rails/app-1.2.3/config/environment.rb
+++ b/test/rails/app-1.2.3/config/environment.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 unless defined? RAILS_GEM_VERSION
   RAILS_GEM_VERSION = ENV['UNICORN_RAILS_VERSION'] # || '1.2.3'
 end
diff --git a/test/rails/app-1.2.3/config/environments/development.rb b/test/rails/app-1.2.3/config/environments/development.rb
index 032fb46..9d78f5e 100644
--- a/test/rails/app-1.2.3/config/environments/development.rb
+++ b/test/rails/app-1.2.3/config/environments/development.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 config.cache_classes = false
 config.whiny_nils = true
 config.breakpoint_server = true
diff --git a/test/rails/app-1.2.3/config/environments/production.rb b/test/rails/app-1.2.3/config/environments/production.rb
index c4059e3..1e049b2 100644
--- a/test/rails/app-1.2.3/config/environments/production.rb
+++ b/test/rails/app-1.2.3/config/environments/production.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 config.cache_classes = true
 config.action_controller.consider_all_requests_local = false
 config.action_controller.perform_caching             = true
diff --git a/test/rails/app-1.2.3/config/routes.rb b/test/rails/app-1.2.3/config/routes.rb
index 774028f..70816dc 100644
--- a/test/rails/app-1.2.3/config/routes.rb
+++ b/test/rails/app-1.2.3/config/routes.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 ActionController::Routing::Routes.draw do |map|
   map.connect ':controller/:action/:id.:format'
   map.connect ':controller/:action/:id'
diff --git a/test/rails/app-2.0.2/app/controllers/application.rb b/test/rails/app-2.0.2/app/controllers/application.rb
index 09705d1..e7bb740 100644
--- a/test/rails/app-2.0.2/app/controllers/application.rb
+++ b/test/rails/app-2.0.2/app/controllers/application.rb
@@ -1,2 +1,4 @@
+# -*- encoding: binary -*-
+
 class ApplicationController < ActionController::Base
 end
diff --git a/test/rails/app-2.0.2/app/controllers/foo_controller.rb b/test/rails/app-2.0.2/app/controllers/foo_controller.rb
index 8d877d1..52b7947 100644
--- a/test/rails/app-2.0.2/app/controllers/foo_controller.rb
+++ b/test/rails/app-2.0.2/app/controllers/foo_controller.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 require 'digest/sha1'
 class FooController < ApplicationController
   def index
diff --git a/test/rails/app-2.0.2/app/helpers/application_helper.rb b/test/rails/app-2.0.2/app/helpers/application_helper.rb
index de6be79..d9889b3 100644
--- a/test/rails/app-2.0.2/app/helpers/application_helper.rb
+++ b/test/rails/app-2.0.2/app/helpers/application_helper.rb
@@ -1,2 +1,4 @@
+# -*- encoding: binary -*-
+
 module ApplicationHelper
 end
diff --git a/test/rails/app-2.0.2/config/boot.rb b/test/rails/app-2.0.2/config/boot.rb
index 71c7d7c..84a5c18 100644
--- a/test/rails/app-2.0.2/config/boot.rb
+++ b/test/rails/app-2.0.2/config/boot.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 unless defined?(RAILS_ROOT)
   root_path = File.join(File.dirname(__FILE__), '..')
   RAILS_ROOT = root_path
diff --git a/test/rails/app-2.0.2/config/environment.rb b/test/rails/app-2.0.2/config/environment.rb
index 7c720f6..9961f08 100644
--- a/test/rails/app-2.0.2/config/environment.rb
+++ b/test/rails/app-2.0.2/config/environment.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 unless defined? RAILS_GEM_VERSION
   RAILS_GEM_VERSION = ENV['UNICORN_RAILS_VERSION']
 end
diff --git a/test/rails/app-2.0.2/config/environments/development.rb b/test/rails/app-2.0.2/config/environments/development.rb
index 6a613c1..5e0f1ca 100644
--- a/test/rails/app-2.0.2/config/environments/development.rb
+++ b/test/rails/app-2.0.2/config/environments/development.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 config.cache_classes = false
 config.whiny_nils = true
 config.action_controller.consider_all_requests_local = true
diff --git a/test/rails/app-2.0.2/config/environments/production.rb b/test/rails/app-2.0.2/config/environments/production.rb
index c4059e3..1e049b2 100644
--- a/test/rails/app-2.0.2/config/environments/production.rb
+++ b/test/rails/app-2.0.2/config/environments/production.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 config.cache_classes = true
 config.action_controller.consider_all_requests_local = false
 config.action_controller.perform_caching             = true
diff --git a/test/rails/app-2.0.2/config/routes.rb b/test/rails/app-2.0.2/config/routes.rb
index 774028f..70816dc 100644
--- a/test/rails/app-2.0.2/config/routes.rb
+++ b/test/rails/app-2.0.2/config/routes.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 ActionController::Routing::Routes.draw do |map|
   map.connect ':controller/:action/:id.:format'
   map.connect ':controller/:action/:id'
diff --git a/test/rails/app-2.1.2/app/controllers/application.rb b/test/rails/app-2.1.2/app/controllers/application.rb
index 09705d1..e7bb740 100644
--- a/test/rails/app-2.1.2/app/controllers/application.rb
+++ b/test/rails/app-2.1.2/app/controllers/application.rb
@@ -1,2 +1,4 @@
+# -*- encoding: binary -*-
+
 class ApplicationController < ActionController::Base
 end
diff --git a/test/rails/app-2.1.2/app/controllers/foo_controller.rb b/test/rails/app-2.1.2/app/controllers/foo_controller.rb
index 8d877d1..52b7947 100644
--- a/test/rails/app-2.1.2/app/controllers/foo_controller.rb
+++ b/test/rails/app-2.1.2/app/controllers/foo_controller.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 require 'digest/sha1'
 class FooController < ApplicationController
   def index
diff --git a/test/rails/app-2.1.2/app/helpers/application_helper.rb b/test/rails/app-2.1.2/app/helpers/application_helper.rb
index de6be79..d9889b3 100644
--- a/test/rails/app-2.1.2/app/helpers/application_helper.rb
+++ b/test/rails/app-2.1.2/app/helpers/application_helper.rb
@@ -1,2 +1,4 @@
+# -*- encoding: binary -*-
+
 module ApplicationHelper
 end
diff --git a/test/rails/app-2.1.2/config/boot.rb b/test/rails/app-2.1.2/config/boot.rb
index 0a51688..e357f0a 100644
--- a/test/rails/app-2.1.2/config/boot.rb
+++ b/test/rails/app-2.1.2/config/boot.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 # Don't change this file!
 # Configure your app in config/environment.rb and config/environments/*.rb
 
diff --git a/test/rails/app-2.1.2/config/environment.rb b/test/rails/app-2.1.2/config/environment.rb
index 7c720f6..9961f08 100644
--- a/test/rails/app-2.1.2/config/environment.rb
+++ b/test/rails/app-2.1.2/config/environment.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 unless defined? RAILS_GEM_VERSION
   RAILS_GEM_VERSION = ENV['UNICORN_RAILS_VERSION']
 end
diff --git a/test/rails/app-2.1.2/config/environments/development.rb b/test/rails/app-2.1.2/config/environments/development.rb
index 7f49032..37f523f 100644
--- a/test/rails/app-2.1.2/config/environments/development.rb
+++ b/test/rails/app-2.1.2/config/environments/development.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 config.cache_classes = false
 config.whiny_nils = true
 config.action_controller.consider_all_requests_local = true
diff --git a/test/rails/app-2.1.2/config/environments/production.rb b/test/rails/app-2.1.2/config/environments/production.rb
index c4059e3..1e049b2 100644
--- a/test/rails/app-2.1.2/config/environments/production.rb
+++ b/test/rails/app-2.1.2/config/environments/production.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 config.cache_classes = true
 config.action_controller.consider_all_requests_local = false
 config.action_controller.perform_caching             = true
diff --git a/test/rails/app-2.1.2/config/routes.rb b/test/rails/app-2.1.2/config/routes.rb
index 774028f..70816dc 100644
--- a/test/rails/app-2.1.2/config/routes.rb
+++ b/test/rails/app-2.1.2/config/routes.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 ActionController::Routing::Routes.draw do |map|
   map.connect ':controller/:action/:id.:format'
   map.connect ':controller/:action/:id'
diff --git a/test/rails/app-2.2.2/app/controllers/application.rb b/test/rails/app-2.2.2/app/controllers/application.rb
index 09705d1..e7bb740 100644
--- a/test/rails/app-2.2.2/app/controllers/application.rb
+++ b/test/rails/app-2.2.2/app/controllers/application.rb
@@ -1,2 +1,4 @@
+# -*- encoding: binary -*-
+
 class ApplicationController < ActionController::Base
 end
diff --git a/test/rails/app-2.2.2/app/controllers/foo_controller.rb b/test/rails/app-2.2.2/app/controllers/foo_controller.rb
index 8d877d1..52b7947 100644
--- a/test/rails/app-2.2.2/app/controllers/foo_controller.rb
+++ b/test/rails/app-2.2.2/app/controllers/foo_controller.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 require 'digest/sha1'
 class FooController < ApplicationController
   def index
diff --git a/test/rails/app-2.2.2/app/helpers/application_helper.rb b/test/rails/app-2.2.2/app/helpers/application_helper.rb
index de6be79..d9889b3 100644
--- a/test/rails/app-2.2.2/app/helpers/application_helper.rb
+++ b/test/rails/app-2.2.2/app/helpers/application_helper.rb
@@ -1,2 +1,4 @@
+# -*- encoding: binary -*-
+
 module ApplicationHelper
 end
diff --git a/test/rails/app-2.2.2/config/boot.rb b/test/rails/app-2.2.2/config/boot.rb
index 0a51688..e357f0a 100644
--- a/test/rails/app-2.2.2/config/boot.rb
+++ b/test/rails/app-2.2.2/config/boot.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 # Don't change this file!
 # Configure your app in config/environment.rb and config/environments/*.rb
 
diff --git a/test/rails/app-2.2.2/config/environment.rb b/test/rails/app-2.2.2/config/environment.rb
index 7c720f6..9961f08 100644
--- a/test/rails/app-2.2.2/config/environment.rb
+++ b/test/rails/app-2.2.2/config/environment.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 unless defined? RAILS_GEM_VERSION
   RAILS_GEM_VERSION = ENV['UNICORN_RAILS_VERSION']
 end
diff --git a/test/rails/app-2.2.2/config/environments/development.rb b/test/rails/app-2.2.2/config/environments/development.rb
index 7f49032..37f523f 100644
--- a/test/rails/app-2.2.2/config/environments/development.rb
+++ b/test/rails/app-2.2.2/config/environments/development.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 config.cache_classes = false
 config.whiny_nils = true
 config.action_controller.consider_all_requests_local = true
diff --git a/test/rails/app-2.2.2/config/environments/production.rb b/test/rails/app-2.2.2/config/environments/production.rb
index c4059e3..1e049b2 100644
--- a/test/rails/app-2.2.2/config/environments/production.rb
+++ b/test/rails/app-2.2.2/config/environments/production.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 config.cache_classes = true
 config.action_controller.consider_all_requests_local = false
 config.action_controller.perform_caching             = true
diff --git a/test/rails/app-2.2.2/config/routes.rb b/test/rails/app-2.2.2/config/routes.rb
index 774028f..70816dc 100644
--- a/test/rails/app-2.2.2/config/routes.rb
+++ b/test/rails/app-2.2.2/config/routes.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 ActionController::Routing::Routes.draw do |map|
   map.connect ':controller/:action/:id.:format'
   map.connect ':controller/:action/:id'
diff --git a/test/rails/app-2.3.3.1/app/controllers/application_controller.rb b/test/rails/app-2.3.3.1/app/controllers/application_controller.rb
index 6160f52..07c333e 100644
--- a/test/rails/app-2.3.3.1/app/controllers/application_controller.rb
+++ b/test/rails/app-2.3.3.1/app/controllers/application_controller.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 class ApplicationController < ActionController::Base
   helper :all
 end
diff --git a/test/rails/app-2.3.3.1/app/controllers/foo_controller.rb b/test/rails/app-2.3.3.1/app/controllers/foo_controller.rb
index 261669c..54ca1ed 100644
--- a/test/rails/app-2.3.3.1/app/controllers/foo_controller.rb
+++ b/test/rails/app-2.3.3.1/app/controllers/foo_controller.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 require 'digest/sha1'
 class FooController < ApplicationController
   def index
diff --git a/test/rails/app-2.3.3.1/app/helpers/application_helper.rb b/test/rails/app-2.3.3.1/app/helpers/application_helper.rb
index de6be79..d9889b3 100644
--- a/test/rails/app-2.3.3.1/app/helpers/application_helper.rb
+++ b/test/rails/app-2.3.3.1/app/helpers/application_helper.rb
@@ -1,2 +1,4 @@
+# -*- encoding: binary -*-
+
 module ApplicationHelper
 end
diff --git a/test/rails/app-2.3.3.1/config/boot.rb b/test/rails/app-2.3.3.1/config/boot.rb
index d22e6b0..b6c80d5 100644
--- a/test/rails/app-2.3.3.1/config/boot.rb
+++ b/test/rails/app-2.3.3.1/config/boot.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
 
 module Rails
diff --git a/test/rails/app-2.3.3.1/config/environment.rb b/test/rails/app-2.3.3.1/config/environment.rb
index 17abdb7..6eb092c 100644
--- a/test/rails/app-2.3.3.1/config/environment.rb
+++ b/test/rails/app-2.3.3.1/config/environment.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 unless defined? RAILS_GEM_VERSION
   RAILS_GEM_VERSION = ENV['UNICORN_RAILS_VERSION']
 end
diff --git a/test/rails/app-2.3.3.1/config/environments/development.rb b/test/rails/app-2.3.3.1/config/environments/development.rb
index 55376c5..3d381d2 100644
--- a/test/rails/app-2.3.3.1/config/environments/development.rb
+++ b/test/rails/app-2.3.3.1/config/environments/development.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 config.cache_classes = false
 config.whiny_nils = true
 config.action_controller.consider_all_requests_local = true
diff --git a/test/rails/app-2.3.3.1/config/environments/production.rb b/test/rails/app-2.3.3.1/config/environments/production.rb
index 474257d..08710a4 100644
--- a/test/rails/app-2.3.3.1/config/environments/production.rb
+++ b/test/rails/app-2.3.3.1/config/environments/production.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 config.cache_classes = true
 config.action_controller.consider_all_requests_local = false
 config.action_controller.perform_caching             = true
diff --git a/test/rails/app-2.3.3.1/config/routes.rb b/test/rails/app-2.3.3.1/config/routes.rb
index 4248853..ac7877c 100644
--- a/test/rails/app-2.3.3.1/config/routes.rb
+++ b/test/rails/app-2.3.3.1/config/routes.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 ActionController::Routing::Routes.draw do |map|
   map.connect ':controller/:action/:id'
   map.connect ':controller/:action/:id.:format'
diff --git a/test/rails/test_rails.rb b/test/rails/test_rails.rb
index e6f6a36..8ff97f6 100644
--- a/test/rails/test_rails.rb
+++ b/test/rails/test_rails.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 # Copyright (c) 2009 Eric Wong
 require 'test/test_helper'
 
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 29800e9..d3bf46c 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 # Copyright (c) 2005 Zed A. Shaw
 # You can redistribute it and/or modify it under the same terms as Ruby.
 #
diff --git a/test/unit/test_configurator.rb b/test/unit/test_configurator.rb
index aa29f61..9e18728 100644
--- a/test/unit/test_configurator.rb
+++ b/test/unit/test_configurator.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 require 'test/unit'
 require 'tempfile'
 require 'unicorn'
diff --git a/test/unit/test_http_parser.rb b/test/unit/test_http_parser.rb
index 7475de5..1b3faaf 100644
--- a/test/unit/test_http_parser.rb
+++ b/test/unit/test_http_parser.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 # Copyright (c) 2005 Zed A. Shaw
 # You can redistribute it and/or modify it under the same terms as Ruby.
 #
diff --git a/test/unit/test_http_parser_ng.rb b/test/unit/test_http_parser_ng.rb
index 6b9c89d..397b0b0 100644
--- a/test/unit/test_http_parser_ng.rb
+++ b/test/unit/test_http_parser_ng.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 # coding: binary
 require 'test/test_helper'
 require 'digest/md5'
diff --git a/test/unit/test_request.rb b/test/unit/test_request.rb
index 6e648c2..1896300 100644
--- a/test/unit/test_request.rb
+++ b/test/unit/test_request.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 # Copyright (c) 2009 Eric Wong
 # You can redistribute it and/or modify it under the same terms as Ruby.
 
diff --git a/test/unit/test_response.rb b/test/unit/test_response.rb
index 0c4d29e..f9eda8e 100644
--- a/test/unit/test_response.rb
+++ b/test/unit/test_response.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 # Copyright (c) 2005 Zed A. Shaw
 # You can redistribute it and/or modify it under the same terms as Ruby.
 #
diff --git a/test/unit/test_server.rb b/test/unit/test_server.rb
index fff7f89..bbb06da 100644
--- a/test/unit/test_server.rb
+++ b/test/unit/test_server.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 # Copyright (c) 2005 Zed A. Shaw
 # You can redistribute it and/or modify it under the same terms as Ruby.
 #
diff --git a/test/unit/test_signals.rb b/test/unit/test_signals.rb
index f4b5f89..9e8ccd0 100644
--- a/test/unit/test_signals.rb
+++ b/test/unit/test_signals.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 # Copyright (c) 2009 Eric Wong
 # You can redistribute it and/or modify it under the same terms as Ruby.
 #
diff --git a/test/unit/test_socket_helper.rb b/test/unit/test_socket_helper.rb
index 75d9f7b..dbca69b 100644
--- a/test/unit/test_socket_helper.rb
+++ b/test/unit/test_socket_helper.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 require 'test/test_helper'
 require 'tempfile'
 
diff --git a/test/unit/test_tee_input.rb b/test/unit/test_tee_input.rb
index 0594d6d..a4dffaf 100644
--- a/test/unit/test_tee_input.rb
+++ b/test/unit/test_tee_input.rb
@@ -1,4 +1,5 @@
-# encoding: binary
+# -*- encoding: binary -*-
+
 require 'test/unit'
 require 'digest/sha1'
 require 'unicorn'
diff --git a/test/unit/test_upload.rb b/test/unit/test_upload.rb
index a34b52b..7ac3c9e 100644
--- a/test/unit/test_upload.rb
+++ b/test/unit/test_upload.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 # Copyright (c) 2009 Eric Wong
 require 'test/test_helper'
 require 'digest/md5'
diff --git a/test/unit/test_util.rb b/test/unit/test_util.rb
index 99c1cef..4a1e21f 100644
--- a/test/unit/test_util.rb
+++ b/test/unit/test_util.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
 require 'test/test_helper'
 require 'tempfile'