Sha256: ca001b68e024af8ed35f35bb4b426d4bac85de7f02cb0ed77dcd52c027aa2c06

Contents?: true

Size: 980 Bytes

Versions: 3

Compression:

Stored size: 980 Bytes

Contents

# * George Moschovitis  <gm@navel.gr>
# (c) 2004-2005 Navel, all rights reserved.
# $Id$

require 'cgi'
require 'fcgi'

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

require 'glue/flexob'

module N

# 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

3 entries across 3 versions & 1 rubygems

Version Path
nitro-0.13.0 lib/nitro/adapters/fastcgi.rb
nitro-0.14.0 lib/nitro/adapters/fastcgi.rb
nitro-0.15.0 lib/nitro/adapters/fastcgi.rb