Sha256: 7e3a1052fc5fb6df8bfe61661238879ac6184c08644ace051379eee494c4c773
Contents?: true
Size: 679 Bytes
Versions: 37
Compression:
Stored size: 679 Bytes
Contents
module TDiary module Rack class ValidRequestPath def initialize( app ) @app = app end def call( env ) valid_paths = [ %r{^/$}, %r{^/index\.(rb|cgi)$}, %r{^/([0-9\-p]+)\.html$} ] valid_paths.each do |path| return @app.call(env) if env['PATH_INFO'].match(path) end body = "Not Found: #{env['PATH_INFO']}" if env["REQUEST_METHOD"] == "HEAD" [404, {'Content-Type' => 'text/plain', 'Content-Length' => body.length.to_s}, []] else [404, {'Content-Type' => 'text/plain'}, [body]] end end end end end # Local Variables: # mode: ruby # indent-tabs-mode: t # tab-width: 3 # ruby-indent-level: 3 # End:
Version data entries
37 entries across 27 versions & 1 rubygems