Permalink
Browse files

"encoding: binary" comments for all sources (1.9)

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.
  • Loading branch information...
1 parent e9b8313 commit 84081b4508c51d04a4a9019fcffe0e034b0b2d39 Eric Wong committed Sep 8, 2009
Showing with 147 additions and 2 deletions.
  1. +1 −0 Rakefile
  2. +1 −0 bin/unicorn
  3. +1 −0 bin/unicorn_rails
  4. +1 −0 ext/unicorn_http/extconf.rb
  5. +2 −0 lib/unicorn.rb
  6. +2 −0 lib/unicorn/app/exec_cgi.rb
  7. +2 −0 lib/unicorn/app/inetd.rb
  8. +2 −0 lib/unicorn/app/old_rails.rb
  9. +2 −0 lib/unicorn/app/old_rails/static.rb
  10. +2 −0 lib/unicorn/cgi_wrapper.rb
  11. +2 −0 lib/unicorn/configurator.rb
  12. +2 −0 lib/unicorn/const.rb
  13. +2 −1 lib/unicorn/http_request.rb
  14. +2 −0 lib/unicorn/http_response.rb
  15. +6 −0 lib/unicorn/launcher.rb
  16. +2 −0 lib/unicorn/socket_helper.rb
  17. +2 −0 lib/unicorn/tee_input.rb
  18. +2 −0 lib/unicorn/util.rb
  19. +1 −0 setup.rb
  20. +2 −0 test/aggregate.rb
  21. +2 −0 test/exec/test_exec.rb
  22. +2 −0 test/rails/app-1.2.3/app/controllers/application.rb
  23. +2 −0 test/rails/app-1.2.3/app/controllers/foo_controller.rb
  24. +2 −0 test/rails/app-1.2.3/app/helpers/application_helper.rb
  25. +2 −0 test/rails/app-1.2.3/config/boot.rb
  26. +2 −0 test/rails/app-1.2.3/config/environment.rb
  27. +2 −0 test/rails/app-1.2.3/config/environments/development.rb
  28. +2 −0 test/rails/app-1.2.3/config/environments/production.rb
  29. +2 −0 test/rails/app-1.2.3/config/routes.rb
  30. +2 −0 test/rails/app-2.0.2/app/controllers/application.rb
  31. +2 −0 test/rails/app-2.0.2/app/controllers/foo_controller.rb
  32. +2 −0 test/rails/app-2.0.2/app/helpers/application_helper.rb
  33. +2 −0 test/rails/app-2.0.2/config/boot.rb
  34. +2 −0 test/rails/app-2.0.2/config/environment.rb
  35. +2 −0 test/rails/app-2.0.2/config/environments/development.rb
  36. +2 −0 test/rails/app-2.0.2/config/environments/production.rb
  37. +2 −0 test/rails/app-2.0.2/config/routes.rb
  38. +2 −0 test/rails/app-2.1.2/app/controllers/application.rb
  39. +2 −0 test/rails/app-2.1.2/app/controllers/foo_controller.rb
  40. +2 −0 test/rails/app-2.1.2/app/helpers/application_helper.rb
  41. +2 −0 test/rails/app-2.1.2/config/boot.rb
  42. +2 −0 test/rails/app-2.1.2/config/environment.rb
  43. +2 −0 test/rails/app-2.1.2/config/environments/development.rb
  44. +2 −0 test/rails/app-2.1.2/config/environments/production.rb
  45. +2 −0 test/rails/app-2.1.2/config/routes.rb
  46. +2 −0 test/rails/app-2.2.2/app/controllers/application.rb
  47. +2 −0 test/rails/app-2.2.2/app/controllers/foo_controller.rb
  48. +2 −0 test/rails/app-2.2.2/app/helpers/application_helper.rb
  49. +2 −0 test/rails/app-2.2.2/config/boot.rb
  50. +2 −0 test/rails/app-2.2.2/config/environment.rb
  51. +2 −0 test/rails/app-2.2.2/config/environments/development.rb
  52. +2 −0 test/rails/app-2.2.2/config/environments/production.rb
  53. +2 −0 test/rails/app-2.2.2/config/routes.rb
  54. +2 −0 test/rails/app-2.3.3.1/app/controllers/application_controller.rb
  55. +2 −0 test/rails/app-2.3.3.1/app/controllers/foo_controller.rb
  56. +2 −0 test/rails/app-2.3.3.1/app/helpers/application_helper.rb
  57. +2 −0 test/rails/app-2.3.3.1/config/boot.rb
  58. +2 −0 test/rails/app-2.3.3.1/config/environment.rb
  59. +2 −0 test/rails/app-2.3.3.1/config/environments/development.rb
  60. +2 −0 test/rails/app-2.3.3.1/config/environments/production.rb
  61. +2 −0 test/rails/app-2.3.3.1/config/routes.rb
  62. +2 −0 test/rails/test_rails.rb
  63. +2 −0 test/test_helper.rb
  64. +2 −0 test/unit/test_configurator.rb
  65. +2 −0 test/unit/test_http_parser.rb
  66. +2 −0 test/unit/test_http_parser_ng.rb
  67. +2 −0 test/unit/test_request.rb
  68. +2 −0 test/unit/test_response.rb
  69. +2 −0 test/unit/test_server.rb
  70. +2 −0 test/unit/test_signals.rb
  71. +2 −0 test/unit/test_socket_helper.rb
  72. +2 −1 test/unit/test_tee_input.rb
  73. +2 −0 test/unit/test_upload.rb
  74. +2 −0 test/unit/test_util.rb
