#!/usr/bin/env ruby ENV['GATEWAY_INTERFACE'] ||= 'CGI/1.1' ENV['SERVER_PROTOCOL'] ||= 'HTTP/1.0' ENV['SERVER_SOFTWARE'] ||= 'DummyHttpServer/1.0' ENV['SERVER_NAME'] ||= 'localhost' ENV['SERVER_ADDR'] ||= '127.0.0.1' ENV['SERVER_PORT'] ||= '80' ENV['REMOTE_ADDR'] ||= '127.0.0.0' ENV['REMOTE_PORT'] ||= '33992' ENV['HTTP_ACCEPT'] ||= '*/*' ENV['HTTP_ACCEPT_LANGUAGE'] ||= 'ja,en' ENV['HTTP_HOST'] ||= 'localhost' ENV['HTTP_USER_AGENT'] ||= 'DummyAgent/1.0' script = ARGV.shift or raise ArgumentError, 'no file' ENV['SCRIPT_URI'] ||= 'http://localhost/' + File.basename(script) ENV['SCRIPT_URL'] ||= ENV['SCRIPT_URI'] ENV['SCRIPT_NAME'] ||= '/' + File.basename(script) ENV['SCRIPT_FILENAME'] = File.expand_path(script) ENV['REQUEST_METHOD'] ||= 'GET' ENV['QUERY_STRING'] ||= ARGV.join(';') load File.expand_path(script)