From 6cda2f157693a6b4723c713130a933b1bea06025 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Mon, 15 Jul 2013 12:46:00 +0900 Subject: [PATCH] to use Rack::Handler::CGI.send_body instead of stolen method --- index.rb | 3 +-- tdiary/dispatcher.rb | 8 -------- update.rb | 3 +-- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/index.rb b/index.rb index 86d1fa627..f0bc37463 100755 --- a/index.rb +++ b/index.rb @@ -31,8 +31,7 @@ status, headers, body = TDiary::Dispatcher.index.dispatch_cgi( request, @cgi ) headers['type'] = headers.delete('Content-Type') TDiary::Dispatcher.send_headers( status, headers ) - TDiary::Dispatcher.send_body( body ) - + ::Rack::Handler::CGI.send_body(body) rescue Exception if @cgi then print @cgi.header( 'status' => CGI::HTTP_STATUS['SERVER_ERROR'], 'type' => 'text/html' ) diff --git a/tdiary/dispatcher.rb b/tdiary/dispatcher.rb index 73f9b38d3..fe17a2659 100644 --- a/tdiary/dispatcher.rb +++ b/tdiary/dispatcher.rb @@ -42,14 +42,6 @@ def send_headers( status, headers ) $stdout.flush end - # stolen from Rack::Handler::CGI.send_body - def send_body( body ) - body.each { |part| - $stdout.print part - $stdout.flush - } - end - # FIXME temporary method during (scratch) refactoring def extract_status_for_legacy_tdiary( head ) status_str = head.delete('status') diff --git a/update.rb b/update.rb index c0630d602..4e3a2db56 100755 --- a/update.rb +++ b/update.rb @@ -31,8 +31,7 @@ status, headers, body = TDiary::Dispatcher.update.dispatch_cgi( request, @cgi ) headers['type'] = headers.delete('Content-Type') TDiary::Dispatcher.send_headers( status, headers ) - TDiary::Dispatcher.send_body( body ) - + ::Rack::Handler::CGI.send_body(body) rescue Exception if @cgi then print @cgi.header( 'status' => '500 Internal Server Error', 'type' => 'text/html' )