View
@@ -1,3 +1,4 @@
+# -*- encoding: binary -*-
require 'rubygems'
require 'echoe'
View
@@ -1,4 +1,5 @@
#!/home/ew/bin/ruby
+# -*- encoding: binary -*-
require 'unicorn/launcher'
require 'optparse'
View
@@ -1,4 +1,5 @@
#!/home/ew/bin/ruby
+# -*- encoding: binary -*-
require 'unicorn/launcher'
require 'optparse'
require 'fileutils'
@@ -1,3 +1,4 @@
+# -*- encoding: binary -*-
require 'mkmf'
dir_config("unicorn_http")
View
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
require 'fcntl'
require 'unicorn/socket_helper'
autoload :Rack, 'rack'
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
require 'unicorn'
module Unicorn::App
@@ -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.
@@ -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
@@ -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
@@ -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
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
require 'socket'
require 'logger'
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
module Unicorn
# Frequently used constants when constructing requests or responses. Many times
@@ -1,4 +1,5 @@
-# coding:binary
+# -*- encoding: binary -*-
+
require 'stringio'
require 'unicorn_http'
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
require 'time'
module Unicorn
@@ -1,4 +1,10 @@
+# -*- encoding: binary -*-
+
$stdin.sync = $stdout.sync = $stderr.sync = true
+$stdin.binmode
+$stdout.binmode
+$stderr.binmode
+
require 'unicorn'
class Unicorn::Launcher
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
require 'socket'
module Unicorn
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
module Unicorn
# acts like tee(1) on an input input to provide a input-like stream
View
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
require 'fcntl'
require 'tmpdir'
View
@@ -1,3 +1,4 @@
+# -*- encoding: binary -*-
#
# setup.rb
#
View
@@ -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
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
# Copyright (c) 2009 Eric Wong
require 'test/test_helper'
@@ -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}"
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
require 'digest/sha1'
class FooController < ApplicationController
def index
@@ -1,2 +1,4 @@
+# -*- encoding: binary -*-
+
module ApplicationHelper
end
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
unless defined?(RAILS_ROOT)
root_path = File.join(File.dirname(__FILE__), '..')
RAILS_ROOT = root_path
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
unless defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION = ENV['UNICORN_RAILS_VERSION'] # || '1.2.3'
end
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
config.cache_classes = false
config.whiny_nils = true
config.breakpoint_server = true
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
config.cache_classes = true
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching = true
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
ActionController::Routing::Routes.draw do |map|
map.connect ':controller/:action/:id.:format'
map.connect ':controller/:action/:id'
@@ -1,2 +1,4 @@
+# -*- encoding: binary -*-
+
class ApplicationController < ActionController::Base
end
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
require 'digest/sha1'
class FooController < ApplicationController
def index
@@ -1,2 +1,4 @@
+# -*- encoding: binary -*-
+
module ApplicationHelper
end
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
unless defined?(RAILS_ROOT)
root_path = File.join(File.dirname(__FILE__), '..')
RAILS_ROOT = root_path
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
unless defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION = ENV['UNICORN_RAILS_VERSION']
end
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
config.cache_classes = false
config.whiny_nils = true
config.action_controller.consider_all_requests_local = true
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
config.cache_classes = true
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching = true
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
ActionController::Routing::Routes.draw do |map|
map.connect ':controller/:action/:id.:format'
map.connect ':controller/:action/:id'
@@ -1,2 +1,4 @@
+# -*- encoding: binary -*-
+
class ApplicationController < ActionController::Base
end
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
require 'digest/sha1'
class FooController < ApplicationController
def index
@@ -1,2 +1,4 @@
+# -*- encoding: binary -*-
+
module ApplicationHelper
end
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
# Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
unless defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION = ENV['UNICORN_RAILS_VERSION']
end
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
config.cache_classes = false
config.whiny_nils = true
config.action_controller.consider_all_requests_local = true
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
config.cache_classes = true
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching = true
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
ActionController::Routing::Routes.draw do |map|
map.connect ':controller/:action/:id.:format'
map.connect ':controller/:action/:id'
@@ -1,2 +1,4 @@
+# -*- encoding: binary -*-
+
class ApplicationController < ActionController::Base
end
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
require 'digest/sha1'
class FooController < ApplicationController
def index
@@ -1,2 +1,4 @@
+# -*- encoding: binary -*-
+
module ApplicationHelper
end
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
# Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
unless defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION = ENV['UNICORN_RAILS_VERSION']
end
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
config.cache_classes = false
config.whiny_nils = true
config.action_controller.consider_all_requests_local = true
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
config.cache_classes = true
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching = true
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
ActionController::Routing::Routes.draw do |map|
map.connect ':controller/:action/:id.:format'
map.connect ':controller/:action/:id'
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
class ApplicationController < ActionController::Base
helper :all
end
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
require 'digest/sha1'
class FooController < ApplicationController
def index
@@ -1,2 +1,4 @@
+# -*- encoding: binary -*-
+
module ApplicationHelper
end
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
module Rails
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
unless defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION = ENV['UNICORN_RAILS_VERSION']
end
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
config.cache_classes = false
config.whiny_nils = true
config.action_controller.consider_all_requests_local = true
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
config.cache_classes = true
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching = true
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
ActionController::Routing::Routes.draw do |map|
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
# Copyright (c) 2009 Eric Wong
require 'test/test_helper'
View
@@ -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.
#
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
require 'test/unit'
require 'tempfile'
require 'unicorn'
@@ -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.
#
@@ -1,3 +1,5 @@
+# -*- encoding: binary -*-
+
# coding: binary
require 'test/test_helper'
require 'digest/md5'
@@ -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.
Oops, something went wrong.

0 comments on commit 84081b4

Please sign in to comment.