Sha256: 2fd1bd6f8fbcfbd138a3236b2e0460686f2aa55cb758e5a8288078c01a02cebc

Contents?: true

Size: 960 Bytes

Versions: 3

Compression:

Stored size: 960 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)

			context.render(context.path)

			Og.db.put_connection if defined?(Og)

			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.10.0 lib/nitro/adapters/fastcgi.rb
nitro-0.11.0 lib/nitro/adapters/fastcgi.rb
nitro-0.12.0 lib/nitro/adapters/fastcgi.rb