Sha256: 021f68672d342403a9494dfc8f5a37edbec35a8af3733e02d2d28c0e6bb51f7f

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

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|
			begin
				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
			ensure
				# Og.db.put_connection if defined?(Og) and Og.db
			end
		end
	end

end

end

Version data entries

1 entries across 1 versions & 1 rubygems

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