From 84081b4508c51d04a4a9019fcffe0e034b0b2d39 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 8 Sep 2009 15:10:04 -0700 Subject: "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. --- lib/unicorn/app/exec_cgi.rb | 2 ++ lib/unicorn/app/inetd.rb | 2 ++ lib/unicorn/app/old_rails.rb | 2 ++ lib/unicorn/app/old_rails/static.rb | 2 ++ lib/unicorn/cgi_wrapper.rb | 2 ++ lib/unicorn/configurator.rb | 2 ++ lib/unicorn/const.rb | 2 ++ lib/unicorn/http_request.rb | 3 ++- lib/unicorn/http_response.rb | 2 ++ lib/unicorn/launcher.rb | 6 ++++++ lib/unicorn/socket_helper.rb | 2 ++ lib/unicorn/tee_input.rb | 2 ++ lib/unicorn/util.rb | 2 ++ 13 files changed, 30 insertions(+), 1 deletion(-) (limited to 'lib/unicorn') 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' -- cgit v1.2.3-24-ge0c7