Skip to content

Commit

Permalink
to use Rack::Handler::CGI.send_body instead of stolen method
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Jul 15, 2013
1 parent 881550b commit 6cda2f1
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
3 changes: 1 addition & 2 deletions index.rb
Expand Up @@ -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' )
Expand Down
8 changes: 0 additions & 8 deletions tdiary/dispatcher.rb
Expand Up @@ -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')
Expand Down
3 changes: 1 addition & 2 deletions update.rb
Expand Up @@ -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' )
Expand Down

0 comments on commit 6cda2f1

Please sign in to comment.