コレグレーデギネード

WindowsとかUbuntuとかRubyとかRailsとか

WEBricの環境でサーバーログに「WARN Could not determine content-length of response body.」多発。

前記事の「とりあえずsqlite3でgenarate scaffoldする」で今日はオワタァーと思ったが、
サーバーログを見返すとWARNがびっちり。ワーン/(TnT)\

[2012-05-08 16:33:22] WARN  Could not determine content-length of response body. 
Set content-length of the response or set Response#chunked = true

Gemfileに手を加える。以下の3行を追加。開発(development)環境使用するサーバーをWEBrickからthinに移行。
参考:http://d.hatena.ne.jp/kitokitoki/20120407/p1 謝謝!

group :development do
  gem 'thin'
end

サーバーを立ち上げると、当然thinが無いと言われるので、bundle installする。

$ rails s
Could not find gem 'thin (>= 0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Using rake (0.9.2.2) 
Using i18n (0.6.0) 
Using multi_json (1.3.4) 
Using activesupport (3.2.3) 
Using builder (3.0.0) 
Using activemodel (3.2.3) 
Using erubis (2.7.0) 
Using journey (1.0.3) 
Using rack (1.4.1) 
Using rack-cache (1.2) 
Using rack-test (0.6.1) 
Using hike (1.2.1) 
Using tilt (1.3.3) 
Using sprockets (2.1.3) 
Using actionpack (3.2.3) 
Using mime-types (1.18) 
Using polyglot (0.3.3) 
Using treetop (1.4.10) 
Using mail (2.4.4) 
Using actionmailer (3.2.3) 
Using arel (3.0.2) 
Using tzinfo (0.3.33) 
Using activerecord (3.2.3) 
Using activeresource (3.2.3) 
Using bundler (1.1.3) 
Using coffee-script-source (1.3.1) 
Using execjs (1.3.1) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.2) 
Using json (1.7.0) 
Using rdoc (3.12) 
Using thor (0.14.6) 
Using railties (3.2.3) 
Using coffee-rails (3.2.2) 
Installing daemons (1.1.8) 
Installing eventmachine (0.12.10) with native extensions 
Using jquery-rails (2.0.2) 
Using libv8 (3.3.10.4) 
Using rails (3.2.3) 
Using sass (3.1.17) 
Using sass-rails (3.2.5) 
Using sqlite3 (1.3.6) 
Using therubyracer (0.10.1) 
Installing thin (1.3.1) with native extensions 
Using uglifier (1.2.4) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

立ち上がーれー。

$ rails s
=> Booting Thin
=> Rails 3.2.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop

立ち上がりました(^^)
usersにアクセスしても例のWARNは出力されなーい。
別のlogが気になるが、次回。

Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2012-05-08 17:20:41 +0900
Served asset /application.css - 304 Not Modified (8ms)

Started GET "/assets/scaffolds.css?body=1" for 127.0.0.1 at 2012-05-08 17:20:41 +0900
Served asset /scaffolds.css - 304 Not Modified (2ms)

Started GET "/assets/users.css?body=1" for 127.0.0.1 at 2012-05-08 17:20:41 +0900
Served asset /users.css - 304 Not Modified (2ms)

Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2012-05-08 17:20:41 +0900
Served asset /jquery.js - 304 Not Modified (19ms)