Sha256: c097deccdae6d9277a4a4847099fdadd8631ad41a360c4b61ae3eabb77a58ad8

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

# * George Moschovitis  <gm@navel.gr>
# (c) 2004-2005 Navel, all rights reserved.
# $Id: fastcgi.rb 1 2005-04-11 11:04:30Z gmosx $

require 'cgi'
require 'fcgi'

require 'nitro/context'
require 'nitro/dispatcher'
require 'nitro/adapters/cgi'

require 'glue/flexob'

# Speeds things up, more comaptible with OSX.

Socket.do_not_reverse_lookup = true

module Nitro

# FastCGI Adaptor. FastCGI is a language independent, 
# scalable, open extension to CGI that provides high 
# performance without the limitations of server 
# specific APIs.

class FastCGI

	def self.start(conf)
		conf = Flexob.new(conf) unless conf.is_a?(Flexob)
		
		FCGI.each do |cgi|

			context = Context.new(conf)

			context.in = cgi.in
			context.headers = cgi.env

			CgiUtils.parse_params(context)
			CgiUtils.parse_cookies(context)
			
			# gmosx, TODO: move this into a filter.
			Og.db.get_connection if defined?(Og) and Og.db

			context.render(context.path)

			Og.db.put_connection if defined?(Og) and Og.db

			cgi.out.print(CgiUtils.response_headers(context))
			cgi.out.print(context.out)

			cgi.finish

		end
	end

end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nitro-0.16.0 lib/nitro/adapters/fastcgi.rb