Bugfixes and Rails Edge

Update to Rails 2.3.1.
  (Actually, not quite. Doesn't look like 2.3.1 will be released
   today, but I REALLY want to push these bugfixes out.)
Removed bundled Rack (Rails 2.3.1 comes bundled with Rack 1.0).
Add
     config.action_view.cache_template_loading = true
  to production environment.
Fix FastCGI bug (http://rubyforge.org/tracker/index.php?func=detail&aid=24191&group_id=186&atid=783).
Fix WikiWords bug (http://rubyforge.org/pipermail/instiki-users/2009-February/001181.html).
master
Jacques Distler 2009-02-27 19:23:00 -06:00
parent 0ddef97328
commit 133c21b801
641 changed files with 20541 additions and 71675 deletions

116
CHANGELOG
View File

@ -1,3 +1,119 @@
* 0.16.3: Big steps, Rails 2.3.0-RC1 and tons of new stuff!
All the patching, developing and great hacking from Jacques Distler was
merged into the main codebase of instiki. Jaques is now also maintaining the
main branch (together with parasew), which brings instiki up-to-date!
Find more information about all the changes in his site:
http://golem.ph.utexas.edu/instiki/
New Features:
* Instiki comes and runs with Rails 2.3.0-RC1
* New Markdown interpreter: Maruku
* Default markup dialect is Markdown+itex2MML
* Mathematics suport, using itex2MML (Markdown+itex2MML)
http://golem.ph.utexas.edu/~distler/blog/itex2MMLcommands.html
or BlahTeX (Markdown+BlahTeX/PNG)
http://golem.ph.utexas.edu/instiki/show/BlahTeX
* Theorem Environments
* Automatic Equation numbering and automatic Theorem numbering,
* Integrated presentation software
http://golem.ph.utexas.edu/instiki/show/S5
complete with support for themes
(available with Markdown, Markdown+itex2MML or Markdown+BlahTeX/PNG)
* Sends application/xhtml+xml to compatible browsers
(available with Markdown, Markdown+itex2MML or Markdown+BlahTeX/PNG)
Serve Webs which use non-Markdown Text Filters (Textile, RDoc or Mixed) as
text/html. This makes those Text Filters usable, again.
* Scalable Vector Graphics (SVG) enabled
(available with Markdown, Markdown+itex2MML or Markdown+BlahTeX/PNG).
* Nifty SVG Logo
(available with Markdown, Markdown+itex2MML or Markdown+BlahTeX/PNG).
* Atom 1.0 feeds.
* ETag support.
* Filesystem-based caching.
* New, industrial-strength Sanitizer (anti-XSS protection).
* Uses xhtmldiff for redline diff pages.
* (Actually functional) LaTeX output.
* InterWeb WikiLinks
* Add a user interface to manage uploaded files.
* Add a user interface to delete a Web.
* Add a user interface to delete orphaned pages in a Category. In addition to
deleting all orphaned pages, you can now delete just the orphaned pages in a
particular category. Among other things, this provides a handy way to delete
a (selection of) page(s): just assign them to a new category (“delete”, say)
and delete the orphaned pages in that category.
* Add the manage_fixtures plugin for easy database migration
* Descriptions in the File Upload Dialog are used as the default alt text (for
pictures) or the default link text (for files).
Bugfixes:
(see http://golem.ph.utexas.edu/~distler/blog/archives/001893.html for a
complete list)
* fixes to xhtmldiff
* fixed Sanitizer issues
* Do dnsbl lookups more judiciously. Anti-spam effectiveness is undiminished,
but the application is more responsive.
* Fix a Session CookieOverflow when rescuing Instiki::ValidationError
* Domain independent caching
* Fix for no Flash Messages
* Links on “published” Webs were all screwed-up. Fixed.
* Make uploaded pictures display in the “published” view.
* Make @import rules in the “Stylesheet Tweaks” work in the “published” view.
* Actually verify the password, when setting a password for a Web, rather than
just pretending to do so.
* fixes for nowiki “<nowiki>[[!include foo]]</nowiki>”)
* Hide Equations From WikiChunk Processing
* Fix a bug in the Chunk handler, which was mangling backslashes in included
pages.
* Entering the wrong password on the “CreateWeb” form now redirects back to
the form, as it should.
* Allow single-letter WikiLinks (e.g. “[[a]]”). Requested by a Japanese user.
* Allow single-letter includes (e.g. “[[!include a]]”).
* Huge improvements to caching and cache-sweeping
* Category listing restricts to current Web.
* All WikiReference methods limit results to the current web
* File uploads work right.
* Make WEBrick respond to TERM signal. (Launchd, in particular, requires this.)
* Ditch the URIChunk and LocalURIChunk handlers. Slow, buggy, and of dubious
utility.
* Ensure unsafe operations (new, save,...) are POSTs, not GETs.
* Fix utf-8 bug in WikiChunk handling.
* Disable WikiChunk processing in tags.
* Hide Equations From WikiChunk Processing
* Fix for the "Backslashes in Included Equations" bug.
* Sessions are now stored in a cookie (signed and Base-64 encoded).
Form_spam_protection stores form_keys in the session.
Make sure spambots implement both cookies and javascript, by storing
hashed (with salt) keys in the session.
* Make sure request.ip is a valid IPv4 or IPv6 address.
* Make remove_orphaned_pages work in a proxied situation.
* In the wiki_controller, only apply the dnsbl_check before_filter
to the :edit, :new, and :save :export actions, instead of all actions.
This makes mundane "show" requests faster, but does not
compromise spam-fighting ability.
* Be a little gentler in recovering from Instiki::ValidationErrors, when
saving a page. Previously, we threw away all the user's changes upon
the redirect. Now we attempt to salvage what he wrote.
* Drop hostname from cache key.
* Fix Recursive Includes.
* Entering an incorrect password on the Create Web form should redirect
back to the form, with a flash error.
* In the Stylesheet Tweaks, the owner of a Web can specify an @import rule
to pull in CSS styles form an external file. This worked in the "show"
view, but was broken in the "published" view. Fixed.
* Allow multiple leading capital letters in a WikiWord.
------------------------------------------------------------------------------
* 0.13.0:
Mainly a Bugfix Release, which fixes two XSS Vulnerabilities.
More information can be found on Jacques Distler's Blog:
http://golem.ph.utexas.edu/~distler/blog/archives/001634.html
------------------------------------------------------------------------------
* 0.12.0:

23
README
View File

@ -35,8 +35,9 @@ if you are running Windows 95, 98 or ME and cannot get instiki to run, try Versi
=== If you are on Mac OSX
Since the Apple guys really screwed it up, having an old Ruby Version (1.8.2) and a broken Readline Library with MacOSX Tiger, you have to
On Leopard, you are all set.
Tiger ships with a really old Ruby Version (1.8.2) and a broken Readline Library you have to
- use the Ruby One-Click-Installer for OSX ( http://rubyosx.com ) if you don't already have macports' Ruby
- make sure you read http://instiki.5uper.net/instiki/show/SQLite+issues+on+OSX
- run "ruby instiki.rb" via command-line in the directory
@ -64,10 +65,14 @@ You're now running a perfectly suitable wiki on port 2500 that'll present you wi
* Password-protected webs: Keep it private
* Authors: Each revision is associated with an author, so you can see who changed what
* Reference tracker: Which other pages are pointing to the current?
* Three markup choices: Textile http://www.textism.com/tools/textile
(default / RedCloth http://www.whytheluckystiff.net/ruby/redcloth ),
Markdown (BlueCloth[http://bluecloth.rubyforge.org]), and RDoc[http://rdoc.sourceforge.net/doc]
* Embedded webserver: Through WEBrick[http://www.webrick.org], also runs on Mongel if you want to.
* Five markup choices:
Markdown-based choices [http://daringfireball.net/projects/markdown/syntax]:
Markdown+itex2MML (the default; requires itex2MML)
Markdown+BlahTeX/PNG (requires blahtex and a working TeX installation
Markdown
Textile [http://www.textism.com/tools/textile]
RDoc [http://rdoc.sourceforge.net/doc]
* Embedded webserver: uses Mongrel (if installed), or the bundled WEBrick webserver (if not).
* Internationalization: Wiki words in any latin, greek, cyrillian, or armenian characters
* Color diffs: Track changes through revisions
* Runs on SQLite per default, can be configured to run on PostgreSQL, MySQL, DB2, Firebird, Openbase, Oracle, SQL Server or Sybase
@ -82,6 +87,9 @@ You're now running a perfectly suitable wiki on port 2500 that'll present you wi
* See CHANGELOG
== Migrating from Instiki 0.11-0.12 to 0.16.3
rake upgrade_instiki
== Migrating Instiki 0.10.2 storage to Instiki 0.11.0 database
@ -150,3 +158,8 @@ Email:: alex[AT]verk.info
From 0.11 onwards:: Matthias Tarasiewicz and 5uper.net
Email:: parasew[AT]gmail.com
Website:: http://5uper.net[http://5uper.net]
From 0.13 onwards:: Matthias Tarasiewicz and Jacques Distler
Email:: instiki-devel[AT]rubyforge.org
Weblog Jacques: http://golem.ph.utexas.edu/~distler/blog/
Weblog Parasew: http://parasew.com

View File

@ -7,7 +7,7 @@ rexml_versions = ['', File.dirname(__FILE__) + '/../vendor/plugins/rexml/lib/'].
`ruby -r #{v + 'rexml/rexml'} -e 'p REXML::VERSION'`.split('.').collect {|n| n.to_i} }
$:.unshift(File.dirname(__FILE__) + '/../vendor/plugins/rexml/lib') if (rexml_versions[0] <=> rexml_versions[1]) == -1
$:.unshift(File.dirname(__FILE__) + '/../vendor/plugins/rack/lib')
#$:.unshift(File.dirname(__FILE__) + '/../vendor/plugins/rack/lib')
require File.join(File.dirname(__FILE__), 'boot')
require 'active_support/secure_random'

View File

@ -21,6 +21,7 @@ config.action_controller.logger = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log
# Full error reports are disabled and caching is turned on
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.action_view.cache_template_loading = true
# Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"

View File

@ -1,6 +1,5 @@
#!/usr/bin/env ruby
$:.unshift(File.dirname(__FILE__) + '/vendor/plugins/rack/lib')
# Executable file for a gem
# must be same as ./instiki.rb

View File

@ -70,7 +70,7 @@ module WikiChunk
attr_reader :escaped_text
unless defined? WIKI_WORD
WIKI_WORD = Regexp.new('(":)?(\\\\)?(' + WikiWords::WIKI_WORD_PATTERN + ')\b', 0)
WIKI_WORD = Regexp.new('(":)?(\\\\)?(' + WikiWords::WIKI_WORD_PATTERN + ')\b', 0, 'u')
end
def self.pattern

View File

@ -37,6 +37,7 @@ ARGV.clone.options do |opts|
opts.on("-e", "--environment=name", String,
"Specifies the environment to run this server under (test/development/production).",
"Default: production") { |v| options[:environment] = v }
opts.on("-P", "--path=/path", String, "Runs Instiki mounted at a specific path.", "Default: /") { |v| options[:path] = v }
opts.separator ""
@ -55,7 +56,7 @@ unless server
end
puts "=> Booting #{ActiveSupport::Inflector.demodulize(server)}"
puts "=> Rails #{Rails.version} application starting on http://#{options[:Host]}:#{options[:Port]}"
puts "=> Rails #{Rails.version} application starting on http://#{options[:Host]}:#{options[:Port]}#{options[:path]}"
%w(cache pids sessions sockets).each do |dir_to_make|
FileUtils.mkdir_p(File.join(RAILS_ROOT, 'tmp', dir_to_make))
@ -88,11 +89,20 @@ else
inner_app = ActionController::Dispatcher.new
end
if options[:path].nil?
map_path = "/"
else
ActionController::Base.relative_url_root = options[:path]
map_path = options[:path]
end
app = Rack::Builder.new {
use Rails::Rack::LogTailer unless options[:detach]
use Rails::Rack::Static
use Rails::Rack::Debugger if options[:debugger]
run inner_app
map map_path do
use Rails::Rack::Static
run inner_app
end
}.to_app
puts "=> Call with -d to detach"

View File

@ -11,6 +11,10 @@ class WikiTest < Test::Unit::TestCase
match(WikiChunk::Word, 'This is a WikiWord okay?', :page_name => 'WikiWord')
end
def test_lowercase_accented
no_match(WikiChunk::Word, "This is a Refer\303\252ncia?")
end
def test_escaped
# escape is only implemented in WikiChunk::Word
match(WikiChunk::Word, 'Do not link to an \EscapedWord',

View File

@ -1,8 +0,0 @@
* Christian Neukirchen <chneukirchen@gmail.com>
* HTTP authentication: Tim Fletcher <twoggle@gmail.com>
* Cookie sessions, Static handler: Luc Heinrich <luc@honk-honk.com>
* Pool sessions, OpenID authentication: blink <blinketje@gmail.com>
* Rack::Deflater: Christoffer Sawicki <christoffer.sawicki@gmail.com>
* LiteSpeed handler: Adrian Madrid
* SCGI handler: Jeremy Evans
* Official Logo: Armin Ronacher

View File

@ -1,18 +0,0 @@
Copyright (c) 2007 Christian Neukirchen <purl.org/net/chneukirchen>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +0,0 @@
= Known issues with Rack and Web servers
* Lighttpd sets wrong SCRIPT_NAME and PATH_INFO if you mount your
FastCGI app at "/". This can be fixed by using this middleware:
class LighttpdScriptNameFix
def initialize(app)
@app = app
end
def call(env)
env["PATH_INFO"] = env["SCRIPT_NAME"].to_s + env["PATH_INFO"].to_s
env["SCRIPT_NAME"] = ""
@app.call(env)
end
end
Of course, use this only when your app runs at "/".

View File

@ -1,324 +0,0 @@
== Rack::Auth::Basic
* should challenge correctly when no credentials are specified
* should rechallenge if incorrect credentials are specified
* should return application output if correct credentials are specified
* should return 400 Bad Request if different auth scheme used
== Rack::Auth::Digest::MD5
* should challenge when no credentials are specified
* should return application output if correct credentials given
* should return application output if correct credentials given (hashed passwords)
* should rechallenge if incorrect username given
* should rechallenge if incorrect password given
* should rechallenge with stale parameter if nonce is stale
* should return 400 Bad Request if incorrect qop given
* should return 400 Bad Request if incorrect uri given
* should return 400 Bad Request if different auth scheme used
== Rack::Auth::OpenID
* realm uri should be absolute and have a path
* uri options should be absolute
* return_to should be absolute and be under the realm
* extensions should be a module
* extensions should have required constants defined
* extensions should have Request and Response defined and inherit from OpenID::Extension
* extensions should have NS_URI defined and be a string of an absolute http uri
== Rack::Builder
* chains apps by default
* has implicit #to_app
* supports blocks on use
* has explicit #to_app
* apps are initialized once
== Rack::Adapter::Camping
* works with GET
* works with POST
== Rack::Cascade
* should dispatch onward on 404 by default
* should dispatch onward on whatever is passed
* should fail if empty
* should append new app
== Rack::Handler::CGI
* startup (empty)
* should respond
* should be a lighttpd
* should have rack headers
* should have CGI headers on GET
* should have CGI headers on POST
* should support HTTP auth
* should set status
* shutdown
== Rack::CommonLogger
* should log to rack.errors by default
* should log to anything with <<
== Rack::ConditionalGet
* should set a 304 status and truncate body when If-Modified-Since hits
* should set a 304 status and truncate body when If-None-Match hits
* should not affect non-GET/HEAD requests
== Rack::ContentLength
* sets Content-Length on String bodies if none is set
* sets Content-Length on Array bodies if none is set
* does not set Content-Length on variable length bodies
* does not change Content-Length if it is already set
* does not set Content-Length on 304 responses
* does not set Content-Length when Transfer-Encoding is chunked
== Rack::Deflater
* should be able to deflate bodies that respond to each
* should be able to deflate String bodies
* should be able to gzip bodies that respond to each
* should be able to fallback to no deflation
* should be able to skip when there is no response entity body
* should handle the lack of an acceptable encoding
* should handle gzip response with Last-Modified header
* should do nothing when no-transform Cache-Control directive present
== Rack::Directory
* serves directory indices
* passes to app if file found
* serves uri with URL encoded filenames
* does not allow directory traversal
* 404s if it can't find the file
== Rack::Handler::FastCGI
* startup (empty)
* should respond
* should be a lighttpd
* should have rack headers
* should have CGI headers on GET
* should have CGI headers on POST
* should support HTTP auth
* should set status
* shutdown
== Rack::File
* serves files
* sets Last-Modified header
* serves files with URL encoded filenames
* does not allow directory traversal
* does not allow directory traversal with encoded periods
* 404s if it can't find the file
* detects SystemCallErrors
== Rack::Handler
* has registered default handlers
* should get unregistered handler by name
* should register custom handler
== Rack::Head
* response (empty)
* passes GET, POST, PUT, DELETE, OPTIONS, TRACE requests
* removes body from HEAD requests
== Rack::Lint
* passes valid request
* notices fatal errors
* notices environment errors
* notices input errors
* notices error errors
* notices status errors
* notices header errors
* notices content-type errors
* notices content-length errors
* notices body errors
* notices input handling errors
* notices error handling errors
* notices HEAD errors
== Rack::Lint::InputWrapper
* delegates :size to underlying IO object
* delegates :rewind to underlying IO object
== Rack::Lobster::LambdaLobster
* should be a single lambda
* should look like a lobster
* should be flippable
== Rack::Lobster
* should look like a lobster
* should be flippable
* should provide crashing for testing purposes
== Rack::MethodOverride
* should not affect GET requests
* _method parameter should modify REQUEST_METHOD for POST requests
* X-HTTP-Method-Override header should modify REQUEST_METHOD for POST requests
* should not modify REQUEST_METHOD if the method is unknown
* should not modify REQUEST_METHOD when _method is nil
* should store the original REQUEST_METHOD prior to overriding
== Rack::MockRequest
* should return a MockResponse
* should be able to only return the environment
* should provide sensible defaults
* should allow GET/POST/PUT/DELETE
* should allow posting
* should use all parts of an URL
* should behave valid according to the Rack spec
== Rack::MockResponse
* should provide access to the HTTP status
* should provide access to the HTTP headers
* should provide access to the HTTP body
* should provide access to the Rack errors
* should optionally make Rack errors fatal
== Rack::Handler::Mongrel
* should respond
* should be a Mongrel
* should have rack headers
* should have CGI headers on GET
* should have CGI headers on POST
* should support HTTP auth
* should set status
* should provide a .run
* should provide a .run that maps a hash
* should provide a .run that maps a urlmap
* should provide a .run that maps a urlmap restricting by host
* should stream #each part of the response
== Rack::Recursive
* should allow for subrequests
* should raise error on requests not below the app
* should support forwarding
== Rack::Request
* wraps the rack variables
* can figure out the correct host
* can parse the query string
* can parse POST data
* can parse POST data with explicit content type
* does not parse POST data when media type is not form-data
* rewinds input after parsing POST data
* does not rewind unwindable CGI input
* can get value by key from params with #[]
* can set value to key on params with #[]=
* values_at answers values by keys in order given
* referrer should be extracted correct
* can cache, but invalidates the cache
* can figure out if called via XHR
* can parse cookies
* parses cookies according to RFC 2109
* provides setters
* provides the original env
* can restore the URL
* can restore the full path
* can handle multiple media type parameters
* can parse multipart form data
* can parse big multipart form data
* can detect invalid multipart form data
* should work around buggy 1.8.* Tempfile equality
* does conform to the Rack spec
* should parse Accept-Encoding correctly
* should provide ip information
== Rack::Response
* has sensible default values
* can be written to
* can set and read headers
* can set cookies
* formats the Cookie expiration date accordingly to RFC 2109
* can set secure cookies
* can delete cookies
* has a useful constructor
* has a constructor that can take a block
* doesn't return invalid responses
* knows if it's empty
* should provide access to the HTTP status
* should provide access to the HTTP headers
== Rack::Session::Cookie
* creates a new cookie
* loads from a cookie
* survives broken cookies
* barks on too big cookies
* creates a new cookie with integrity hash
* loads from a cookie wih integrity hash
* ignores tampered with session cookies
== Rack::Session::Memcache
* startup (empty)
* faults on no connection
* creates a new cookie
* determines session from a cookie
* survives broken cookies
* maintains freshness
* multithread: should cleanly merge sessions
* shutdown
== Rack::Session::Pool
* creates a new cookie
* determines session from a cookie
* survives broken cookies
* maintains freshness
* multithread: should merge sessions
== Rack::ShowExceptions
* catches exceptions
== Rack::ShowStatus
* should provide a default status message
* should let the app provide additional information
* should not replace existing messages
* should pass on original headers
* should replace existing messages if there is detail
== Rack::Static
* serves files
* 404s if url root is known but it can't find the file
* calls down the chain if url root is not known
== Rack::Handler::Thin
* should respond
* should be a Thin
* should have rack headers
* should have CGI headers on GET
* should have CGI headers on POST
* should support HTTP auth
* should set status
== Rack::URLMap
* dispatches paths correctly
* dispatches hosts correctly
* should be nestable
* should route root apps correctly
== Rack::Utils
* should escape correctly
* should unescape correctly
* should parse query strings correctly
* should build query strings correctly
* should figure out which encodings are acceptable
== Rack::Utils::HeaderHash
* should retain header case
* should check existence of keys case insensitively
* should merge case-insensitively
* should overwrite case insensitively and assume the new key's case
* should be converted to real Hash
== Rack::Utils::Context
* should perform checks on both arguments
* should set context correctly
* should alter app on recontexting
* should run different apps
== Rack::Handler::WEBrick
* should respond
* should be a WEBrick
* should have rack headers
* should have CGI headers on GET
* should have CGI headers on POST
* should support HTTP auth
* should set status
* should correctly set cookies
* should provide a .run
244 specifications, 4 empty (1004 requirements), 0 failures

View File

@ -1,306 +0,0 @@
= Rack, a modular Ruby webserver interface
Rack provides a minimal, modular and adaptable interface for developing
web applications in Ruby. By wrapping HTTP requests and responses in
the simplest way possible, it unifies and distills the API for web
servers, web frameworks, and software in between (the so-called
middleware) into a single method call.
The exact details of this are described in the Rack specification,
which all Rack applications should conform to.
== Supported web servers
The included *handlers* connect all kinds of web servers to Rack:
* Mongrel
* EventedMongrel
* SwiftipliedMongrel
* WEBrick
* FCGI
* CGI
* SCGI
* LiteSpeed
* Thin
These web servers include Rack handlers in their distributions:
* Ebb
* Fuzed
* Phusion Passenger (which is mod_rack for Apache)
Any valid Rack app will run the same on all these handlers, without
changing anything.
== Supported web frameworks
The included *adapters* connect Rack with existing Ruby web frameworks:
* Camping
These frameworks include Rack adapters in their distributions:
* Coset
* Halcyon
* Mack
* Maveric
* Merb
* Racktools::SimpleApplication
* Ramaze
* Ruby on Rails
* Sinatra
* Sin
* Vintage
* Waves
Current links to these projects can be found at
http://ramaze.net/#other-frameworks
== Available middleware
Between the server and the framework, Rack can be customized to your
applications needs using middleware, for example:
* Rack::URLMap, to route to multiple applications inside the same process.
* Rack::CommonLogger, for creating Apache-style logfiles.
* Rack::ShowException, for catching unhandled exceptions and
presenting them in a nice and helpful way with clickable backtrace.
* Rack::File, for serving static files.
* ...many others!
All these components use the same interface, which is described in
detail in the Rack specification. These optional components can be
used in any way you wish.
== Convenience
If you want to develop outside of existing frameworks, implement your
own ones, or develop middleware, Rack provides many helpers to create
Rack applications quickly and without doing the same web stuff all
over:
* Rack::Request, which also provides query string parsing and
multipart handling.
* Rack::Response, for convenient generation of HTTP replies and
cookie handling.
* Rack::MockRequest and Rack::MockResponse for efficient and quick
testing of Rack application without real HTTP round-trips.
== rack-contrib
The plethora of useful middleware created the need for a project that
collects fresh Rack middleware. rack-contrib includes a variety of
add-on components for Rack and it is easy to contribute new modules.
* http://github.com/rack/rack-contrib
== rackup
rackup is a useful tool for running Rack applications, which uses the
Rack::Builder DSL to configure middleware and build up applications
easily.
rackup automatically figures out the environment it is run in, and
runs your application as FastCGI, CGI, or standalone with Mongrel or
WEBrick---all from the same configuration.
== Quick start
Try the lobster!
Either with the embedded WEBrick starter:
ruby -Ilib lib/rack/lobster.rb
Or with rackup:
bin/rackup -Ilib example/lobster.ru
By default, the lobster is found at http://localhost:9292.
== Installing with RubyGems
A Gem of Rack is available. You can install it with:
gem install rack
I also provide a local mirror of the gems (and development snapshots)
at my site:
gem install rack --source http://chneukirchen.org/releases/gems/
== Running the tests
Testing Rack requires the test/spec testing framework:
gem install test-spec
There are two rake-based test tasks:
rake test tests all the fast tests (no Handlers or Adapters)
rake fulltest runs all the tests
The fast testsuite has no dependencies outside of the core Ruby
installation and test-spec.
To run the test suite completely, you need:
* camping
* mongrel
* fcgi
* ruby-openid
* memcache-client
The full set of tests test FCGI access with lighttpd (on port
9203) so you will need lighttpd installed as well as the FCGI
libraries and the fcgi gem:
Download and install lighttpd:
http://www.lighttpd.net/download
Installing the FCGI libraries:
curl -O http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
tar xzvf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure --prefix=/usr/local
make
sudo make install
cd ..
Installing the Ruby fcgi gem:
gem install fcgi
Furthermore, to test Memcache sessions, you need memcached (will be
run on port 11211) and memcache-client installed.
== History
* March 3rd, 2007: First public release 0.1.
* May 16th, 2007: Second public release 0.2.
* HTTP Basic authentication.
* Cookie Sessions.
* Static file handler.
* Improved Rack::Request.
* Improved Rack::Response.
* Added Rack::ShowStatus, for better default error messages.
* Bug fixes in the Camping adapter.
* Removed Rails adapter, was too alpha.
* February 26th, 2008: Third public release 0.3.
* LiteSpeed handler, by Adrian Madrid.
* SCGI handler, by Jeremy Evans.
* Pool sessions, by blink.
* OpenID authentication, by blink.
* :Port and :File options for opening FastCGI sockets, by blink.
* Last-Modified HTTP header for Rack::File, by blink.
* Rack::Builder#use now accepts blocks, by Corey Jewett.
(See example/protectedlobster.ru)
* HTTP status 201 can contain a Content-Type and a body now.
* Many bugfixes, especially related to Cookie handling.
* August 21st, 2008: Fourth public release 0.4.
* New middleware, Rack::Deflater, by Christoffer Sawicki.
* OpenID authentication now needs ruby-openid 2.
* New Memcache sessions, by blink.
* Explicit EventedMongrel handler, by Joshua Peek <josh@joshpeek.com>
* Rack::Reloader is not loaded in rackup development mode.
* rackup can daemonize with -D.
* Many bugfixes, especially for pool sessions, URLMap, thread safety
and tempfile handling.
* Improved tests.
* Rack moved to Git.
* January 6th, 2009: Fifth public release 0.9.
* Rack is now managed by the Rack Core Team.
* Rack::Lint is stricter and follows the HTTP RFCs more closely.
* Added ConditionalGet middleware.
* Added ContentLength middleware.
* Added Deflater middleware.
* Added Head middleware.
* Added MethodOverride middleware.
* Rack::Mime now provides popular MIME-types and their extension.
* Mongrel Header now streams.
* Added Thin handler.
* Official support for swiftiplied Mongrel.
* Secure cookies.
* Made HeaderHash case-preserving.
* Many bugfixes and small improvements.
* January 9th, 2009: Sixth public release 0.9.1.
* Fix directory traversal exploits in Rack::File and Rack::Directory.
== Contact
Please mail bugs, suggestions and patches to
<mailto:rack-devel@googlegroups.com>.
Mailing list archives are available at
<http://groups.google.com/group/rack-devel>.
There is a bug tracker at <http://rack.lighthouseapp.com/>.
Git repository (patches rebased on master are most welcome):
* http://github.com/rack/rack
* http://git.vuxu.org/cgi-bin/gitweb.cgi?p=rack.git
You are also welcome to join the #rack channel on irc.freenode.net.
== Thanks
The Rack Core Team, consisting of
* Christian Neukirchen (chneukirchen)
* James Tucker (raggi)
* Josh Peek (josh)
* Michael Fellinger (manveru)
* Ryan Tomayko (rtomayko)
* Scytrin dai Kinthra (scytrin)
would like to thank:
* Adrian Madrid, for the LiteSpeed handler.
* Christoffer Sawicki, for the first Rails adapter and Rack::Deflater.
* Tim Fletcher, for the HTTP authentication code.
* Luc Heinrich for the Cookie sessions, the static file handler and bugfixes.
* Armin Ronacher, for the logo and racktools.
* Aredridel, Ben Alpert, Dan Kubb, Daniel Roethlisberger, Matt Todd,
Tom Robinson, and Phil Hagelberg for bug fixing and other
improvements.
* Stephen Bannasch, for bug reports and documentation.
* Gary Wright, for proposing a better Rack::Response interface.
* Jonathan Buch, for improvements regarding Rack::Response.
* Armin Röhrl, for tracking down bugs in the Cookie generator.
* Alexander Kellett for testing the Gem and reviewing the announcement.
* Marcus Rückert, for help with configuring and debugging lighttpd.
* The WSGI team for the well-done and documented work they've done and
Rack builds up on.
* All bug reporters and patch contributers not mentioned above.
== Copyright
Copyright (C) 2007, 2008, 2009 Christian Neukirchen <http://purl.org/net/chneukirchen>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
== Links
Rack:: <http://rack.rubyforge.org/>
Rack's Rubyforge project:: <http://rubyforge.org/projects/rack>
Official Rack repositories:: <http://github.com/rack>
rack-devel mailing list:: <http://groups.google.com/group/rack-devel>
Christian Neukirchen:: <http://chneukirchen.org/>

View File

@ -1,188 +0,0 @@
# Rakefile for Rack. -*-ruby-*-
require 'rake/rdoctask'
require 'rake/testtask'
desc "Run all the tests"
task :default => [:test]
desc "Do predistribution stuff"
task :predist => [:chmod, :changelog, :rdoc]
desc "Make an archive as .tar.gz"
task :dist => [:fulltest, :predist] do
sh "git archive --format=tar --prefix=#{release}/ HEAD^{tree} >#{release}.tar"
sh "pax -waf #{release}.tar -s ':^:#{release}/:' RDOX SPEC ChangeLog doc"
sh "gzip -f -9 #{release}.tar"
end
# Helper to retrieve the "revision number" of the git tree.
def git_tree_version
if File.directory?(".git")
@tree_version ||= `git describe`.strip.sub('-', '.')
@tree_version << ".0" unless @tree_version.count('.') == 2
else
$: << "lib"
require 'rack'
@tree_version = Rack.release
end
@tree_version
end
def gem_version
git_tree_version.gsub(/-.*/, '')
end
def release
"rack-#{git_tree_version}"
end
def manifest
`git ls-files`.split("\n")
end
desc "Make binaries executable"
task :chmod do
Dir["bin/*"].each { |binary| File.chmod(0775, binary) }
Dir["test/cgi/test*"].each { |binary| File.chmod(0775, binary) }
end
desc "Generate a ChangeLog"
task :changelog do
File.open("ChangeLog", "w") { |out|
`git log -z`.split("\0").map { |chunk|
author = chunk[/Author: (.*)/, 1].strip
date = chunk[/Date: (.*)/, 1].strip
desc, detail = $'.strip.split("\n", 2)
detail ||= ""
detail = detail.gsub(/.*darcs-hash:.*/, '')
detail.rstrip!
out.puts "#{date} #{author}"
out.puts " * #{desc.strip}"
out.puts detail unless detail.empty?
out.puts
}
}
end
desc "Generate RDox"
task "RDOX" do
sh "specrb -Ilib:test -a --rdox >RDOX"
end
desc "Generate Rack Specification"
task "SPEC" do
File.open("SPEC", "wb") { |file|
IO.foreach("lib/rack/lint.rb") { |line|
if line =~ /## (.*)/
file.puts $1
end
}
}
end
desc "Run all the fast tests"
task :test do
sh "specrb -Ilib:test -w #{ENV['TEST'] || '-a'} #{ENV['TESTOPTS'] || '-t "^(?!Rack::Handler|Rack::Adapter|Rack::Session::Memcache|Rack::Auth::OpenID)"'}"
end
desc "Run all the tests"
task :fulltest => [:chmod] do
sh "specrb -Ilib:test -w #{ENV['TEST'] || '-a'} #{ENV['TESTOPTS']}"
end
begin
require 'rubygems'
require 'rake'
require 'rake/clean'
require 'rake/packagetask'
require 'rake/gempackagetask'
require 'fileutils'
rescue LoadError
# Too bad.
else
spec = Gem::Specification.new do |s|
s.name = "rack"
s.version = gem_version
s.platform = Gem::Platform::RUBY
s.summary = "a modular Ruby webserver interface"
s.description = <<-EOF
Rack provides minimal, modular and adaptable interface for developing
web applications in Ruby. By wrapping HTTP requests and responses in
the simplest way possible, it unifies and distills the API for web
servers, web frameworks, and software in between (the so-called
middleware) into a single method call.
Also see http://rack.rubyforge.org.
EOF
s.files = manifest + %w(SPEC RDOX)
s.bindir = 'bin'
s.executables << 'rackup'
s.require_path = 'lib'
s.has_rdoc = true
s.extra_rdoc_files = ['README', 'SPEC', 'RDOX', 'KNOWN-ISSUES']
s.test_files = Dir['test/{test,spec}_*.rb']
s.author = 'Christian Neukirchen'
s.email = 'chneukirchen@gmail.com'
s.homepage = 'http://rack.rubyforge.org'
s.rubyforge_project = 'rack'
s.add_development_dependency 'test-spec'
s.add_development_dependency 'camping'
s.add_development_dependency 'fcgi'
s.add_development_dependency 'memcache-client'
s.add_development_dependency 'mongrel'
s.add_development_dependency 'ruby-openid', '~> 2.0.0'
s.add_development_dependency 'thin'
end
Rake::GemPackageTask.new(spec) do |p|
p.gem_spec = spec
p.need_tar = false
p.need_zip = false
end
end
desc "Generate RDoc documentation"
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.options << '--line-numbers' << '--inline-source' <<
'--main' << 'README' <<
'--title' << 'Rack Documentation' <<
'--charset' << 'utf-8'
rdoc.rdoc_dir = "doc"
rdoc.rdoc_files.include 'README'
rdoc.rdoc_files.include 'KNOWN-ISSUES'
rdoc.rdoc_files.include 'SPEC'
rdoc.rdoc_files.include 'RDOX'
rdoc.rdoc_files.include('lib/rack.rb')
rdoc.rdoc_files.include('lib/rack/*.rb')
rdoc.rdoc_files.include('lib/rack/*/*.rb')
end
task :rdoc => ["SPEC", "RDOX"]
task :pushsite => [:rdoc] do
sh "rsync -avz doc/ chneukirchen@rack.rubyforge.org:/var/www/gforge-projects/rack/doc/"
sh "rsync -avz site/ chneukirchen@rack.rubyforge.org:/var/www/gforge-projects/rack/"
end
begin
require 'rcov/rcovtask'
Rcov::RcovTask.new do |t|
t.test_files = FileList['test/{spec,test}_*.rb']
t.verbose = true # uncomment to see the executed command
t.rcov_opts = ["--text-report",
"-Ilib:test",
"--include-file", "^lib,^test",
"--exclude-only", "^/usr,^/home/.*/src,active_"]
end
rescue LoadError
end

View File

@ -1,129 +0,0 @@
This specification aims to formalize the Rack protocol. You
can (and should) use Rack::Lint to enforce it.
When you develop middleware, be sure to add a Lint before and
after to catch all mistakes.
= Rack applications
A Rack application is an Ruby object (not a class) that
responds to +call+.
It takes exactly one argument, the *environment*
and returns an Array of exactly three values:
The *status*,
the *headers*,
and the *body*.
== The Environment
The environment must be an true instance of Hash (no
subclassing allowed) that includes CGI-like headers.
The application is free to modify the environment.
The environment is required to include these variables
(adopted from PEP333), except when they'd be empty, but see
below.
<tt>REQUEST_METHOD</tt>:: The HTTP request method, such as
"GET" or "POST". This cannot ever
be an empty string, and so is
always required.
<tt>SCRIPT_NAME</tt>:: The initial portion of the request
URL's "path" that corresponds to the
application object, so that the
application knows its virtual
"location". This may be an empty
string, if the application corresponds
to the "root" of the server.
<tt>PATH_INFO</tt>:: The remainder of the request URL's
"path", designating the virtual
"location" of the request's target
within the application. This may be an
empty string, if the request URL targets
the application root and does not have a
trailing slash.
<tt>QUERY_STRING</tt>:: The portion of the request URL that
follows the <tt>?</tt>, if any. May be
empty, but is always required!
<tt>SERVER_NAME</tt>, <tt>SERVER_PORT</tt>:: When combined with <tt>SCRIPT_NAME</tt> and <tt>PATH_INFO</tt>, these variables can be used to complete the URL. Note, however, that <tt>HTTP_HOST</tt>, if present, should be used in preference to <tt>SERVER_NAME</tt> for reconstructing the request URL. <tt>SERVER_NAME</tt> and <tt>SERVER_PORT</tt> can never be empty strings, and so are always required.
<tt>HTTP_</tt> Variables:: Variables corresponding to the
client-supplied HTTP request
headers (i.e., variables whose
names begin with <tt>HTTP_</tt>). The
presence or absence of these
variables should correspond with
the presence or absence of the
appropriate HTTP header in the
request.
In addition to this, the Rack environment must include these
Rack-specific variables:
<tt>rack.version</tt>:: The Array [0,1], representing this version of Rack.
<tt>rack.url_scheme</tt>:: +http+ or +https+, depending on the request URL.
<tt>rack.input</tt>:: See below, the input stream.
<tt>rack.errors</tt>:: See below, the error stream.
<tt>rack.multithread</tt>:: true if the application object may be simultaneously invoked by another thread in the same process, false otherwise.
<tt>rack.multiprocess</tt>:: true if an equivalent application object may be simultaneously invoked by another process, false otherwise.
<tt>rack.run_once</tt>:: true if the server expects (but does not guarantee!) that the application will only be invoked this one time during the life of its containing process. Normally, this will only be true for a server based on CGI (or something similar).
The server or the application can store their own data in the
environment, too. The keys must contain at least one dot,
and should be prefixed uniquely. The prefix <tt>rack.</tt>
is reserved for use with the Rack core distribution and must
not be used otherwise.
The environment must not contain the keys
<tt>HTTP_CONTENT_TYPE</tt> or <tt>HTTP_CONTENT_LENGTH</tt>
(use the versions without <tt>HTTP_</tt>).
The CGI keys (named without a period) must have String values.
There are the following restrictions:
* <tt>rack.version</tt> must be an array of Integers.
* <tt>rack.url_scheme</tt> must either be +http+ or +https+.
* There must be a valid input stream in <tt>rack.input</tt>.
* There must be a valid error stream in <tt>rack.errors</tt>.
* The <tt>REQUEST_METHOD</tt> must be a valid token.
* The <tt>SCRIPT_NAME</tt>, if non-empty, must start with <tt>/</tt>
* The <tt>PATH_INFO</tt>, if non-empty, must start with <tt>/</tt>
* The <tt>CONTENT_LENGTH</tt>, if given, must consist of digits only.
* One of <tt>SCRIPT_NAME</tt> or <tt>PATH_INFO</tt> must be
set. <tt>PATH_INFO</tt> should be <tt>/</tt> if
<tt>SCRIPT_NAME</tt> is empty.
<tt>SCRIPT_NAME</tt> never should be <tt>/</tt>, but instead be empty.
=== The Input Stream
The input stream must respond to +gets+, +each+ and +read+.
* +gets+ must be called without arguments and return a string,
or +nil+ on EOF.
* +read+ must be called without or with one integer argument
and return a string, or +nil+ on EOF.
* +each+ must be called without arguments and only yield Strings.
* +close+ must never be called on the input stream.
=== The Error Stream
The error stream must respond to +puts+, +write+ and +flush+.
* +puts+ must be called with a single argument that responds to +to_s+.
* +write+ must be called with a single argument that is a String.
* +flush+ must be called without arguments and must be called
in order to make the error appear for sure.
* +close+ must never be called on the error stream.
== The Response
=== The Status
The status, if parsed as integer (+to_i+), must be greater than or equal to 100.
=== The Headers
The header must respond to each, and yield values of key and value.
The header keys must be Strings.
The header must not contain a +Status+ key,
contain keys with <tt>:</tt> or newlines in their name,
contain keys names that end in <tt>-</tt> or <tt>_</tt>,
but only contain keys that consist of
letters, digits, <tt>_</tt> or <tt>-</tt> and start with a letter.
The values of the header must respond to #each.
The values passed on #each must be Strings
and not contain characters below 037.
=== The Content-Type
There must be a <tt>Content-Type</tt>, except when the
+Status+ is 1xx, 204 or 304, in which case there must be none
given.
=== The Content-Length
There must be a <tt>Content-Length</tt>, except when the
+Status+ is 1xx, 204 or 304, in which case there must be none
given.
=== The Body
The Body must respond to #each
and must only yield String values.
If the Body responds to #close, it will be called after iteration.
The Body commonly is an Array of Strings, the application
instance itself, or a File-like object.
== Thanks
Some parts of this specification are adopted from PEP333: Python
Web Server Gateway Interface
v1.0 (http://www.python.org/dev/peps/pep-0333/). I'd like to thank
everyone involved in that effort.

View File

@ -1,172 +0,0 @@
#!/usr/bin/env ruby
# -*- ruby -*-
require 'optparse'
automatic = false
server = nil
env = "development"
daemonize = false
pid = nil
options = {:Port => 9292, :Host => "0.0.0.0", :AccessLog => []}
opts = OptionParser.new("", 24, ' ') { |opts|
opts.banner = "Usage: rackup [ruby options] [rack options] [rackup config]"
opts.separator ""
opts.separator "Ruby options:"
lineno = 1
opts.on("-e", "--eval LINE", "evaluate a LINE of code") { |line|
eval line, TOPLEVEL_BINDING, "-e", lineno
lineno += 1
}
opts.on("-d", "--debug", "set debugging flags (set $DEBUG to true)") {
$DEBUG = true
}
opts.on("-w", "--warn", "turn warnings on for your script") {
$-w = true
}
opts.on("-I", "--include PATH",
"specify $LOAD_PATH (may be used more than once)") { |path|
$LOAD_PATH.unshift(*path.split(":"))
}
opts.on("-r", "--require LIBRARY",
"require the library, before executing your script") { |library|
require library
}
opts.separator ""
opts.separator "Rack options:"
opts.on("-s", "--server SERVER", "serve using SERVER (webrick/mongrel)") { |s|
server = s
}
opts.on("-o", "--host HOST", "listen on HOST (default: 0.0.0.0)") { |host|
options[:Host] = host
}
opts.on("-p", "--port PORT", "use PORT (default: 9292)") { |port|
options[:Port] = port
}
opts.on("-E", "--env ENVIRONMENT", "use ENVIRONMENT for defaults (default: development)") { |e|
env = e
}
opts.on("-D", "--daemonize", "run daemonized in the background") { |d|
daemonize = d ? true : false
}
opts.on("-P", "--pid FILE", "file to store PID (default: rack.pid)") { |f|
pid = File.expand_path(f)
}
opts.separator ""
opts.separator "Common options:"
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
opts.on_tail("--version", "Show version") do
require 'rack'
puts "Rack #{Rack.version}"
exit
end
opts.parse! ARGV
}
require 'pp' if $DEBUG
config = ARGV[0] || "config.ru"
if !File.exist? config
abort "configuration #{config} not found"
end
if config =~ /\.ru$/
cfgfile = File.read(config)
if cfgfile[/^#\\(.*)/]
opts.parse! $1.split(/\s+/)
end
require 'rack'
inner_app = eval "Rack::Builder.new {( " + cfgfile + "\n )}.to_app",
nil, config
else
require 'rack'
require config
inner_app = Object.const_get(File.basename(config, '.rb').capitalize)
end
unless server = Rack::Handler.get(server)
# Guess.
if ENV.include?("PHP_FCGI_CHILDREN")
server = Rack::Handler::FastCGI
# We already speak FastCGI
options.delete :File
options.delete :Port
elsif ENV.include?("REQUEST_METHOD")
server = Rack::Handler::CGI
else
begin
server = Rack::Handler::Mongrel
rescue LoadError => e
server = Rack::Handler::WEBrick
end
end
end
p server if $DEBUG
case env
when "development"
app = Rack::Builder.new {
use Rack::CommonLogger, STDERR unless server.name =~ /CGI/
use Rack::ShowExceptions
use Rack::Lint
run inner_app
}.to_app
when "deployment"
app = Rack::Builder.new {
use Rack::CommonLogger, STDERR unless server.name =~ /CGI/
run inner_app
}.to_app
when "none"
app = inner_app
end
if $DEBUG
pp app
pp inner_app
end
if daemonize
if RUBY_VERSION < "1.9"
exit if fork
Process.setsid
exit if fork
Dir.chdir "/"
File.umask 0000
STDIN.reopen "/dev/null"
STDOUT.reopen "/dev/null", "a"
STDERR.reopen "/dev/null", "a"
else
Process.daemon
end
if pid
File.open(pid, 'w'){ |f| f.write("#{Process.pid}") }
at_exit { File.delete(pid) if File.exist?(pid) }
end
end
server.run app, options

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 35 KiB

View File

@ -1,149 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: L2</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">L2</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../files/lib/rack/forward_rb.html">
lib/rack/forward.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Rack/Lobster.html">
Rack::Lobster
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000001">call</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000001" class="method-detail">
<a name="M000001"></a>
<div class="method-heading">
<a href="#M000001" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000001-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/forward.rb, line 47</span>
47: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
48: <span class="ruby-identifier">s</span>,<span class="ruby-identifier">h</span>,<span class="ruby-identifier">b</span> = <span class="ruby-keyword kw">super</span>
49: [<span class="ruby-identifier">s</span>,<span class="ruby-identifier">h</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-value str">&quot;env&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">env</span>.<span class="ruby-identifier">inspect</span>),<span class="ruby-identifier">b</span>]
50: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,438 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Rack</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Rack</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../files/lib/rack_rb.html">
lib/rack.rb
</a>
<br />
<a href="../files/lib/rack/builder_rb.html">
lib/rack/builder.rb
</a>
<br />
<a href="../files/lib/rack/cascade_rb.html">
lib/rack/cascade.rb
</a>
<br />
<a href="../files/lib/rack/commonlogger_rb.html">
lib/rack/commonlogger.rb
</a>
<br />
<a href="../files/lib/rack/conditionalget_rb.html">
lib/rack/conditionalget.rb
</a>
<br />
<a href="../files/lib/rack/content_length_rb.html">
lib/rack/content_length.rb
</a>
<br />
<a href="../files/lib/rack/deflater_rb.html">
lib/rack/deflater.rb
</a>
<br />
<a href="../files/lib/rack/directory_rb.html">
lib/rack/directory.rb
</a>
<br />
<a href="../files/lib/rack/file_rb.html">
lib/rack/file.rb
</a>
<br />
<a href="../files/lib/rack/forward_rb.html">
lib/rack/forward.rb
</a>
<br />
<a href="../files/lib/rack/handler_rb.html">
lib/rack/handler.rb
</a>
<br />
<a href="../files/lib/rack/head_rb.html">
lib/rack/head.rb
</a>
<br />
<a href="../files/lib/rack/lint_rb.html">
lib/rack/lint.rb
</a>
<br />
<a href="../files/lib/rack/lobster_rb.html">
lib/rack/lobster.rb
</a>
<br />
<a href="../files/lib/rack/methodoverride_rb.html">
lib/rack/methodoverride.rb
</a>
<br />
<a href="../files/lib/rack/mime_rb.html">
lib/rack/mime.rb
</a>
<br />
<a href="../files/lib/rack/mock_rb.html">
lib/rack/mock.rb
</a>
<br />
<a href="../files/lib/rack/recursive_rb.html">
lib/rack/recursive.rb
</a>
<br />
<a href="../files/lib/rack/reloader_rb.html">
lib/rack/reloader.rb
</a>
<br />
<a href="../files/lib/rack/request_rb.html">
lib/rack/request.rb
</a>
<br />
<a href="../files/lib/rack/response_rb.html">
lib/rack/response.rb
</a>
<br />
<a href="../files/lib/rack/showexceptions_rb.html">
lib/rack/showexceptions.rb
</a>
<br />
<a href="../files/lib/rack/showstatus_rb.html">
lib/rack/showstatus.rb
</a>
<br />
<a href="../files/lib/rack/static_rb.html">
lib/rack/static.rb
</a>
<br />
<a href="../files/lib/rack/urlmap_rb.html">
lib/rack/urlmap.rb
</a>
<br />
<a href="../files/lib/rack/utils_rb.html">
lib/rack/utils.rb
</a>
<br />
<a href="../files/lib/rack/adapter/camping_rb.html">
lib/rack/adapter/camping.rb
</a>
<br />
<a href="../files/lib/rack/auth/basic_rb.html">
lib/rack/auth/basic.rb
</a>
<br />
<a href="../files/lib/rack/auth/openid_rb.html">
lib/rack/auth/openid.rb
</a>
<br />
<a href="../files/lib/rack/handler/cgi_rb.html">
lib/rack/handler/cgi.rb
</a>
<br />
<a href="../files/lib/rack/handler/evented_mongrel_rb.html">
lib/rack/handler/evented_mongrel.rb
</a>
<br />
<a href="../files/lib/rack/handler/fastcgi_rb.html">
lib/rack/handler/fastcgi.rb
</a>
<br />
<a href="../files/lib/rack/handler/lsws_rb.html">
lib/rack/handler/lsws.rb
</a>
<br />
<a href="../files/lib/rack/handler/mongrel_rb.html">
lib/rack/handler/mongrel.rb
</a>
<br />
<a href="../files/lib/rack/handler/scgi_rb.html">
lib/rack/handler/scgi.rb
</a>
<br />
<a href="../files/lib/rack/handler/swiftiplied_mongrel_rb.html">
lib/rack/handler/swiftiplied_mongrel.rb
</a>
<br />
<a href="../files/lib/rack/handler/thin_rb.html">
lib/rack/handler/thin.rb
</a>
<br />
<a href="../files/lib/rack/handler/webrick_rb.html">
lib/rack/handler/webrick.rb
</a>
<br />
<a href="../files/lib/rack/session/cookie_rb.html">
lib/rack/session/cookie.rb
</a>
<br />
<a href="../files/lib/rack/session/memcache_rb.html">
lib/rack/session/memcache.rb
</a>
<br />
<a href="../files/lib/rack/session/pool_rb.html">
lib/rack/session/pool.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
require &#8216;cgi&#8216;
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000004">call</a>&nbsp;&nbsp;
<a href="#M000003">release</a>&nbsp;&nbsp;
<a href="#M000002">version</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Module <a href="Rack/Adapter.html" class="link">Rack::Adapter</a><br />
Module <a href="Rack/Auth.html" class="link">Rack::Auth</a><br />
Module <a href="Rack/Handler.html" class="link">Rack::Handler</a><br />
Module <a href="Rack/Mime.html" class="link">Rack::Mime</a><br />
Module <a href="Rack/Session.html" class="link">Rack::Session</a><br />
Module <a href="Rack/Utils.html" class="link">Rack::Utils</a><br />
Class <a href="Rack/Builder.html" class="link">Rack::Builder</a><br />
Class <a href="Rack/Cascade.html" class="link">Rack::Cascade</a><br />
Class <a href="Rack/CommonLogger.html" class="link">Rack::CommonLogger</a><br />
Class <a href="Rack/ConditionalGet.html" class="link">Rack::ConditionalGet</a><br />
Class <a href="Rack/ContentLength.html" class="link">Rack::ContentLength</a><br />
Class <a href="Rack/Deflater.html" class="link">Rack::Deflater</a><br />
Class <a href="Rack/Directory.html" class="link">Rack::Directory</a><br />
Class <a href="Rack/File.html" class="link">Rack::File</a><br />
Class <a href="Rack/ForwardRequest.html" class="link">Rack::ForwardRequest</a><br />
Class <a href="Rack/Forwarder.html" class="link">Rack::Forwarder</a><br />
Class <a href="Rack/Head.html" class="link">Rack::Head</a><br />
Class <a href="Rack/Lint.html" class="link">Rack::Lint</a><br />
Class <a href="Rack/Lobster.html" class="link">Rack::Lobster</a><br />
Class <a href="Rack/MethodOverride.html" class="link">Rack::MethodOverride</a><br />
Class <a href="Rack/MockRequest.html" class="link">Rack::MockRequest</a><br />
Class <a href="Rack/MockResponse.html" class="link">Rack::MockResponse</a><br />
Class <a href="Rack/Recursive.html" class="link">Rack::Recursive</a><br />
Class <a href="Rack/Reloader.html" class="link">Rack::Reloader</a><br />
Class <a href="Rack/Request.html" class="link">Rack::Request</a><br />
Class <a href="Rack/Response.html" class="link">Rack::Response</a><br />
Class <a href="Rack/ShowExceptions.html" class="link">Rack::ShowExceptions</a><br />
Class <a href="Rack/ShowStatus.html" class="link">Rack::ShowStatus</a><br />
Class <a href="Rack/Static.html" class="link">Rack::Static</a><br />
Class <a href="Rack/URLMap.html" class="link">Rack::URLMap</a><br />
</div>
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">VERSION</td>
<td>=</td>
<td class="context-item-value">[0,1]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
The <a href="Rack.html">Rack</a> protocol <a
href="Rack.html#M000002">version</a> number implemented.
</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000003" class="method-detail">
<a name="M000003"></a>
<div class="method-heading">
<a href="#M000003" class="method-signature">
<span class="method-name">release</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p>
Return the <a href="Rack.html">Rack</a> <a
href="Rack.html#M000003">release</a> as a dotted string.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000003-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack.rb, line 25</span>
25: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">release</span>
26: <span class="ruby-value str">&quot;0.9&quot;</span>
27: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000002" class="method-detail">
<a name="M000002"></a>
<div class="method-heading">
<a href="#M000002" class="method-signature">
<span class="method-name">version</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p>
Return the <a href="Rack.html">Rack</a> protocol <a
href="Rack.html#M000002">version</a> as a dotted string.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000002-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack.rb, line 20</span>
20: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">version</span>
21: <span class="ruby-constant">VERSION</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;.&quot;</span>)
22: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000004" class="method-detail">
<a name="M000004"></a>
<div class="method-heading">
<a href="#M000004" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000004-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/lobster.rb, line 32</span>
32: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
33: <span class="ruby-identifier">req</span> = <span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">env</span>)
34: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">req</span>.<span class="ruby-constant">GET</span>[<span class="ruby-value str">&quot;flip&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;left&quot;</span>
35: <span class="ruby-identifier">lobster</span> = <span class="ruby-constant">LobsterString</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;\n&quot;</span>).
36: <span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">ljust</span>(<span class="ruby-value">42</span>).<span class="ruby-identifier">reverse</span> }.
37: <span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;\n&quot;</span>)
38: <span class="ruby-identifier">href</span> = <span class="ruby-value str">&quot;?flip=right&quot;</span>
39: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">req</span>.<span class="ruby-constant">GET</span>[<span class="ruby-value str">&quot;flip&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;crash&quot;</span>
40: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Lobster crashed&quot;</span>
41: <span class="ruby-keyword kw">else</span>
42: <span class="ruby-identifier">lobster</span> = <span class="ruby-constant">LobsterString</span>
43: <span class="ruby-identifier">href</span> = <span class="ruby-value str">&quot;?flip=left&quot;</span>
44: <span class="ruby-keyword kw">end</span>
45:
46: <span class="ruby-identifier">res</span> = <span class="ruby-constant">Response</span>.<span class="ruby-identifier">new</span>
47: <span class="ruby-identifier">res</span>.<span class="ruby-identifier">write</span> <span class="ruby-value str">&quot;&lt;title&gt;Lobstericious!&lt;/title&gt;&quot;</span>
48: <span class="ruby-identifier">res</span>.<span class="ruby-identifier">write</span> <span class="ruby-value str">&quot;&lt;pre&gt;&quot;</span>
49: <span class="ruby-identifier">res</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">lobster</span>
50: <span class="ruby-identifier">res</span>.<span class="ruby-identifier">write</span> <span class="ruby-value str">&quot;&lt;/pre&gt;&quot;</span>
51: <span class="ruby-identifier">res</span>.<span class="ruby-identifier">write</span> <span class="ruby-node">&quot;&lt;p&gt;&lt;a href='#{href}'&gt;flip!&lt;/a&gt;&lt;/p&gt;&quot;</span>
52: <span class="ruby-identifier">res</span>.<span class="ruby-identifier">write</span> <span class="ruby-value str">&quot;&lt;p&gt;&lt;a href='?flip=crash'&gt;crash!&lt;/a&gt;&lt;/p&gt;&quot;</span>
53: <span class="ruby-identifier">res</span>.<span class="ruby-identifier">finish</span>
54: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,130 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Rack::Adapter</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Rack::Adapter</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack_rb.html">
lib/rack.rb
</a>
<br />
<a href="../../files/lib/rack/adapter/camping_rb.html">
lib/rack/adapter/camping.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<b>Adapters</b> connect <a href="../Rack.html">Rack</a> with third party
web frameworks.
</p>
<p>
<a href="../Rack.html">Rack</a> includes an adapter for <a
href="Adapter/Camping.html">Camping</a>, see README for other frameworks
supporting <a href="../Rack.html">Rack</a> in their code bases.
</p>
<p>
Refer to the submodules for framework-specific calling details.
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Class <a href="Adapter/Camping.html" class="link">Rack::Adapter::Camping</a><br />
</div>
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,181 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Adapter::Camping</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Adapter::Camping</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/adapter/camping_rb.html">
lib/rack/adapter/camping.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000006">call</a>&nbsp;&nbsp;
<a href="#M000005">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000005" class="method-detail">
<a name="M000005"></a>
<div class="method-heading">
<a href="#M000005" class="method-signature">
<span class="method-name">new</span><span class="method-args">(app)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000005-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/adapter/camping.rb, line 4</span>
4: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>)
5: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
6: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000006" class="method-detail">
<a name="M000006"></a>
<div class="method-heading">
<a href="#M000006" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000006-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/adapter/camping.rb, line 8</span>
8: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
9: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;PATH_INFO&quot;</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">&quot;&quot;</span>
10: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;SCRIPT_NAME&quot;</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">&quot;&quot;</span>
11: <span class="ruby-identifier">controller</span> = <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">run</span>(<span class="ruby-identifier">env</span>[<span class="ruby-value str">'rack.input'</span>], <span class="ruby-identifier">env</span>)
12: <span class="ruby-identifier">h</span> = <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">headers</span>
13: <span class="ruby-identifier">h</span>.<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
14: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">URI</span>
15: <span class="ruby-identifier">h</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_s</span>
16: <span class="ruby-keyword kw">end</span>
17: <span class="ruby-keyword kw">end</span>
18: [<span class="ruby-identifier">controller</span>.<span class="ruby-identifier">status</span>, <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">headers</span>, [<span class="ruby-identifier">controller</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">to_s</span>]]
19: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,121 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Rack::Auth</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Rack::Auth</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack_rb.html">
lib/rack.rb
</a>
<br />
<a href="../../files/lib/rack/auth/basic_rb.html">
lib/rack/auth/basic.rb
</a>
<br />
<a href="../../files/lib/rack/auth/openid_rb.html">
lib/rack/auth/openid.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Module <a href="Auth/Digest.html" class="link">Rack::Auth::Digest</a><br />
Class <a href="Auth/Basic.html" class="link">Rack::Auth::Basic</a><br />
Class <a href="Auth/OpenID.html" class="link">Rack::Auth::OpenID</a><br />
</div>
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,179 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Auth::Basic</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Auth::Basic</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/auth/basic_rb.html">
lib/rack/auth/basic.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
AbstractHandler
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="Basic.html">Rack::Auth::Basic</a> implements HTTP <a
href="Basic.html">Basic</a> Authentication, as per RFC 2617.
</p>
<p>
Initialize with the <a href="../../Rack.html">Rack</a> application that you
want protecting, and a block that checks if a username and password pair
are valid.
</p>
<p>
See also: <tt>example/protectedlobster.rb</tt>
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000011">call</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Class <a href="Basic/Request.html" class="link">Rack::Auth::Basic::Request</a><br />
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000011" class="method-detail">
<a name="M000011"></a>
<div class="method-heading">
<a href="#M000011" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000011-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/auth/basic.rb, line 15</span>
15: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
16: <span class="ruby-identifier">auth</span> = <span class="ruby-constant">Basic</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">env</span>)
17:
18: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">unauthorized</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">auth</span>.<span class="ruby-identifier">provided?</span>
19:
20: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">bad_request</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">auth</span>.<span class="ruby-identifier">basic?</span>
21:
22: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">valid?</span>(<span class="ruby-identifier">auth</span>)
23: <span class="ruby-identifier">env</span>[<span class="ruby-value str">'REMOTE_USER'</span>] = <span class="ruby-identifier">auth</span>.<span class="ruby-identifier">username</span>
24:
25: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
26: <span class="ruby-keyword kw">end</span>
27:
28: <span class="ruby-identifier">unauthorized</span>
29: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,194 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Auth::Basic::Request</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Auth::Basic::Request</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../../files/lib/rack/auth/basic_rb.html">
lib/rack/auth/basic.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Auth::AbstractRequest
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000012">basic?</a>&nbsp;&nbsp;
<a href="#M000013">credentials</a>&nbsp;&nbsp;
<a href="#M000014">username</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000012" class="method-detail">
<a name="M000012"></a>
<div class="method-heading">
<a href="#M000012" class="method-signature">
<span class="method-name">basic?</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000012-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/auth/basic.rb, line 43</span>
43: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">basic?</span>
44: <span class="ruby-identifier">:basic</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">scheme</span>
45: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000013" class="method-detail">
<a name="M000013"></a>
<div class="method-heading">
<a href="#M000013" class="method-signature">
<span class="method-name">credentials</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000013-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/auth/basic.rb, line 47</span>
47: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">credentials</span>
48: <span class="ruby-ivar">@credentials</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">params</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">&quot;m*&quot;</span>).<span class="ruby-identifier">first</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/:/</span>, <span class="ruby-value">2</span>)
49: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000014" class="method-detail">
<a name="M000014"></a>
<div class="method-heading">
<a href="#M000014" class="method-signature">
<span class="method-name">username</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000014-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/auth/basic.rb, line 51</span>
51: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">username</span>
52: <span class="ruby-identifier">credentials</span>.<span class="ruby-identifier">first</span>
53: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,105 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Rack::Auth::Digest</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Rack::Auth::Digest</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack_rb.html">
lib/rack.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,807 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Auth::OpenID</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Auth::OpenID</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/auth/openid_rb.html">
lib/rack/auth/openid.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
AbstractHandler
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="OpenID.html">Rack::Auth::OpenID</a> provides a simple method for
permitting openid based logins. It requires the ruby-openid library from
janrain to operate, as well as a rack method of session management.
</p>
<p>
The ruby-openid home page is at <a
href="http://openidenabled.com/ruby-openid">openidenabled.com/ruby-openid</a>/.
</p>
<p>
The <a href="OpenID.html">OpenID</a> specifications can be found at <a
href="http://openid.net/specs/openid-authentication-1_1.html">openid.net/specs/openid-authentication-1_1.html</a>
and <a
href="http://openid.net/specs/openid-authentication-2_0.html">openid.net/specs/openid-authentication-2_0.html</a>.
Documentation for published <a href="OpenID.html">OpenID</a> extensions and
related topics can be found at <a
href="http://openid.net/developers/specs">openid.net/developers/specs</a>/.
</p>
<p>
It is recommended to read through the <a href="OpenID.html">OpenID</a>
spec, as well as ruby-openid&#8216;s documentation, to understand what
exactly goes on. However a setup as simple as the presented examples is
enough to provide functionality.
</p>
<p>
This library strongly intends to utilize the <a
href="OpenID.html">OpenID</a> 2.0 features of the ruby-openid library,
while maintaining <a href="OpenID.html">OpenID</a> 1.0 compatiblity.
</p>
<p>
All responses from this rack application will be 303 redirects unless an
error occurs, with the exception of an authentication request requiring an
HTML form submission.
</p>
<p>
NOTE: Extensions are not currently supported by this implimentation of the
<a href="OpenID.html">OpenID</a> rack application due to the complexity of
the current ruby-openid extension handling.
</p>
<p>
NOTE: Due to the amount of data that this library stores in the session, <a
href="../Session/Cookie.html">Rack::Session::Cookie</a> may fault.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000019">add_extension</a>&nbsp;&nbsp;
<a href="#M000016">call</a>&nbsp;&nbsp;
<a href="#M000017">check</a>&nbsp;&nbsp;
<a href="#M000020">extension_namespaces</a>&nbsp;&nbsp;
<a href="#M000018">finish</a>&nbsp;&nbsp;
<a href="#M000015">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Class <a href="OpenID/NoSession.html" class="link">Rack::Auth::OpenID::NoSession</a><br />
</div>
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">OIDStore</td>
<td>=</td>
<td class="context-item-value">::OpenID::Store::Memory.new</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Required for ruby-openid
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">HTML</td>
<td>=</td>
<td class="context-item-value">'&lt;html&gt;&lt;head&gt;&lt;title&gt;%s&lt;/title&gt;&lt;/head&gt;&lt;body&gt;%s&lt;/body&gt;&lt;/html&gt;'</td>
</tr>
</table>
</div>
</div>
<div id="attribute-list">
<h3 class="section-bar">Attributes</h3>
<div class="name-list">
<table>
<tr class="top-aligned-row context-row">
<td class="context-item-name">extensions</td>
<td class="context-item-value">&nbsp;[R]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">options</td>
<td class="context-item-value">&nbsp;[R]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000015" class="method-detail">
<a name="M000015"></a>
<div class="method-heading">
<a href="#M000015" class="method-signature">
<span class="method-name">new</span><span class="method-args">(realm, options={})</span>
</a>
</div>
<div class="method-description">
<p>
A Hash of options is taken as it&#8216;s single initializing argument. For
example:
</p>
<pre>
simple_oid = OpenID.new('http://mysite.com/')
return_oid = OpenID.new('http://mysite.com/', {
:return_to =&gt; 'http://mysite.com/openid'
})
page_oid = OpenID.new('http://mysite.com/',
:login_good =&gt; 'http://mysite.com/auth_good'
)
complex_oid = OpenID.new('http://mysite.com/',
:return_to =&gt; 'http://mysite.com/openid',
:login_good =&gt; 'http://mysite.com/user/preferences',
:auth_fail =&gt; [500, {'Content-Type'=&gt;'text/plain'},
'Unable to negotiate with foreign server.'],
:immediate =&gt; true,
:extensions =&gt; {
::OpenID::SReg =&gt; [['email'],['nickname']]
}
)
</pre>
<h1>Arguments</h1>
<p>
The first argument is the realm, identifying the site they are trusting
with their identity. This is required.
</p>
<p>
NOTE: In <a href="OpenID.html">OpenID</a> 1.x, the realm or trust_root is
optional and the return_to url is required. As this library strives tward
ruby-openid 2.0, and <a href="OpenID.html">OpenID</a> 2.0 compatibiliy, the
realm is required and return_to is optional. However, this implimentation
is still backwards compatible with <a href="OpenID.html">OpenID</a> 1.0
servers.
</p>
<p>
The optional second argument is a hash of options.
</p>
<h2>Options</h2>
<p>
<tt>:return_to</tt> defines the url to return to after the client
authenticates with the openid service provider. This url should point to
where <a href="OpenID.html">Rack::Auth::OpenID</a> is mounted. If
<tt>:return_to</tt> is not provided, :return_to will be the current url
including all query parameters.
</p>
<p>
<tt>:session_key</tt> defines the key to the session hash in the env. It
defaults to &#8216;rack.session&#8217;.
</p>
<p>
<tt>:openid_param</tt> defines at what key in the request parameters to
find the identifier to resolve. As per the 2.0 spec, the default is
&#8216;openid_identifier&#8217;.
</p>
<p>
<tt>:immediate</tt> as true will make immediate type of requests the
default. See <a href="OpenID.html">OpenID</a> specification documentation.
</p>
<h3>URL options</h3>
<p>
<tt>:login_good</tt> is the url to go to after the authentication process
has completed.
</p>
<p>
<tt>:login_fail</tt> is the url to go to after the authentication process
has failed.
</p>
<p>
<tt>:login_quit</tt> is the url to go to after the authentication process
has been cancelled.
</p>
<h3><a href="../Response.html">Response</a> options</h3>
<p>
<tt>:no_session</tt> should be a rack response to be returned if no or an
incompatible session is found.
</p>
<p>
<tt>:auth_fail</tt> should be a rack response to be returned if an
OpenID::DiscoveryFailure occurs. This is typically due to being unable to
access the identity url or identity server.
</p>
<p>
<tt>:error</tt> should be a rack response to return if any other generic
error would occur and <tt>options[:catch_errors]</tt> is true.
</p>
<h3>Extensions</h3>
<p>
<tt>:extensions</tt> should be a hash of openid extension implementations.
The key should be the extension main module, the value should be an array
of arguments for <a
href="../Request.html#M000154">extension::Request.new</a>
</p>
<p>
The hash is iterated over and passed to <a
href="OpenID.html#M000019">add_extension</a> for processing. Please see <a
href="OpenID.html#M000019">add_extension</a> for further documentation.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000015-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/auth/openid.rb, line 137</span>
137: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">realm</span>, <span class="ruby-identifier">options</span>={})
138: <span class="ruby-ivar">@realm</span> = <span class="ruby-identifier">realm</span>
139: <span class="ruby-identifier">realm</span> = <span class="ruby-constant">URI</span>(<span class="ruby-identifier">realm</span>)
140: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">realm</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">empty?</span>
141: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;Invalid realm path: '#{realm.path}'&quot;</span>
142: <span class="ruby-keyword kw">elsif</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">realm</span>.<span class="ruby-identifier">absolute?</span>
143: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;Realm '#{@realm}' not absolute&quot;</span>
144: <span class="ruby-keyword kw">end</span>
145:
146: [<span class="ruby-identifier">:return_to</span>, <span class="ruby-identifier">:login_good</span>, <span class="ruby-identifier">:login_fail</span>, <span class="ruby-identifier">:login_quit</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
147: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">key?</span> <span class="ruby-identifier">key</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">luri</span> = <span class="ruby-constant">URI</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">key</span>])
148: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">luri</span>.<span class="ruby-identifier">absolute?</span>
149: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;:#{key} is not an absolute uri: '#{luri}'&quot;</span>
150: <span class="ruby-keyword kw">end</span>
151: <span class="ruby-keyword kw">end</span>
152: <span class="ruby-keyword kw">end</span>
153:
154: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:return_to</span>] <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">ruri</span> = <span class="ruby-constant">URI</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:return_to</span>])
155: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ruri</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">empty?</span>
156: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;Invalid return_to path: '#{ruri.path}'&quot;</span>
157: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">realm</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">ruri</span>.<span class="ruby-identifier">path</span>[<span class="ruby-value">0</span>, <span class="ruby-identifier">realm</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">size</span>]
158: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">'return_to not within realm.'</span> \
159: <span class="ruby-keyword kw">end</span>
160: <span class="ruby-keyword kw">end</span>
161:
162: <span class="ruby-comment cmt"># TODO: extension support</span>
163: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">extensions</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:extensions</span>)
164: <span class="ruby-identifier">extensions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ext</span>, <span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
165: <span class="ruby-identifier">add_extension</span> <span class="ruby-identifier">ext</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>
166: <span class="ruby-keyword kw">end</span>
167: <span class="ruby-keyword kw">end</span>
168:
169: <span class="ruby-ivar">@options</span> = {
170: <span class="ruby-identifier">:session_key</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'rack.session'</span>,
171: <span class="ruby-identifier">:openid_param</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'openid_identifier'</span>,
172: <span class="ruby-comment cmt">#:return_to, :login_good, :login_fail, :login_quit</span>
173: <span class="ruby-comment cmt">#:no_session, :auth_fail, :error</span>
174: <span class="ruby-identifier">:store</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">OIDStore</span>,
175: <span class="ruby-identifier">:immediate</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>,
176: <span class="ruby-identifier">:anonymous</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>,
177: <span class="ruby-identifier">:catch_errors</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>
178: }.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
179: <span class="ruby-ivar">@extensions</span> = {}
180: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000019" class="method-detail">
<a name="M000019"></a>
<div class="method-heading">
<a href="#M000019" class="method-signature">
<span class="method-name">add_extension</span><span class="method-args">(ext, *args)</span>
</a>
</div>
<div class="method-description">
<p>
The first argument should be the main extension module. The extension
module should contain the constants:
</p>
<pre>
* class Request, with OpenID::Extension as an ancestor
* class Response, with OpenID::Extension as an ancestor
* string NS_URI, which defines the namespace of the extension, should
be an absolute http uri
</pre>
<p>
All trailing arguments will be passed to <a
href="../Request.html#M000154">extension::Request.new</a> in <a
href="OpenID.html#M000017">check</a>. The openid response will be passed to
extension::Response#from_success_response, get_extension_args will be
called on the result to attain the gathered data.
</p>
<p>
This method returns the key at which the response data will be found in the
session, which is the namespace uri by default.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000019-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/auth/openid.rb, line 402</span>
402: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_extension</span> <span class="ruby-identifier">ext</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>
403: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">ext</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Module</span>
404: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">&quot;#{ext.inspect} is not a module&quot;</span>
405: <span class="ruby-keyword kw">elsif</span> <span class="ruby-operator">!</span>(<span class="ruby-identifier">m</span> = <span class="ruby-node">%w'Request Response NS_URI'</span> <span class="ruby-operator">-</span>
406: <span class="ruby-identifier">ext</span>.<span class="ruby-identifier">constants</span>.<span class="ruby-identifier">map</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_s</span> }).<span class="ruby-identifier">empty?</span>
407: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;#{ext.inspect} missing #{m*', '}&quot;</span>
408: <span class="ruby-keyword kw">end</span>
409:
410: <span class="ruby-identifier">consts</span> = [<span class="ruby-identifier">ext</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>, <span class="ruby-identifier">ext</span><span class="ruby-operator">::</span><span class="ruby-constant">Response</span>]
411:
412: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">consts</span>.<span class="ruby-identifier">all?</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Class</span> }
413: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">&quot;#{ext.inspect}'s Request or Response is not a class&quot;</span>
414: <span class="ruby-keyword kw">elsif</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">consts</span>.<span class="ruby-identifier">all?</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-operator">::</span><span class="ruby-constant">OpenID</span><span class="ruby-operator">::</span><span class="ruby-constant">Extension</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">c</span> }
415: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;#{ext.inspect}'s Request or Response not a decendant of OpenID::Extension&quot;</span>
416: <span class="ruby-keyword kw">end</span>
417:
418: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">ext</span><span class="ruby-operator">::</span><span class="ruby-constant">NS_URI</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">String</span>
419: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">&quot;#{ext.inspect}'s NS_URI is not a string&quot;</span>
420: <span class="ruby-keyword kw">elsif</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>(<span class="ruby-identifier">ext</span><span class="ruby-operator">::</span><span class="ruby-constant">NS_URI</span>)
421: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;#{ext.inspect}'s NS_URI is not a valid uri&quot;</span>
422: <span class="ruby-keyword kw">elsif</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^https?$/</span>
423: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;#{ext.inspect}'s NS_URI is not an http uri&quot;</span>
424: <span class="ruby-keyword kw">elsif</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">absolute?</span>
425: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;#{ext.inspect}'s NS_URI is not and absolute uri&quot;</span>
426: <span class="ruby-keyword kw">end</span>
427: <span class="ruby-ivar">@extensions</span>[<span class="ruby-identifier">ext</span>] = <span class="ruby-identifier">args</span>
428: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ext</span><span class="ruby-operator">::</span><span class="ruby-constant">NS_URI</span>
429: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000016" class="method-detail">
<a name="M000016"></a>
<div class="method-heading">
<a href="#M000016" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p>
It sets up and uses session data at <tt>:openid</tt> within the session. It
sets up the ::OpenID::Consumer using the store specified by
<tt>options[:store]</tt>.
</p>
<p>
If the parameter specified by <tt>options[:openid_param]</tt> is present,
processing is passed to <a href="OpenID.html#M000017">check</a> and the
result is returned.
</p>
<p>
If the parameter &#8216;openid.mode&#8217; is set, implying a followup from
the openid server, processing is passed to <a
href="OpenID.html#M000018">finish</a> and the result is returned.
</p>
<p>
If neither of these conditions are met, a 400 error is returned.
</p>
<p>
If an error is thrown and <tt>options[:catch_errors]</tt> is false, the
exception will be reraised. Otherwise a 500 error is returned.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000016-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/auth/openid.rb, line 199</span>
199: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
200: <span class="ruby-identifier">env</span>[<span class="ruby-value str">'rack.auth.openid'</span>] = <span class="ruby-keyword kw">self</span>
201: <span class="ruby-identifier">session</span> = <span class="ruby-identifier">env</span>[<span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:session_key</span>]]
202: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">session</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">session</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Hash</span>
203: <span class="ruby-identifier">raise</span>(<span class="ruby-constant">NoSession</span>, <span class="ruby-value str">'No compatible session'</span>)
204: <span class="ruby-keyword kw">end</span>
205: <span class="ruby-comment cmt"># let us work in our own namespace...</span>
206: <span class="ruby-identifier">session</span> = (<span class="ruby-identifier">session</span>[<span class="ruby-identifier">:openid</span>] <span class="ruby-operator">||=</span> {})
207: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">session</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">session</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Hash</span>
208: <span class="ruby-identifier">raise</span>(<span class="ruby-constant">NoSession</span>, <span class="ruby-value str">'Incompatible session'</span>)
209: <span class="ruby-keyword kw">end</span>
210:
211: <span class="ruby-identifier">request</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">env</span>
212: <span class="ruby-identifier">consumer</span> = <span class="ruby-operator">::</span><span class="ruby-constant">OpenID</span><span class="ruby-operator">::</span><span class="ruby-constant">Consumer</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">session</span>, <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:store</span>]
213:
214: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>[<span class="ruby-value str">'openid.mode'</span>]
215: <span class="ruby-identifier">finish</span> <span class="ruby-identifier">consumer</span>, <span class="ruby-identifier">session</span>, <span class="ruby-identifier">request</span>
216: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>[<span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:openid_param</span>]]
217: <span class="ruby-identifier">check</span> <span class="ruby-identifier">consumer</span>, <span class="ruby-identifier">session</span>, <span class="ruby-identifier">request</span>
218: <span class="ruby-keyword kw">else</span>
219: <span class="ruby-identifier">env</span>[<span class="ruby-value str">'rack.errors'</span>].<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;No valid params provided.&quot;</span>
220: <span class="ruby-identifier">bad_request</span>
221: <span class="ruby-keyword kw">end</span>
222: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">NoSession</span>
223: <span class="ruby-identifier">env</span>[<span class="ruby-value str">'rack.errors'</span>].<span class="ruby-identifier">puts</span>(<span class="ruby-identifier">$!</span>.<span class="ruby-identifier">message</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">$@</span>)
224:
225: <span class="ruby-ivar">@options</span>. <span class="ruby-comment cmt">### Missing or incompatible session</span>
226: <span class="ruby-identifier">fetch</span> <span class="ruby-identifier">:no_session</span>, [ <span class="ruby-value">500</span>,
227: {<span class="ruby-value str">'Content-Type'</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">'text/plain'</span>},
228: <span class="ruby-identifier">$!</span>.<span class="ruby-identifier">message</span> ]
229: <span class="ruby-keyword kw">rescue</span>
230: <span class="ruby-identifier">env</span>[<span class="ruby-value str">'rack.errors'</span>].<span class="ruby-identifier">puts</span>(<span class="ruby-identifier">$!</span>.<span class="ruby-identifier">message</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">$@</span>)
231:
232: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:catch_error</span>]
233: <span class="ruby-identifier">raise</span>(<span class="ruby-identifier">$!</span>)
234: <span class="ruby-keyword kw">end</span>
235: <span class="ruby-ivar">@options</span>.
236: <span class="ruby-identifier">fetch</span> <span class="ruby-identifier">:error</span>, [ <span class="ruby-value">500</span>,
237: {<span class="ruby-value str">'Content-Type'</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">'text/plain'</span>},
238: <span class="ruby-value str">'OpenID has encountered an error.'</span> ]
239: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000017" class="method-detail">
<a name="M000017"></a>
<div class="method-heading">
<a href="#M000017" class="method-signature">
<span class="method-name">check</span><span class="method-args">(consumer, session, req)</span>
</a>
</div>
<div class="method-description">
<p>
As the first part of <a href="OpenID.html">OpenID</a> consumer action, <a
href="OpenID.html#M000017">check</a> retrieves the data required for
completion.
</p>
<ul>
<li><tt>session[:openid][:openid_param]</tt> is set to the submitted identifier
to be authenticated.
</li>
<li><tt>session[:openid][:site_return]</tt> is set as the request&#8216;s
HTTP_REFERER, unless already set.
</li>
<li><tt><a href="http://'rack.auth.openid.request'">env</a></tt> is the openid
checkid request instance.
</li>
</ul>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000017-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/auth/openid.rb, line 250</span>
250: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">check</span>(<span class="ruby-identifier">consumer</span>, <span class="ruby-identifier">session</span>, <span class="ruby-identifier">req</span>)
251: <span class="ruby-identifier">session</span>[<span class="ruby-identifier">:openid_param</span>] = <span class="ruby-identifier">req</span>.<span class="ruby-identifier">params</span>[<span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:openid_param</span>]]
252: <span class="ruby-identifier">oid</span> = <span class="ruby-identifier">consumer</span>.<span class="ruby-identifier">begin</span>(<span class="ruby-identifier">session</span>[<span class="ruby-identifier">:openid_param</span>], <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:anonymous</span>])
253: <span class="ruby-identifier">pp</span> <span class="ruby-identifier">oid</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
254: <span class="ruby-identifier">req</span>.<span class="ruby-identifier">env</span>[<span class="ruby-value str">'rack.auth.openid.request'</span>] = <span class="ruby-identifier">oid</span>
255:
256: <span class="ruby-identifier">session</span>[<span class="ruby-identifier">:site_return</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">req</span>.<span class="ruby-identifier">env</span>[<span class="ruby-value str">'HTTP_REFERER'</span>]
257:
258: <span class="ruby-comment cmt"># SETUP_NEEDED check!</span>
259: <span class="ruby-comment cmt"># see OpenID::Consumer::CheckIDRequest docs</span>
260: <span class="ruby-identifier">query_args</span> = [<span class="ruby-ivar">@realm</span>, <span class="ruby-operator">*</span><span class="ruby-ivar">@options</span>.<span class="ruby-identifier">values_at</span>(<span class="ruby-identifier">:return_to</span>, <span class="ruby-identifier">:immediate</span>)]
261: <span class="ruby-identifier">query_args</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">req</span>.<span class="ruby-identifier">url</span>
262: <span class="ruby-identifier">query_args</span>[<span class="ruby-value">2</span>] = <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">session</span>.<span class="ruby-identifier">key?</span> <span class="ruby-identifier">:setup_needed</span>
263: <span class="ruby-identifier">pp</span> <span class="ruby-identifier">query_args</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
264:
265: <span class="ruby-comment cmt">## Extension support</span>
266: <span class="ruby-identifier">extensions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ext</span>,<span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
267: <span class="ruby-identifier">oid</span>.<span class="ruby-identifier">add_extension</span> <span class="ruby-identifier">ext</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
268: <span class="ruby-keyword kw">end</span>
269:
270: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">oid</span>.<span class="ruby-identifier">send_redirect?</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">query_args</span>)
271: <span class="ruby-identifier">redirect</span> = <span class="ruby-identifier">oid</span>.<span class="ruby-identifier">redirect_url</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">query_args</span>)
272: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
273: <span class="ruby-identifier">pp</span> <span class="ruby-identifier">redirect</span>
274: <span class="ruby-identifier">pp</span> <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span>.<span class="ruby-identifier">parse_query</span>(<span class="ruby-constant">URI</span>(<span class="ruby-identifier">redirect</span>).<span class="ruby-identifier">query</span>)
275: <span class="ruby-keyword kw">end</span>
276: [ <span class="ruby-value">303</span>, {<span class="ruby-value str">'Location'</span>=<span class="ruby-operator">&gt;</span><span class="ruby-identifier">redirect</span>}, [] ]
277: <span class="ruby-keyword kw">else</span>
278: <span class="ruby-comment cmt"># check on 'action' option.</span>
279: <span class="ruby-identifier">formbody</span> = <span class="ruby-identifier">oid</span>.<span class="ruby-identifier">form_markup</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">query_args</span>)
280: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
281: <span class="ruby-identifier">pp</span> <span class="ruby-identifier">formbody</span>
282: <span class="ruby-keyword kw">end</span>
283: <span class="ruby-identifier">body</span> = <span class="ruby-constant">HTML</span> <span class="ruby-operator">%</span> [<span class="ruby-value str">'Confirm...'</span>, <span class="ruby-identifier">formbody</span>]
284: [ <span class="ruby-value">200</span>, {<span class="ruby-value str">'Content-Type'</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">'text/html'</span>}, <span class="ruby-identifier">body</span>.<span class="ruby-identifier">to_a</span> ]
285: <span class="ruby-keyword kw">end</span>
286: <span class="ruby-keyword kw">rescue</span> <span class="ruby-operator">::</span><span class="ruby-constant">OpenID</span><span class="ruby-operator">::</span><span class="ruby-constant">DiscoveryFailure</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
287: <span class="ruby-comment cmt"># thrown from inside OpenID::Consumer#begin by yadis stuff</span>
288: <span class="ruby-identifier">req</span>.<span class="ruby-identifier">env</span>[<span class="ruby-value str">'rack.errors'</span>].<span class="ruby-identifier">puts</span>(<span class="ruby-identifier">$!</span>.<span class="ruby-identifier">message</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">$@</span>)
289:
290: <span class="ruby-ivar">@options</span>. <span class="ruby-comment cmt">### Foreign server failed</span>
291: <span class="ruby-identifier">fetch</span> <span class="ruby-identifier">:auth_fail</span>, [ <span class="ruby-value">503</span>,
292: {<span class="ruby-value str">'Content-Type'</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">'text/plain'</span>},
293: <span class="ruby-value str">'Foreign server failure.'</span> ]
294: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000020" class="method-detail">
<a name="M000020"></a>
<div class="method-heading">
<a href="#M000020" class="method-signature">
<span class="method-name">extension_namespaces</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p>
A conveniance method that returns the namespace of all current extensions
used by this instance.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000020-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/auth/openid.rb, line 433</span>
433: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">extension_namespaces</span>
434: <span class="ruby-ivar">@extensions</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">::</span><span class="ruby-constant">NS_URI</span>}
435: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000018" class="method-detail">
<a name="M000018"></a>
<div class="method-heading">
<a href="#M000018" class="method-signature">
<span class="method-name">finish</span><span class="method-args">(consumer, session, req)</span>
</a>
</div>
<div class="method-description">
<p>
This is the final portion of authentication. Unless any errors outside of
specification occur, a 303 redirect will be returned with Location
determined by the <a href="OpenID.html">OpenID</a> response type. If none
of the response type :login_* urls are set, the redirect will be set to
<tt>session[:openid][:site_return]</tt>. If
<tt>session[:openid][:site_return]</tt> is unset, the realm will be used.
</p>
<p>
Any messages from <a href="OpenID.html">OpenID</a>&#8216;s response are
appended to the 303 response body.
</p>
<p>
Data gathered from extensions are stored in session[:openid] with the
extension&#8216;s namespace uri as the key.
</p>
<ul>
<li><tt><a href="http://'rack.auth.openid.response'">env</a></tt> is the openid
response.
</li>
</ul>
<p>
The four valid possible outcomes are:
</p>
<ul>
<li>failure: <tt>options[:login_fail]</tt> or <tt>session[:site_return]</tt> or
the realm
<ul>
<li><tt>session[:openid]</tt> is cleared and any messages are send to
rack.errors
</li>
<li><tt>session[:openid][&#8216;authenticated&#8217;]</tt> is <tt>false</tt>
</li>
</ul>
</li>
<li>success: <tt>options[:login_good]</tt> or <tt>session[:site_return]</tt> or
the realm
<ul>
<li><tt>session[:openid]</tt> is cleared
</li>
<li><tt>session[:openid][&#8216;authenticated&#8217;]</tt> is <tt>true</tt>
</li>
<li><tt>session[:openid][&#8216;identity&#8217;]</tt> is the actual identifier
</li>
<li><tt>session[:openid][&#8216;identifier&#8217;]</tt> is the pretty
identifier
</li>
</ul>
</li>
<li>cancel: <tt>options[:login_good]</tt> or <tt>session[:site_return]</tt> or
the realm
<ul>
<li><tt>session[:openid]</tt> is cleared
</li>
<li><tt>session[:openid][&#8216;authenticated&#8217;]</tt> is <tt>false</tt>
</li>
</ul>
</li>
<li>setup_needed: resubmits the authentication request. A flag is set for
non-immediate handling.
<ul>
<li><tt>session[:openid][:setup_needed]</tt> is set to <tt>true</tt>, which
will prevent immediate style openid authentication.
</li>
</ul>
</li>
</ul>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000018-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/auth/openid.rb, line 332</span>
332: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">finish</span>(<span class="ruby-identifier">consumer</span>, <span class="ruby-identifier">session</span>, <span class="ruby-identifier">req</span>)
333: <span class="ruby-identifier">oid</span> = <span class="ruby-identifier">consumer</span>.<span class="ruby-identifier">complete</span>(<span class="ruby-identifier">req</span>.<span class="ruby-identifier">params</span>, <span class="ruby-identifier">req</span>.<span class="ruby-identifier">url</span>)
334: <span class="ruby-identifier">pp</span> <span class="ruby-identifier">oid</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
335: <span class="ruby-identifier">req</span>.<span class="ruby-identifier">env</span>[<span class="ruby-value str">'rack.auth.openid.response'</span>] = <span class="ruby-identifier">oid</span>
336:
337: <span class="ruby-identifier">goto</span> = <span class="ruby-identifier">session</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-identifier">:site_return</span>, <span class="ruby-ivar">@realm</span>
338: <span class="ruby-identifier">body</span> = []
339:
340: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">oid</span>.<span class="ruby-identifier">status</span>
341: <span class="ruby-keyword kw">when</span> <span class="ruby-operator">::</span><span class="ruby-constant">OpenID</span><span class="ruby-operator">::</span><span class="ruby-constant">Consumer</span><span class="ruby-operator">::</span><span class="ruby-constant">FAILURE</span>
342: <span class="ruby-identifier">session</span>.<span class="ruby-identifier">clear</span>
343: <span class="ruby-identifier">session</span>[<span class="ruby-value str">'authenticated'</span>] = <span class="ruby-keyword kw">false</span>
344: <span class="ruby-identifier">req</span>.<span class="ruby-identifier">env</span>[<span class="ruby-value str">'rack.errors'</span>].<span class="ruby-identifier">puts</span> <span class="ruby-identifier">oid</span>.<span class="ruby-identifier">message</span>
345:
346: <span class="ruby-identifier">goto</span> = <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:login_fail</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">key?</span> <span class="ruby-identifier">:login_fail</span>
347: <span class="ruby-identifier">body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;Authentication unsuccessful.\n&quot;</span>
348: <span class="ruby-keyword kw">when</span> <span class="ruby-operator">::</span><span class="ruby-constant">OpenID</span><span class="ruby-operator">::</span><span class="ruby-constant">Consumer</span><span class="ruby-operator">::</span><span class="ruby-constant">SUCCESS</span>
349: <span class="ruby-identifier">session</span>.<span class="ruby-identifier">clear</span>
350:
351: <span class="ruby-comment cmt">## Extension support</span>
352: <span class="ruby-identifier">extensions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ext</span>, <span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
353: <span class="ruby-identifier">session</span>[<span class="ruby-identifier">ext</span><span class="ruby-operator">::</span><span class="ruby-constant">NS_URI</span>] = <span class="ruby-identifier">ext</span><span class="ruby-operator">::</span><span class="ruby-constant">Response</span>.
354: <span class="ruby-identifier">from_success_response</span>(<span class="ruby-identifier">oid</span>).
355: <span class="ruby-identifier">get_extension_args</span>
356: <span class="ruby-keyword kw">end</span>
357:
358: <span class="ruby-identifier">session</span>[<span class="ruby-value str">'authenticated'</span>] = <span class="ruby-keyword kw">true</span>
359: <span class="ruby-comment cmt"># Value for unique identification and such</span>
360: <span class="ruby-identifier">session</span>[<span class="ruby-value str">'identity'</span>] = <span class="ruby-identifier">oid</span>.<span class="ruby-identifier">identity_url</span>
361: <span class="ruby-comment cmt"># Value for display and UI labels</span>
362: <span class="ruby-identifier">session</span>[<span class="ruby-value str">'identifier'</span>] = <span class="ruby-identifier">oid</span>.<span class="ruby-identifier">display_identifier</span>
363:
364: <span class="ruby-identifier">goto</span> = <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:login_good</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">key?</span> <span class="ruby-identifier">:login_good</span>
365: <span class="ruby-identifier">body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;Authentication successful.\n&quot;</span>
366: <span class="ruby-keyword kw">when</span> <span class="ruby-operator">::</span><span class="ruby-constant">OpenID</span><span class="ruby-operator">::</span><span class="ruby-constant">Consumer</span><span class="ruby-operator">::</span><span class="ruby-constant">CANCEL</span>
367: <span class="ruby-identifier">session</span>.<span class="ruby-identifier">clear</span>
368: <span class="ruby-identifier">session</span>[<span class="ruby-value str">'authenticated'</span>] = <span class="ruby-keyword kw">false</span>
369:
370: <span class="ruby-identifier">goto</span> = <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:login_fail</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">key?</span> <span class="ruby-identifier">:login_fail</span>
371: <span class="ruby-identifier">body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;Authentication cancelled.\n&quot;</span>
372: <span class="ruby-keyword kw">when</span> <span class="ruby-operator">::</span><span class="ruby-constant">OpenID</span><span class="ruby-operator">::</span><span class="ruby-constant">Consumer</span><span class="ruby-operator">::</span><span class="ruby-constant">SETUP_NEEDED</span>
373: <span class="ruby-identifier">session</span>[<span class="ruby-identifier">:setup_needed</span>] = <span class="ruby-keyword kw">true</span>
374: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">o_id</span> = <span class="ruby-identifier">session</span>[<span class="ruby-identifier">:openid_param</span>]
375: <span class="ruby-identifier">raise</span>(<span class="ruby-value str">'Required values missing.'</span>)
376: <span class="ruby-keyword kw">end</span>
377:
378: <span class="ruby-identifier">goto</span> = <span class="ruby-identifier">req</span>.<span class="ruby-identifier">script_name</span><span class="ruby-operator">+</span>
379: <span class="ruby-value str">'?'</span><span class="ruby-operator">+</span><span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:openid_param</span>]<span class="ruby-operator">+</span>
380: <span class="ruby-value str">'='</span><span class="ruby-operator">+</span><span class="ruby-identifier">o_id</span>
381: <span class="ruby-identifier">body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;Reauthentication required.\n&quot;</span>
382: <span class="ruby-keyword kw">end</span>
383: <span class="ruby-identifier">body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">oid</span>.<span class="ruby-identifier">message</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">oid</span>.<span class="ruby-identifier">message</span>
384: [ <span class="ruby-value">303</span>, {<span class="ruby-value str">'Location'</span>=<span class="ruby-operator">&gt;</span><span class="ruby-identifier">goto</span>}, <span class="ruby-identifier">body</span>]
385: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,111 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Auth::OpenID::NoSession</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Auth::OpenID::NoSession</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../../files/lib/rack/auth/openid_rb.html">
lib/rack/auth/openid.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
RuntimeError
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,340 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Builder</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Builder</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/builder_rb.html">
lib/rack/builder.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="Builder.html">Rack::Builder</a> implements a small DSL to
iteratively construct <a href="../Rack.html">Rack</a> applications.
</p>
<p>
Example:
</p>
<pre>
app = Rack::Builder.new {
use Rack::CommonLogger
use Rack::ShowExceptions
map &quot;/lobster&quot; do
use Rack::Lint
run Rack::Lobster.new
end
}
</pre>
<p>
Or
</p>
<pre>
app = Rack::Builder.app do
use Rack::CommonLogger
lambda { |env| [200, {'Content-Type' =&gt; 'text/plain'}, 'OK'] }
end
</pre>
<p>
<tt><a href="Builder.html#M000127">use</a></tt> adds a middleware to the
stack, <tt><a href="Builder.html#M000128">run</a></tt> dispatches to an
application. You can <a href="Builder.html#M000127">use</a> <tt><a
href="Builder.html#M000129">map</a></tt> to construct a <a
href="URLMap.html">Rack::URLMap</a> in a convenient way.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000126">app</a>&nbsp;&nbsp;
<a href="#M000131">call</a>&nbsp;&nbsp;
<a href="#M000129">map</a>&nbsp;&nbsp;
<a href="#M000125">new</a>&nbsp;&nbsp;
<a href="#M000128">run</a>&nbsp;&nbsp;
<a href="#M000130">to_app</a>&nbsp;&nbsp;
<a href="#M000127">use</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000126" class="method-detail">
<a name="M000126"></a>
<div class="method-heading">
<a href="#M000126" class="method-signature">
<span class="method-name">app</span><span class="method-args">(&amp;block)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000126-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000126-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/builder.rb, line 32</span>
32: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">app</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
33: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>).<span class="ruby-identifier">to_app</span>
34: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000125" class="method-detail">
<a name="M000125"></a>
<div class="method-heading">
<a href="#M000125" class="method-signature">
<span class="method-name">new</span><span class="method-args">(&amp;block)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000125-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000125-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/builder.rb, line 27</span>
27: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
28: <span class="ruby-ivar">@ins</span> = []
29: <span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
30: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000131" class="method-detail">
<a name="M000131"></a>
<div class="method-heading">
<a href="#M000131" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000131-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000131-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/builder.rb, line 63</span>
63: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
64: <span class="ruby-identifier">to_app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
65: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000129" class="method-detail">
<a name="M000129"></a>
<div class="method-heading">
<a href="#M000129" class="method-signature">
<span class="method-name">map</span><span class="method-args">(path, &amp;block)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000129-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000129-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/builder.rb, line 48</span>
48: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">map</span>(<span class="ruby-identifier">path</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
49: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@ins</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Hash</span>
50: <span class="ruby-ivar">@ins</span>.<span class="ruby-identifier">last</span>[<span class="ruby-identifier">path</span>] = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>).<span class="ruby-identifier">to_app</span>
51: <span class="ruby-keyword kw">else</span>
52: <span class="ruby-ivar">@ins</span> <span class="ruby-operator">&lt;&lt;</span> {}
53: <span class="ruby-identifier">map</span>(<span class="ruby-identifier">path</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
54: <span class="ruby-keyword kw">end</span>
55: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000128" class="method-detail">
<a name="M000128"></a>
<div class="method-heading">
<a href="#M000128" class="method-signature">
<span class="method-name">run</span><span class="method-args">(app)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000128-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000128-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/builder.rb, line 44</span>
44: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>(<span class="ruby-identifier">app</span>)
45: <span class="ruby-ivar">@ins</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">app</span> <span class="ruby-comment cmt">#lambda { |nothing| app }</span>
46: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000130" class="method-detail">
<a name="M000130"></a>
<div class="method-heading">
<a href="#M000130" class="method-signature">
<span class="method-name">to_app</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000130-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000130-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/builder.rb, line 57</span>
57: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_app</span>
58: <span class="ruby-ivar">@ins</span>[<span class="ruby-value">-1</span>] = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">URLMap</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@ins</span>.<span class="ruby-identifier">last</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span class="ruby-ivar">@ins</span>.<span class="ruby-identifier">last</span>
59: <span class="ruby-identifier">inner_app</span> = <span class="ruby-ivar">@ins</span>.<span class="ruby-identifier">last</span>
60: <span class="ruby-ivar">@ins</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-value">-1</span>].<span class="ruby-identifier">reverse</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-identifier">inner_app</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span>, <span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">a</span>) }
61: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000127" class="method-detail">
<a name="M000127"></a>
<div class="method-heading">
<a href="#M000127" class="method-signature">
<span class="method-name">use</span><span class="method-args">(middleware, *args, &amp;block)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000127-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000127-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/builder.rb, line 36</span>
36: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">use</span>(<span class="ruby-identifier">middleware</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
37: <span class="ruby-ivar">@ins</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
38: <span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">app</span><span class="ruby-operator">|</span> <span class="ruby-identifier">middleware</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">app</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) }
39: <span class="ruby-keyword kw">else</span>
40: <span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">app</span><span class="ruby-operator">|</span> <span class="ruby-identifier">middleware</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">app</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>) }
41: <span class="ruby-keyword kw">end</span>
42: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,265 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Cascade</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Cascade</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/cascade_rb.html">
lib/rack/cascade.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="Cascade.html">Rack::Cascade</a> tries an request on several apps,
and returns the first response that is not 404 (or in a list of
configurable status codes).
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000202">&lt;&lt;</a>&nbsp;&nbsp;
<a href="#M000200">add</a>&nbsp;&nbsp;
<a href="#M000199">call</a>&nbsp;&nbsp;
<a href="#M000201">include?</a>&nbsp;&nbsp;
<a href="#M000198">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="attribute-list">
<h3 class="section-bar">Attributes</h3>
<div class="name-list">
<table>
<tr class="top-aligned-row context-row">
<td class="context-item-name">apps</td>
<td class="context-item-value">&nbsp;[R]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000198" class="method-detail">
<a name="M000198"></a>
<div class="method-heading">
<a href="#M000198" class="method-signature">
<span class="method-name">new</span><span class="method-args">(apps, catch=404)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000198-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000198-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/cascade.rb, line 9</span>
9: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">apps</span>, <span class="ruby-identifier">catch</span>=<span class="ruby-value">404</span>)
10: <span class="ruby-ivar">@apps</span> = <span class="ruby-identifier">apps</span>
11: <span class="ruby-ivar">@catch</span> = [<span class="ruby-operator">*</span><span class="ruby-identifier">catch</span>]
12: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000202" class="method-detail">
<a name="M000202"></a>
<div class="method-heading">
<span class="method-name">&lt;&lt;</span><span class="method-args">(app)</span>
</div>
<div class="method-description">
<p>
Alias for <a href="Cascade.html#M000200">add</a>
</p>
</div>
</div>
<div id="method-M000200" class="method-detail">
<a name="M000200"></a>
<div class="method-heading">
<a href="#M000200" class="method-signature">
<span class="method-name">add</span><span class="method-args">(app)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000200-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000200-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/cascade.rb, line 26</span>
26: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add</span> <span class="ruby-identifier">app</span>
27: <span class="ruby-ivar">@apps</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">app</span>
28: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000199" class="method-detail">
<a name="M000199"></a>
<div class="method-heading">
<a href="#M000199" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000199-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000199-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/cascade.rb, line 14</span>
14: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
15: <span class="ruby-identifier">status</span> = <span class="ruby-identifier">headers</span> = <span class="ruby-identifier">body</span> = <span class="ruby-keyword kw">nil</span>
16: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;empty cascade&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@apps</span>.<span class="ruby-identifier">empty?</span>
17: <span class="ruby-ivar">@apps</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">app</span><span class="ruby-operator">|</span>
18: <span class="ruby-keyword kw">begin</span>
19: <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span> = <span class="ruby-identifier">app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
20: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@catch</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_i</span>)
21: <span class="ruby-keyword kw">end</span>
22: }
23: [<span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span>]
24: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000201" class="method-detail">
<a name="M000201"></a>
<div class="method-heading">
<a href="#M000201" class="method-signature">
<span class="method-name">include?</span><span class="method-args">(app)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000201-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000201-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/cascade.rb, line 30</span>
30: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">include?</span> <span class="ruby-identifier">app</span>
31: <span class="ruby-ivar">@apps</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">app</span>
32: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,308 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::CommonLogger</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::CommonLogger</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/commonlogger_rb.html">
lib/rack/commonlogger.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="CommonLogger.html">Rack::CommonLogger</a> forwards every request
to an <tt>app</tt> given, and logs a line in the Apache common log format
to the <tt>logger</tt>, or rack.errors by default.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000196">&lt;&lt;</a>&nbsp;&nbsp;
<a href="#M000194">_call</a>&nbsp;&nbsp;
<a href="#M000193">call</a>&nbsp;&nbsp;
<a href="#M000195">close</a>&nbsp;&nbsp;
<a href="#M000197">each</a>&nbsp;&nbsp;
<a href="#M000192">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000192" class="method-detail">
<a name="M000192"></a>
<div class="method-heading">
<a href="#M000192" class="method-signature">
<span class="method-name">new</span><span class="method-args">(app, logger=nil)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000192-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000192-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/commonlogger.rb, line 7</span>
7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>, <span class="ruby-identifier">logger</span>=<span class="ruby-keyword kw">nil</span>)
8: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
9: <span class="ruby-ivar">@logger</span> = <span class="ruby-identifier">logger</span>
10: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000196" class="method-detail">
<a name="M000196"></a>
<div class="method-heading">
<a href="#M000196" class="method-signature">
<span class="method-name">&lt;&lt;</span><span class="method-args">(str)</span>
</a>
</div>
<div class="method-description">
<p>
By default, log to rack.errors.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000196-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000196-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/commonlogger.rb, line 29</span>
29: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;&lt;</span>(<span class="ruby-identifier">str</span>)
30: <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;rack.errors&quot;</span>].<span class="ruby-identifier">write</span>(<span class="ruby-identifier">str</span>)
31: <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;rack.errors&quot;</span>].<span class="ruby-identifier">flush</span>
32: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000194" class="method-detail">
<a name="M000194"></a>
<div class="method-heading">
<a href="#M000194" class="method-signature">
<span class="method-name">_call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000194-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000194-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/commonlogger.rb, line 16</span>
16: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_call</span>(<span class="ruby-identifier">env</span>)
17: <span class="ruby-ivar">@env</span> = <span class="ruby-identifier">env</span>
18: <span class="ruby-ivar">@logger</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">self</span>
19: <span class="ruby-ivar">@time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
20: <span class="ruby-ivar">@status</span>, <span class="ruby-ivar">@header</span>, <span class="ruby-ivar">@body</span> = <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
21: [<span class="ruby-ivar">@status</span>, <span class="ruby-ivar">@header</span>, <span class="ruby-keyword kw">self</span>]
22: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000193" class="method-detail">
<a name="M000193"></a>
<div class="method-heading">
<a href="#M000193" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000193-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000193-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/commonlogger.rb, line 12</span>
12: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
13: <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">_call</span>(<span class="ruby-identifier">env</span>)
14: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000195" class="method-detail">
<a name="M000195"></a>
<div class="method-heading">
<a href="#M000195" class="method-signature">
<span class="method-name">close</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000195-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000195-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/commonlogger.rb, line 24</span>
24: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close</span>
25: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:close</span>
26: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000197" class="method-detail">
<a name="M000197"></a>
<div class="method-heading">
<a href="#M000197" class="method-signature">
<span class="method-name">each</span><span class="method-args">() {|part| ...}</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000197-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000197-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/commonlogger.rb, line 34</span>
34: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each</span>
35: <span class="ruby-identifier">length</span> = <span class="ruby-value">0</span>
36: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">part</span><span class="ruby-operator">|</span>
37: <span class="ruby-identifier">length</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">part</span>.<span class="ruby-identifier">size</span>
38: <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">part</span>
39: }
40:
41: <span class="ruby-ivar">@now</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
42:
43: <span class="ruby-comment cmt"># Common Log Format: http://httpd.apache.org/docs/1.3/logs.html#common</span>
44: <span class="ruby-comment cmt"># lilith.local - - [07/Aug/2006 23:58:02] &quot;GET / HTTP/1.1&quot; 500 -</span>
45: <span class="ruby-comment cmt"># %{%s - %s [%s] &quot;%s %s%s %s&quot; %d %s\n} %</span>
46: <span class="ruby-ivar">@logger</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">%{%s - %s [%s] &quot;%s %s%s %s&quot; %d %s %0.4f\n}</span> <span class="ruby-operator">%</span>
47: [
48: <span class="ruby-ivar">@env</span>[<span class="ruby-value str">'HTTP_X_FORWARDED_FOR'</span>] <span class="ruby-operator">||</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;REMOTE_ADDR&quot;</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;-&quot;</span>,
49: <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;REMOTE_USER&quot;</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;-&quot;</span>,
50: <span class="ruby-ivar">@now</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">&quot;%d/%b/%Y %H:%M:%S&quot;</span>),
51: <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;REQUEST_METHOD&quot;</span>],
52: <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;PATH_INFO&quot;</span>],
53: <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;QUERY_STRING&quot;</span>].<span class="ruby-identifier">empty?</span> <span class="ruby-value">? </span><span class="ruby-value str">&quot;&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;?&quot;</span><span class="ruby-operator">+</span><span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;QUERY_STRING&quot;</span>],
54: <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;HTTP_VERSION&quot;</span>],
55: <span class="ruby-ivar">@status</span>.<span class="ruby-identifier">to_s</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">3</span>],
56: (<span class="ruby-identifier">length</span>.<span class="ruby-identifier">zero?</span> <span class="ruby-value">? </span><span class="ruby-value str">&quot;-&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">length</span>.<span class="ruby-identifier">to_s</span>),
57: <span class="ruby-ivar">@now</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@time</span>
58: ]
59: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,199 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::ConditionalGet</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::ConditionalGet</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/conditionalget_rb.html">
lib/rack/conditionalget.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
Middleware that enables conditional GET using If-None-Match and
If-Modified-Since. The application should set either or both of the
Last-Modified or Etag response headers according to RFC 2616. When either
of the conditions is met, the response body is set to be zero length and
the response status is set to 304 Not Modified.
</p>
<p>
Applications that defer response body generation until the body&#8216;s
each message is received will avoid response body generation completely
when a conditional GET matches.
</p>
<p>
Adapted from Michael Klishin&#8216;s Merb implementation: <a
href="http://github.com/wycats/merb-core/tree/master/lib/merb-core/rack/middleware/conditional_get.rb">github.com/wycats/merb-core/tree/master/lib/merb-core/rack/middleware/conditional_get.rb</a>
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000191">call</a>&nbsp;&nbsp;
<a href="#M000190">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000190" class="method-detail">
<a name="M000190"></a>
<div class="method-heading">
<a href="#M000190" class="method-signature">
<span class="method-name">new</span><span class="method-args">(app)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000190-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000190-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/conditionalget.rb, line 16</span>
16: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>)
17: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
18: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000191" class="method-detail">
<a name="M000191"></a>
<div class="method-heading">
<a href="#M000191" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000191-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000191-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/conditionalget.rb, line 20</span>
20: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
21: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-node">%w[GET HEAD]</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">env</span>[<span class="ruby-value str">'REQUEST_METHOD'</span>])
22:
23: <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span> = <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
24: <span class="ruby-identifier">headers</span> = <span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">HeaderHash</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">headers</span>)
25: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">etag_matches?</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">headers</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">modified_since?</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">headers</span>)
26: <span class="ruby-identifier">status</span> = <span class="ruby-value">304</span>
27: <span class="ruby-identifier">body</span> = []
28: <span class="ruby-keyword kw">end</span>
29: [<span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span>]
30: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,191 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::ContentLength</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::ContentLength</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/content_length_rb.html">
lib/rack/content_length.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
Sets the Content-Length header on responses with fixed-length bodies.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000081">call</a>&nbsp;&nbsp;
<a href="#M000080">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000080" class="method-detail">
<a name="M000080"></a>
<div class="method-heading">
<a href="#M000080" class="method-signature">
<span class="method-name">new</span><span class="method-args">(app)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000080-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000080-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/content_length.rb, line 4</span>
4: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>)
5: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
6: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000081" class="method-detail">
<a name="M000081"></a>
<div class="method-heading">
<a href="#M000081" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000081-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000081-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/content_length.rb, line 8</span>
8: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
9: <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span> = <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
10: <span class="ruby-identifier">headers</span> = <span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">HeaderHash</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">headers</span>)
11:
12: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">STATUS_WITH_NO_ENTITY_BODY</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">status</span>) <span class="ruby-operator">&amp;&amp;</span>
13: <span class="ruby-operator">!</span><span class="ruby-identifier">headers</span>[<span class="ruby-value str">'Content-Length'</span>] <span class="ruby-operator">&amp;&amp;</span>
14: <span class="ruby-operator">!</span><span class="ruby-identifier">headers</span>[<span class="ruby-value str">'Transfer-Encoding'</span>] <span class="ruby-operator">&amp;&amp;</span>
15: (<span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_ary</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_str</span>))
16:
17: <span class="ruby-identifier">body</span> = [<span class="ruby-identifier">body</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_str</span>) <span class="ruby-comment cmt"># rack 0.4 compat</span>
18: <span class="ruby-identifier">length</span> = <span class="ruby-identifier">body</span>.<span class="ruby-identifier">to_ary</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">len</span>, <span class="ruby-identifier">part</span><span class="ruby-operator">|</span> <span class="ruby-identifier">len</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">part</span>.<span class="ruby-identifier">length</span> }
19: <span class="ruby-identifier">headers</span>[<span class="ruby-value str">'Content-Length'</span>] = <span class="ruby-identifier">length</span>.<span class="ruby-identifier">to_s</span>
20: <span class="ruby-keyword kw">end</span>
21:
22: [<span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span>]
23: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,289 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Deflater</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Deflater</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/deflater_rb.html">
lib/rack/deflater.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000151">call</a>&nbsp;&nbsp;
<a href="#M000153">deflate</a>&nbsp;&nbsp;
<a href="#M000152">gzip</a>&nbsp;&nbsp;
<a href="#M000150">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">DEFLATE_ARGS</td>
<td>=</td>
<td class="context-item-value">[ Zlib::DEFAULT_COMPRESSION, # drop the zlib header which causes both Safari and IE to choke -Zlib::MAX_WBITS, Zlib::DEF_MEM_LEVEL, Zlib::DEFAULT_STRATEGY</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000153" class="method-detail">
<a name="M000153"></a>
<div class="method-heading">
<a href="#M000153" class="method-signature">
<span class="method-name">deflate</span><span class="method-args">(body)</span>
</a>
</div>
<div class="method-description">
<p>
Loosely based on Mongrel&#8216;s Deflate handler
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000153-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000153-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/deflater.rb, line 77</span>
77: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">deflate</span>(<span class="ruby-identifier">body</span>)
78: <span class="ruby-identifier">deflater</span> = <span class="ruby-constant">Zlib</span><span class="ruby-operator">::</span><span class="ruby-constant">Deflate</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-constant">DEFLATE_ARGS</span>)
79:
80: <span class="ruby-comment cmt"># TODO: Add streaming</span>
81: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">part</span><span class="ruby-operator">|</span> <span class="ruby-identifier">deflater</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">part</span> }
82:
83: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">deflater</span>.<span class="ruby-identifier">finish</span>
84: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000152" class="method-detail">
<a name="M000152"></a>
<div class="method-heading">
<a href="#M000152" class="method-signature">
<span class="method-name">gzip</span><span class="method-args">(body, mtime)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000152-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000152-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/deflater.rb, line 56</span>
56: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gzip</span>(<span class="ruby-identifier">body</span>, <span class="ruby-identifier">mtime</span>)
57: <span class="ruby-identifier">io</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
58: <span class="ruby-identifier">gzip</span> = <span class="ruby-constant">Zlib</span><span class="ruby-operator">::</span><span class="ruby-constant">GzipWriter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">io</span>)
59: <span class="ruby-identifier">gzip</span>.<span class="ruby-identifier">mtime</span> = <span class="ruby-identifier">mtime</span>
60:
61: <span class="ruby-comment cmt"># TODO: Add streaming</span>
62: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">part</span><span class="ruby-operator">|</span> <span class="ruby-identifier">gzip</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">part</span> }
63:
64: <span class="ruby-identifier">gzip</span>.<span class="ruby-identifier">close</span>
65: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">io</span>.<span class="ruby-identifier">string</span>
66: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000150" class="method-detail">
<a name="M000150"></a>
<div class="method-heading">
<a href="#M000150" class="method-signature">
<span class="method-name">new</span><span class="method-args">(app)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000150-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000150-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/deflater.rb, line 8</span>
8: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>)
9: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
10: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000151" class="method-detail">
<a name="M000151"></a>
<div class="method-heading">
<a href="#M000151" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000151-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000151-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/deflater.rb, line 12</span>
12: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
13: <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span> = <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
14: <span class="ruby-identifier">headers</span> = <span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">HeaderHash</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">headers</span>)
15:
16: <span class="ruby-comment cmt"># Skip compressing empty entity body responses and responses with</span>
17: <span class="ruby-comment cmt"># no-transform set.</span>
18: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">STATUS_WITH_NO_ENTITY_BODY</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">status</span>) <span class="ruby-operator">||</span>
19: <span class="ruby-identifier">headers</span>[<span class="ruby-value str">'Cache-Control'</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\bno-transform\b/</span>
20: <span class="ruby-keyword kw">return</span> [<span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span>]
21: <span class="ruby-keyword kw">end</span>
22:
23: <span class="ruby-identifier">request</span> = <span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">env</span>)
24:
25: <span class="ruby-identifier">encoding</span> = <span class="ruby-constant">Utils</span>.<span class="ruby-identifier">select_best_encoding</span>(<span class="ruby-node">%w(gzip deflate identity)</span>,
26: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">accept_encoding</span>)
27:
28: <span class="ruby-comment cmt"># Set the Vary HTTP header.</span>
29: <span class="ruby-identifier">vary</span> = <span class="ruby-identifier">headers</span>[<span class="ruby-value str">&quot;Vary&quot;</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;,&quot;</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">strip</span> }
30: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">vary</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">&quot;*&quot;</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">vary</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">&quot;Accept-Encoding&quot;</span>)
31: <span class="ruby-identifier">headers</span>[<span class="ruby-value str">&quot;Vary&quot;</span>] = <span class="ruby-identifier">vary</span>.<span class="ruby-identifier">push</span>(<span class="ruby-value str">&quot;Accept-Encoding&quot;</span>).<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;,&quot;</span>)
32: <span class="ruby-keyword kw">end</span>
33:
34: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">encoding</span>
35: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;gzip&quot;</span>
36: <span class="ruby-identifier">mtime</span> = <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">headers</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">&quot;Last-Modified&quot;</span>)
37: <span class="ruby-constant">Time</span>.<span class="ruby-identifier">httpdate</span>(<span class="ruby-identifier">headers</span>[<span class="ruby-value str">&quot;Last-Modified&quot;</span>])
38: <span class="ruby-keyword kw">else</span>
39: <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
40: <span class="ruby-keyword kw">end</span>
41: [<span class="ruby-identifier">status</span>,
42: <span class="ruby-identifier">headers</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-value str">&quot;Content-Encoding&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;gzip&quot;</span>),
43: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">gzip</span>(<span class="ruby-identifier">body</span>, <span class="ruby-identifier">mtime</span>)]
44: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;deflate&quot;</span>
45: [<span class="ruby-identifier">status</span>,
46: <span class="ruby-identifier">headers</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-value str">&quot;Content-Encoding&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;deflate&quot;</span>),
47: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">deflate</span>(<span class="ruby-identifier">body</span>)]
48: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;identity&quot;</span>
49: [<span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span>]
50: <span class="ruby-keyword kw">when</span> <span class="ruby-keyword kw">nil</span>
51: <span class="ruby-identifier">message</span> = [<span class="ruby-node">&quot;An acceptable encoding for the requested resource #{request.fullpath} could not be found.&quot;</span>]
52: [<span class="ruby-value">406</span>, {<span class="ruby-value str">&quot;Content-Type&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;text/plain&quot;</span>}, <span class="ruby-identifier">message</span>]
53: <span class="ruby-keyword kw">end</span>
54: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,493 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Directory</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Directory</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/directory_rb.html">
lib/rack/directory.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="Directory.html">Rack::Directory</a> serves entries below the
<tt>root</tt> given, according to the path info of the <a
href="../Rack.html">Rack</a> request. If a directory is found, the
file&#8216;s contents will be presented in an html based index. If a file
is found, the env will be passed to the specified <tt>app</tt>.
</p>
<p>
If <tt>app</tt> is not specified, a <a href="File.html">Rack::File</a> of
the same <tt>root</tt> will be used.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000137">_call</a>&nbsp;&nbsp;
<a href="#M000136">call</a>&nbsp;&nbsp;
<a href="#M000138">check_forbidden</a>&nbsp;&nbsp;
<a href="#M000143">each</a>&nbsp;&nbsp;
<a href="#M000142">entity_not_found</a>&nbsp;&nbsp;
<a href="#M000144">filesize_format</a>&nbsp;&nbsp;
<a href="#M000139">list_directory</a>&nbsp;&nbsp;
<a href="#M000141">list_path</a>&nbsp;&nbsp;
<a href="#M000135">new</a>&nbsp;&nbsp;
<a href="#M000140">stat</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">DIR_FILE</td>
<td>=</td>
<td class="context-item-value">&quot;&lt;tr&gt;&lt;td class='name'&gt;&lt;a href='%s'&gt;%s&lt;/a&gt;&lt;/td&gt;&lt;td class='size'&gt;%s&lt;/td&gt;&lt;td class='type'&gt;%s&lt;/td&gt;&lt;td class='mtime'&gt;%s&lt;/td&gt;&lt;/tr&gt;&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DIR_PAGE</td>
<td>=</td>
<td class="context-item-value">&lt;&lt;-PAGE &lt;html&gt;&lt;head&gt; &lt;title&gt;%s&lt;/title&gt; &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt; &lt;style type='text/css'&gt; table { width:100%%; } .name { text-align:left; } .size, .mtime { text-align:right; } .type { width:11em; } .mtime { width:15em; } &lt;/style&gt; &lt;/head&gt;&lt;body&gt; &lt;h1&gt;%s&lt;/h1&gt; &lt;hr /&gt; &lt;table&gt; &lt;tr&gt; &lt;th class='name'&gt;Name&lt;/th&gt; &lt;th class='size'&gt;Size&lt;/th&gt; &lt;th class='type'&gt;Type&lt;/th&gt; &lt;th class='mtime'&gt;Last Modified&lt;/th&gt; &lt;/tr&gt; %s &lt;/table&gt; &lt;hr /&gt; &lt;/body&gt;&lt;/html&gt; PAGE</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">F</td>
<td>=</td>
<td class="context-item-value">::File</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">FILESIZE_FORMAT</td>
<td>=</td>
<td class="context-item-value">[ ['%.1fT', 1 &lt;&lt; 40], ['%.1fG', 1 &lt;&lt; 30], ['%.1fM', 1 &lt;&lt; 20], ['%.1fK', 1 &lt;&lt; 10], ]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Stolen from Ramaze
</td>
</tr>
</table>
</div>
</div>
<div id="attribute-list">
<h3 class="section-bar">Attributes</h3>
<div class="name-list">
<table>
<tr class="top-aligned-row context-row">
<td class="context-item-name">files</td>
<td class="context-item-value">&nbsp;[R]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">path</td>
<td class="context-item-value">&nbsp;[RW]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">root</td>
<td class="context-item-value">&nbsp;[RW]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000135" class="method-detail">
<a name="M000135"></a>
<div class="method-heading">
<a href="#M000135" class="method-signature">
<span class="method-name">new</span><span class="method-args">(root, app=nil)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000135-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000135-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/directory.rb, line 45</span>
45: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">root</span>, <span class="ruby-identifier">app</span>=<span class="ruby-keyword kw">nil</span>)
46: <span class="ruby-ivar">@root</span> = <span class="ruby-constant">F</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">root</span>)
47: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span> <span class="ruby-operator">||</span> <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@root</span>)
48: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000137" class="method-detail">
<a name="M000137"></a>
<div class="method-heading">
<a href="#M000137" class="method-signature">
<span class="method-name">_call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000137-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000137-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/directory.rb, line 56</span>
56: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_call</span>(<span class="ruby-identifier">env</span>)
57: <span class="ruby-ivar">@env</span> = <span class="ruby-identifier">env</span>
58: <span class="ruby-ivar">@script_name</span> = <span class="ruby-identifier">env</span>[<span class="ruby-value str">'SCRIPT_NAME'</span>]
59: <span class="ruby-ivar">@path_info</span> = <span class="ruby-constant">Utils</span>.<span class="ruby-identifier">unescape</span>(<span class="ruby-identifier">env</span>[<span class="ruby-value str">'PATH_INFO'</span>])
60:
61: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">forbidden</span> = <span class="ruby-identifier">check_forbidden</span>
62: <span class="ruby-identifier">forbidden</span>
63: <span class="ruby-keyword kw">else</span>
64: <span class="ruby-ivar">@path</span> = <span class="ruby-constant">F</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@root</span>, <span class="ruby-ivar">@path_info</span>)
65: <span class="ruby-identifier">list_path</span>
66: <span class="ruby-keyword kw">end</span>
67: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000136" class="method-detail">
<a name="M000136"></a>
<div class="method-heading">
<a href="#M000136" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000136-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000136-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/directory.rb, line 50</span>
50: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
51: <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">_call</span>(<span class="ruby-identifier">env</span>)
52: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000138" class="method-detail">
<a name="M000138"></a>
<div class="method-heading">
<a href="#M000138" class="method-signature">
<span class="method-name">check_forbidden</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000138-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000138-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/directory.rb, line 69</span>
69: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">check_forbidden</span>
70: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@path_info</span>.<span class="ruby-identifier">include?</span> <span class="ruby-value str">&quot;..&quot;</span>
71:
72: <span class="ruby-identifier">body</span> = <span class="ruby-value str">&quot;Forbidden\n&quot;</span>
73: <span class="ruby-identifier">size</span> = <span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:bytesize</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">bytesize</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">size</span>
74: <span class="ruby-keyword kw">return</span> [<span class="ruby-value">403</span>, {<span class="ruby-value str">&quot;Content-Type&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;text/plain&quot;</span>,<span class="ruby-value str">&quot;Content-Length&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">size</span>.<span class="ruby-identifier">to_s</span>}, [<span class="ruby-identifier">body</span>]]
75: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000143" class="method-detail">
<a name="M000143"></a>
<div class="method-heading">
<a href="#M000143" class="method-signature">
<span class="method-name">each</span><span class="method-args">() {|l| ...}</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000143-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000143-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/directory.rb, line 127</span>
127: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each</span>
128: <span class="ruby-identifier">show_path</span> = <span class="ruby-ivar">@path</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-node">/^#{@root}/</span>,<span class="ruby-value str">''</span>)
129: <span class="ruby-identifier">files</span> = <span class="ruby-ivar">@files</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-constant">DIR_FILE</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">f</span> }<span class="ruby-operator">*</span><span class="ruby-value str">&quot;\n&quot;</span>
130: <span class="ruby-identifier">page</span> = <span class="ruby-constant">DIR_PAGE</span> <span class="ruby-operator">%</span> [ <span class="ruby-identifier">show_path</span>, <span class="ruby-identifier">show_path</span> , <span class="ruby-identifier">files</span> ]
131: <span class="ruby-identifier">page</span>.<span class="ruby-identifier">each_line</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">l</span> }
132: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000142" class="method-detail">
<a name="M000142"></a>
<div class="method-heading">
<a href="#M000142" class="method-signature">
<span class="method-name">entity_not_found</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000142-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000142-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/directory.rb, line 121</span>
121: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">entity_not_found</span>
122: <span class="ruby-identifier">body</span> = <span class="ruby-node">&quot;Entity not found: #{@path_info}\n&quot;</span>
123: <span class="ruby-identifier">size</span> = <span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:bytesize</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">bytesize</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">size</span>
124: <span class="ruby-keyword kw">return</span> [<span class="ruby-value">404</span>, {<span class="ruby-value str">&quot;Content-Type&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;text/plain&quot;</span>, <span class="ruby-value str">&quot;Content-Length&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">size</span>.<span class="ruby-identifier">to_s</span>}, [<span class="ruby-identifier">body</span>]]
125: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000144" class="method-detail">
<a name="M000144"></a>
<div class="method-heading">
<a href="#M000144" class="method-signature">
<span class="method-name">filesize_format</span><span class="method-args">(int)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000144-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000144-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/directory.rb, line 143</span>
143: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">filesize_format</span>(<span class="ruby-identifier">int</span>)
144: <span class="ruby-constant">FILESIZE_FORMAT</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">format</span>, <span class="ruby-identifier">size</span><span class="ruby-operator">|</span>
145: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">format</span> <span class="ruby-operator">%</span> (<span class="ruby-identifier">int</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">size</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">int</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">size</span>
146: <span class="ruby-keyword kw">end</span>
147:
148: <span class="ruby-identifier">int</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'B'</span>
149: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000139" class="method-detail">
<a name="M000139"></a>
<div class="method-heading">
<a href="#M000139" class="method-signature">
<span class="method-name">list_directory</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000139-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000139-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/directory.rb, line 77</span>
77: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">list_directory</span>
78: <span class="ruby-ivar">@files</span> = [[<span class="ruby-value str">'../'</span>,<span class="ruby-value str">'Parent Directory'</span>,<span class="ruby-value str">''</span>,<span class="ruby-value str">''</span>,<span class="ruby-value str">''</span>]]
79: <span class="ruby-identifier">glob</span> = <span class="ruby-constant">F</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@path</span>, <span class="ruby-value str">'*'</span>)
80:
81: <span class="ruby-constant">Dir</span>[<span class="ruby-identifier">glob</span>].<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">node</span><span class="ruby-operator">|</span>
82: <span class="ruby-identifier">stat</span> = <span class="ruby-identifier">stat</span>(<span class="ruby-identifier">node</span>)
83: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">stat</span>
84: <span class="ruby-identifier">basename</span> = <span class="ruby-constant">F</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">node</span>)
85: <span class="ruby-identifier">ext</span> = <span class="ruby-constant">F</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-identifier">node</span>)
86:
87: <span class="ruby-identifier">url</span> = <span class="ruby-constant">F</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@script_name</span>, <span class="ruby-ivar">@path_info</span>, <span class="ruby-identifier">basename</span>)
88: <span class="ruby-identifier">size</span> = <span class="ruby-identifier">stat</span>.<span class="ruby-identifier">size</span>
89: <span class="ruby-identifier">type</span> = <span class="ruby-identifier">stat</span>.<span class="ruby-identifier">directory?</span> <span class="ruby-value">? </span><span class="ruby-value str">'directory'</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Mime</span>.<span class="ruby-identifier">mime_type</span>(<span class="ruby-identifier">ext</span>)
90: <span class="ruby-identifier">size</span> = <span class="ruby-identifier">stat</span>.<span class="ruby-identifier">directory?</span> <span class="ruby-value">? </span><span class="ruby-value str">'-'</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">filesize_format</span>(<span class="ruby-identifier">size</span>)
91: <span class="ruby-identifier">mtime</span> = <span class="ruby-identifier">stat</span>.<span class="ruby-identifier">mtime</span>.<span class="ruby-identifier">httpdate</span>
92:
93: <span class="ruby-ivar">@files</span> <span class="ruby-operator">&lt;&lt;</span> [ <span class="ruby-identifier">url</span>, <span class="ruby-identifier">basename</span>, <span class="ruby-identifier">size</span>, <span class="ruby-identifier">type</span>, <span class="ruby-identifier">mtime</span> ]
94: <span class="ruby-keyword kw">end</span>
95:
96: <span class="ruby-keyword kw">return</span> [ <span class="ruby-value">200</span>, {<span class="ruby-value str">'Content-Type'</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">'text/html; charset=utf-8'</span>}, <span class="ruby-keyword kw">self</span> ]
97: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000141" class="method-detail">
<a name="M000141"></a>
<div class="method-heading">
<a href="#M000141" class="method-signature">
<span class="method-name">list_path</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p>
TODO: add correct response if not readable, not sure if 404 is the best
</p>
<pre>
option
</pre>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000141-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000141-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/directory.rb, line 107</span>
107: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">list_path</span>
108: <span class="ruby-ivar">@stat</span> = <span class="ruby-constant">F</span>.<span class="ruby-identifier">stat</span>(<span class="ruby-ivar">@path</span>)
109:
110: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@stat</span>.<span class="ruby-identifier">readable?</span>
111: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-ivar">@env</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@stat</span>.<span class="ruby-identifier">file?</span>
112: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">list_directory</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@stat</span>.<span class="ruby-identifier">directory?</span>
113: <span class="ruby-keyword kw">else</span>
114: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>, <span class="ruby-value str">'No such file or directory'</span>
115: <span class="ruby-keyword kw">end</span>
116:
117: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>, <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ELOOP</span>
118: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">entity_not_found</span>
119: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000140" class="method-detail">
<a name="M000140"></a>
<div class="method-heading">
<a href="#M000140" class="method-signature">
<span class="method-name">stat</span><span class="method-args">(node, max = 10)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000140-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000140-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/directory.rb, line 99</span>
99: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stat</span>(<span class="ruby-identifier">node</span>, <span class="ruby-identifier">max</span> = <span class="ruby-value">10</span>)
100: <span class="ruby-constant">F</span>.<span class="ruby-identifier">stat</span>(<span class="ruby-identifier">node</span>)
101: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>, <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ELOOP</span>
102: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
103: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,378 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::File</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::File</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/file_rb.html">
lib/rack/file.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="File.html">Rack::File</a> serves files below the <tt>root</tt>
given, according to the path info of the <a href="../Rack.html">Rack</a>
request.
</p>
<p>
Handlers can detect if bodies are a <a href="File.html">Rack::File</a>, and
use mechanisms like sendfile on the <tt>path</tt>.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000206">_call</a>&nbsp;&nbsp;
<a href="#M000205">call</a>&nbsp;&nbsp;
<a href="#M000210">each</a>&nbsp;&nbsp;
<a href="#M000207">forbidden</a>&nbsp;&nbsp;
<a href="#M000204">new</a>&nbsp;&nbsp;
<a href="#M000209">not_found</a>&nbsp;&nbsp;
<a href="#M000208">serving</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">F</td>
<td>=</td>
<td class="context-item-value">::File</td>
</tr>
</table>
</div>
</div>
<div id="attribute-list">
<h3 class="section-bar">Attributes</h3>
<div class="name-list">
<table>
<tr class="top-aligned-row context-row">
<td class="context-item-name">path</td>
<td class="context-item-value">&nbsp;[RW]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">root</td>
<td class="context-item-value">&nbsp;[RW]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000204" class="method-detail">
<a name="M000204"></a>
<div class="method-heading">
<a href="#M000204" class="method-signature">
<span class="method-name">new</span><span class="method-args">(root)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000204-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000204-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/file.rb, line 15</span>
15: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">root</span>)
16: <span class="ruby-ivar">@root</span> = <span class="ruby-identifier">root</span>
17: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000206" class="method-detail">
<a name="M000206"></a>
<div class="method-heading">
<a href="#M000206" class="method-signature">
<span class="method-name">_call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000206-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000206-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/file.rb, line 25</span>
25: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_call</span>(<span class="ruby-identifier">env</span>)
26: <span class="ruby-ivar">@path_info</span> = <span class="ruby-constant">Utils</span>.<span class="ruby-identifier">unescape</span>(<span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;PATH_INFO&quot;</span>])
27: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">forbidden</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@path_info</span>.<span class="ruby-identifier">include?</span> <span class="ruby-value str">&quot;..&quot;</span>
28:
29: <span class="ruby-ivar">@path</span> = <span class="ruby-constant">F</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@root</span>, <span class="ruby-ivar">@path_info</span>)
30:
31: <span class="ruby-keyword kw">begin</span>
32: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">F</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-ivar">@path</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">F</span>.<span class="ruby-identifier">readable?</span>(<span class="ruby-ivar">@path</span>)
33: <span class="ruby-identifier">serving</span>
34: <span class="ruby-keyword kw">else</span>
35: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EPERM</span>
36: <span class="ruby-keyword kw">end</span>
37: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">SystemCallError</span>
38: <span class="ruby-identifier">not_found</span>
39: <span class="ruby-keyword kw">end</span>
40: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000205" class="method-detail">
<a name="M000205"></a>
<div class="method-heading">
<a href="#M000205" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000205-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000205-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/file.rb, line 19</span>
19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
20: <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">_call</span>(<span class="ruby-identifier">env</span>)
21: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000210" class="method-detail">
<a name="M000210"></a>
<div class="method-heading">
<a href="#M000210" class="method-signature">
<span class="method-name">each</span><span class="method-args">() {|part| ...}</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000210-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000210-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/file.rb, line 77</span>
77: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each</span>
78: <span class="ruby-constant">F</span>.<span class="ruby-identifier">open</span>(<span class="ruby-ivar">@path</span>, <span class="ruby-value str">&quot;rb&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
79: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">part</span> = <span class="ruby-identifier">file</span>.<span class="ruby-identifier">read</span>(<span class="ruby-value">8192</span>)
80: <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">part</span>
81: <span class="ruby-keyword kw">end</span>
82: }
83: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000207" class="method-detail">
<a name="M000207"></a>
<div class="method-heading">
<a href="#M000207" class="method-signature">
<span class="method-name">forbidden</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000207-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000207-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/file.rb, line 42</span>
42: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">forbidden</span>
43: <span class="ruby-identifier">body</span> = <span class="ruby-value str">&quot;Forbidden\n&quot;</span>
44: [<span class="ruby-value">403</span>, {<span class="ruby-value str">&quot;Content-Type&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;text/plain&quot;</span>,
45: <span class="ruby-value str">&quot;Content-Length&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">size</span>.<span class="ruby-identifier">to_s</span>},
46: [<span class="ruby-identifier">body</span>]]
47: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000209" class="method-detail">
<a name="M000209"></a>
<div class="method-heading">
<a href="#M000209" class="method-signature">
<span class="method-name">not_found</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000209-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000209-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/file.rb, line 70</span>
70: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">not_found</span>
71: <span class="ruby-identifier">body</span> = <span class="ruby-node">&quot;File not found: #{@path_info}\n&quot;</span>
72: [<span class="ruby-value">404</span>, {<span class="ruby-value str">&quot;Content-Type&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;text/plain&quot;</span>,
73: <span class="ruby-value str">&quot;Content-Length&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">size</span>.<span class="ruby-identifier">to_s</span>},
74: [<span class="ruby-identifier">body</span>]]
75: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000208" class="method-detail">
<a name="M000208"></a>
<div class="method-heading">
<a href="#M000208" class="method-signature">
<span class="method-name">serving</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p>
NOTE:
</p>
<pre>
We check via File::size? whether this file provides size info
via stat (e.g. /proc files often don't), otherwise we have to
figure it out by reading the whole file into memory. And while
we're at it we also use this as body then.
</pre>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000208-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000208-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/file.rb, line 55</span>
55: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">serving</span>
56: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">size</span> = <span class="ruby-constant">F</span>.<span class="ruby-identifier">size?</span>(<span class="ruby-ivar">@path</span>)
57: <span class="ruby-identifier">body</span> = <span class="ruby-keyword kw">self</span>
58: <span class="ruby-keyword kw">else</span>
59: <span class="ruby-identifier">body</span> = [<span class="ruby-constant">F</span>.<span class="ruby-identifier">read</span>(<span class="ruby-ivar">@path</span>)]
60: <span class="ruby-identifier">size</span> = <span class="ruby-identifier">body</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">size</span>
61: <span class="ruby-keyword kw">end</span>
62:
63: [<span class="ruby-value">200</span>, {
64: <span class="ruby-value str">&quot;Last-Modified&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">F</span>.<span class="ruby-identifier">mtime</span>(<span class="ruby-ivar">@path</span>).<span class="ruby-identifier">httpdate</span>,
65: <span class="ruby-value str">&quot;Content-Type&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Mime</span>.<span class="ruby-identifier">mime_type</span>(<span class="ruby-constant">F</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-ivar">@path</span>), <span class="ruby-value str">'text/plain'</span>),
66: <span class="ruby-value str">&quot;Content-Length&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">size</span>.<span class="ruby-identifier">to_s</span>
67: }, <span class="ruby-identifier">body</span>]
68: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,184 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::ForwardRequest</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::ForwardRequest</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/recursive_rb.html">
lib/rack/recursive.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Exception
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="ForwardRequest.html">Rack::ForwardRequest</a> gets caught by <a
href="Recursive.html">Rack::Recursive</a> and redirects the current request
to the app at <tt>url</tt>.
</p>
<pre>
raise ForwardRequest.new(&quot;/not-found&quot;)
</pre>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000203">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="attribute-list">
<h3 class="section-bar">Attributes</h3>
<div class="name-list">
<table>
<tr class="top-aligned-row context-row">
<td class="context-item-name">env</td>
<td class="context-item-value">&nbsp;[R]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">url</td>
<td class="context-item-value">&nbsp;[R]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000203" class="method-detail">
<a name="M000203"></a>
<div class="method-heading">
<a href="#M000203" class="method-signature">
<span class="method-name">new</span><span class="method-args">(url, env={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000203-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000203-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/recursive.rb, line 13</span>
13: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">env</span>={})
14: <span class="ruby-ivar">@url</span> = <span class="ruby-constant">URI</span>(<span class="ruby-identifier">url</span>)
15: <span class="ruby-ivar">@env</span> = <span class="ruby-identifier">env</span>
16:
17: <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;PATH_INFO&quot;</span>] = <span class="ruby-ivar">@url</span>.<span class="ruby-identifier">path</span>
18: <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;QUERY_STRING&quot;</span>] = <span class="ruby-ivar">@url</span>.<span class="ruby-identifier">query</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@url</span>.<span class="ruby-identifier">query</span>
19: <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;HTTP_HOST&quot;</span>] = <span class="ruby-ivar">@url</span>.<span class="ruby-identifier">host</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@url</span>.<span class="ruby-identifier">host</span>
20: <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;HTTP_PORT&quot;</span>] = <span class="ruby-ivar">@url</span>.<span class="ruby-identifier">port</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@url</span>.<span class="ruby-identifier">port</span>
21: <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;rack.url_scheme&quot;</span>] = <span class="ruby-ivar">@url</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@url</span>.<span class="ruby-identifier">scheme</span>
22:
23: <span class="ruby-keyword kw">super</span> <span class="ruby-node">&quot;forwarding to #{url}&quot;</span>
24: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,196 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Forwarder</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Forwarder</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/forward_rb.html">
lib/rack/forward.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000075">call</a>&nbsp;&nbsp;
<a href="#M000074">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000074" class="method-detail">
<a name="M000074"></a>
<div class="method-heading">
<a href="#M000074" class="method-signature">
<span class="method-name">new</span><span class="method-args">(host, port=80)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000074-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000074-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/forward.rb, line 12</span>
12: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">host</span>, <span class="ruby-identifier">port</span>=<span class="ruby-value">80</span>)
13: <span class="ruby-ivar">@host</span>, <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">host</span>, <span class="ruby-identifier">port</span>
14: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000075" class="method-detail">
<a name="M000075"></a>
<div class="method-heading">
<a href="#M000075" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000075-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000075-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/forward.rb, line 16</span>
16: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
17: <span class="ruby-identifier">rackreq</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">env</span>)
18:
19: <span class="ruby-identifier">headers</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">HeaderHash</span>.<span class="ruby-identifier">new</span>
20: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
21: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/HTTP_(.*)/</span>
22: <span class="ruby-identifier">headers</span>[<span class="ruby-identifier">$1</span>] = <span class="ruby-identifier">value</span>
23: <span class="ruby-keyword kw">end</span>
24: }
25:
26: <span class="ruby-identifier">res</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-ivar">@host</span>, <span class="ruby-ivar">@port</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">http</span><span class="ruby-operator">|</span>
27: <span class="ruby-identifier">m</span> = <span class="ruby-identifier">rackreq</span>.<span class="ruby-identifier">request_method</span>
28: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">m</span>
29: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;GET&quot;</span>, <span class="ruby-value str">&quot;HEAD&quot;</span>, <span class="ruby-value str">&quot;DELETE&quot;</span>, <span class="ruby-value str">&quot;OPTIONS&quot;</span>, <span class="ruby-value str">&quot;TRACE&quot;</span>
30: <span class="ruby-identifier">req</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">m</span>.<span class="ruby-identifier">capitalize</span>).<span class="ruby-identifier">new</span>(<span class="ruby-identifier">rackreq</span>.<span class="ruby-identifier">fullpath</span>, <span class="ruby-identifier">headers</span>)
31: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;PUT&quot;</span>, <span class="ruby-value str">&quot;POST&quot;</span>
32: <span class="ruby-identifier">req</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">m</span>.<span class="ruby-identifier">capitalize</span>).<span class="ruby-identifier">new</span>(<span class="ruby-identifier">rackreq</span>.<span class="ruby-identifier">fullpath</span>, <span class="ruby-identifier">headers</span>)
33: <span class="ruby-identifier">req</span>.<span class="ruby-identifier">body_stream</span> = <span class="ruby-identifier">rackreq</span>.<span class="ruby-identifier">body</span>
34: <span class="ruby-keyword kw">else</span>
35: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;method not supported: #{method}&quot;</span>
36: <span class="ruby-keyword kw">end</span>
37:
38: <span class="ruby-identifier">http</span>.<span class="ruby-identifier">request</span>(<span class="ruby-identifier">req</span>)
39: }
40:
41: [<span class="ruby-identifier">res</span>.<span class="ruby-identifier">code</span>, <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">HeaderHash</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">res</span>.<span class="ruby-identifier">to_hash</span>), [<span class="ruby-identifier">res</span>.<span class="ruby-identifier">body</span>]]
42: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,242 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Rack::Handler</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Rack::Handler</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/handler_rb.html">
lib/rack/handler.rb
</a>
<br />
<a href="../../files/lib/rack/handler/cgi_rb.html">
lib/rack/handler/cgi.rb
</a>
<br />
<a href="../../files/lib/rack/handler/evented_mongrel_rb.html">
lib/rack/handler/evented_mongrel.rb
</a>
<br />
<a href="../../files/lib/rack/handler/fastcgi_rb.html">
lib/rack/handler/fastcgi.rb
</a>
<br />
<a href="../../files/lib/rack/handler/lsws_rb.html">
lib/rack/handler/lsws.rb
</a>
<br />
<a href="../../files/lib/rack/handler/mongrel_rb.html">
lib/rack/handler/mongrel.rb
</a>
<br />
<a href="../../files/lib/rack/handler/scgi_rb.html">
lib/rack/handler/scgi.rb
</a>
<br />
<a href="../../files/lib/rack/handler/swiftiplied_mongrel_rb.html">
lib/rack/handler/swiftiplied_mongrel.rb
</a>
<br />
<a href="../../files/lib/rack/handler/thin_rb.html">
lib/rack/handler/thin.rb
</a>
<br />
<a href="../../files/lib/rack/handler/webrick_rb.html">
lib/rack/handler/webrick.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<b>Handlers</b> connect web servers with <a href="../Rack.html">Rack</a>.
</p>
<p>
<a href="../Rack.html">Rack</a> includes Handlers for <a
href="Handler/Mongrel.html">Mongrel</a>, <a
href="Handler/WEBrick.html">WEBrick</a>, <a
href="Handler/FastCGI.html">FastCGI</a>, <a
href="Handler/CGI.html">CGI</a>, <a href="Handler/SCGI.html">SCGI</a> and
LiteSpeed.
</p>
<p>
Handlers usually are activated by calling <tt>MyHandler.run(myapp)</tt>. A
second optional hash can be passed to include server-specific
configuration.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000044">get</a>&nbsp;&nbsp;
<a href="#M000045">register</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Class <a href="Handler/CGI.html" class="link">Rack::Handler::CGI</a><br />
Class <a href="Handler/EventedMongrel.html" class="link">Rack::Handler::EventedMongrel</a><br />
Class <a href="Handler/FastCGI.html" class="link">Rack::Handler::FastCGI</a><br />
Class <a href="Handler/LSWS.html" class="link">Rack::Handler::LSWS</a><br />
Class <a href="Handler/Mongrel.html" class="link">Rack::Handler::Mongrel</a><br />
Class <a href="Handler/SCGI.html" class="link">Rack::Handler::SCGI</a><br />
Class <a href="Handler/SwiftipliedMongrel.html" class="link">Rack::Handler::SwiftipliedMongrel</a><br />
Class <a href="Handler/Thin.html" class="link">Rack::Handler::Thin</a><br />
Class <a href="Handler/WEBrick.html" class="link">Rack::Handler::WEBrick</a><br />
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000044" class="method-detail">
<a name="M000044"></a>
<div class="method-heading">
<a href="#M000044" class="method-signature">
<span class="method-name">get</span><span class="method-args">(server)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000044-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler.rb, line 11</span>
11: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">server</span>)
12: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">server</span>
13:
14: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">klass</span> = <span class="ruby-ivar">@handlers</span>[<span class="ruby-identifier">server</span>]
15: <span class="ruby-identifier">obj</span> = <span class="ruby-constant">Object</span>
16: <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;::&quot;</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">obj</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">x</span>) }
17: <span class="ruby-identifier">obj</span>
18: <span class="ruby-keyword kw">else</span>
19: <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Handler</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">server</span>.<span class="ruby-identifier">capitalize</span>)
20: <span class="ruby-keyword kw">end</span>
21: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000045" class="method-detail">
<a name="M000045"></a>
<div class="method-heading">
<a href="#M000045" class="method-signature">
<span class="method-name">register</span><span class="method-args">(server, klass)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000045-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler.rb, line 23</span>
23: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">register</span>(<span class="ruby-identifier">server</span>, <span class="ruby-identifier">klass</span>)
24: <span class="ruby-ivar">@handlers</span> <span class="ruby-operator">||=</span> {}
25: <span class="ruby-ivar">@handlers</span>[<span class="ruby-identifier">server</span>] = <span class="ruby-identifier">klass</span>
26: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,254 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Handler::CGI</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Handler::CGI</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/handler/cgi_rb.html">
lib/rack/handler/cgi.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000051">run</a>&nbsp;&nbsp;
<a href="#M000054">send_body</a>&nbsp;&nbsp;
<a href="#M000053">send_headers</a>&nbsp;&nbsp;
<a href="#M000052">serve</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000051" class="method-detail">
<a name="M000051"></a>
<div class="method-heading">
<a href="#M000051" class="method-signature">
<span class="method-name">run</span><span class="method-args">(app, options=nil)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000051-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/cgi.rb, line 4</span>
4: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">run</span>(<span class="ruby-identifier">app</span>, <span class="ruby-identifier">options</span>=<span class="ruby-keyword kw">nil</span>)
5: <span class="ruby-identifier">serve</span> <span class="ruby-identifier">app</span>
6: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000054" class="method-detail">
<a name="M000054"></a>
<div class="method-heading">
<a href="#M000054" class="method-signature">
<span class="method-name">send_body</span><span class="method-args">(body)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000054-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/cgi.rb, line 49</span>
49: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send_body</span>(<span class="ruby-identifier">body</span>)
50: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">part</span><span class="ruby-operator">|</span>
51: <span class="ruby-constant">STDOUT</span>.<span class="ruby-identifier">print</span> <span class="ruby-identifier">part</span>
52: <span class="ruby-constant">STDOUT</span>.<span class="ruby-identifier">flush</span>
53: }
54: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000053" class="method-detail">
<a name="M000053"></a>
<div class="method-heading">
<a href="#M000053" class="method-signature">
<span class="method-name">send_headers</span><span class="method-args">(status, headers)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000053-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/cgi.rb, line 38</span>
38: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send_headers</span>(<span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>)
39: <span class="ruby-constant">STDOUT</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">&quot;Status: #{status}\r\n&quot;</span>
40: <span class="ruby-identifier">headers</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">vs</span><span class="ruby-operator">|</span>
41: <span class="ruby-identifier">vs</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
42: <span class="ruby-constant">STDOUT</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">&quot;#{k}: #{v}\r\n&quot;</span>
43: }
44: }
45: <span class="ruby-constant">STDOUT</span>.<span class="ruby-identifier">print</span> <span class="ruby-value str">&quot;\r\n&quot;</span>
46: <span class="ruby-constant">STDOUT</span>.<span class="ruby-identifier">flush</span>
47: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000052" class="method-detail">
<a name="M000052"></a>
<div class="method-heading">
<a href="#M000052" class="method-signature">
<span class="method-name">serve</span><span class="method-args">(app)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000052-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/cgi.rb, line 8</span>
8: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">serve</span>(<span class="ruby-identifier">app</span>)
9: <span class="ruby-identifier">env</span> = <span class="ruby-constant">ENV</span>.<span class="ruby-identifier">to_hash</span>
10: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">&quot;HTTP_CONTENT_LENGTH&quot;</span>
11:
12: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;SCRIPT_NAME&quot;</span>] = <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;SCRIPT_NAME&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;/&quot;</span>
13:
14: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">update</span>({<span class="ruby-value str">&quot;rack.version&quot;</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value">0</span>,<span class="ruby-value">1</span>],
15: <span class="ruby-value str">&quot;rack.input&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">STDIN</span>,
16: <span class="ruby-value str">&quot;rack.errors&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">STDERR</span>,
17:
18: <span class="ruby-value str">&quot;rack.multithread&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>,
19: <span class="ruby-value str">&quot;rack.multiprocess&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>,
20: <span class="ruby-value str">&quot;rack.run_once&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>,
21:
22: <span class="ruby-value str">&quot;rack.url_scheme&quot;</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">&quot;yes&quot;</span>, <span class="ruby-value str">&quot;on&quot;</span>, <span class="ruby-value str">&quot;1&quot;</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-constant">ENV</span>[<span class="ruby-value str">&quot;HTTPS&quot;</span>]) <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;https&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;http&quot;</span>
23: })
24:
25: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;QUERY_STRING&quot;</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">&quot;&quot;</span>
26: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;HTTP_VERSION&quot;</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;SERVER_PROTOCOL&quot;</span>]
27: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;REQUEST_PATH&quot;</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">&quot;/&quot;</span>
28:
29: <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span> = <span class="ruby-identifier">app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
30: <span class="ruby-keyword kw">begin</span>
31: <span class="ruby-identifier">send_headers</span> <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>
32: <span class="ruby-identifier">send_body</span> <span class="ruby-identifier">body</span>
33: <span class="ruby-keyword kw">ensure</span>
34: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:close</span>
35: <span class="ruby-keyword kw">end</span>
36: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,111 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Handler::EventedMongrel</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Handler::EventedMongrel</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/handler/evented_mongrel_rb.html">
lib/rack/handler/evented_mongrel.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Handler::Mongrel
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,264 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Handler::FastCGI</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Handler::FastCGI</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/handler/fastcgi_rb.html">
lib/rack/handler/fastcgi.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000046">run</a>&nbsp;&nbsp;
<a href="#M000049">send_body</a>&nbsp;&nbsp;
<a href="#M000048">send_headers</a>&nbsp;&nbsp;
<a href="#M000047">serve</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000046" class="method-detail">
<a name="M000046"></a>
<div class="method-heading">
<a href="#M000046" class="method-signature">
<span class="method-name">run</span><span class="method-args">(app, options={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000046-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/fastcgi.rb, line 7</span>
7: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">run</span>(<span class="ruby-identifier">app</span>, <span class="ruby-identifier">options</span>={})
8: <span class="ruby-identifier">file</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:File</span>] <span class="ruby-keyword kw">and</span> <span class="ruby-constant">STDIN</span>.<span class="ruby-identifier">reopen</span>(<span class="ruby-constant">UNIXServer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">file</span>))
9: <span class="ruby-identifier">port</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:Port</span>] <span class="ruby-keyword kw">and</span> <span class="ruby-constant">STDIN</span>.<span class="ruby-identifier">reopen</span>(<span class="ruby-constant">TCPServer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">port</span>))
10: <span class="ruby-constant">FCGI</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">request</span><span class="ruby-operator">|</span>
11: <span class="ruby-identifier">serve</span> <span class="ruby-identifier">request</span>, <span class="ruby-identifier">app</span>
12: }
13: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000049" class="method-detail">
<a name="M000049"></a>
<div class="method-heading">
<a href="#M000049" class="method-signature">
<span class="method-name">send_body</span><span class="method-args">(out, body)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000049-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/fastcgi.rb, line 78</span>
78: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send_body</span>(<span class="ruby-identifier">out</span>, <span class="ruby-identifier">body</span>)
79: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">part</span><span class="ruby-operator">|</span>
80: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">print</span> <span class="ruby-identifier">part</span>
81: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">flush</span>
82: }
83: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000048" class="method-detail">
<a name="M000048"></a>
<div class="method-heading">
<a href="#M000048" class="method-signature">
<span class="method-name">send_headers</span><span class="method-args">(out, status, headers)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000048-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/fastcgi.rb, line 67</span>
67: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send_headers</span>(<span class="ruby-identifier">out</span>, <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>)
68: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">&quot;Status: #{status}\r\n&quot;</span>
69: <span class="ruby-identifier">headers</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">vs</span><span class="ruby-operator">|</span>
70: <span class="ruby-identifier">vs</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
71: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">&quot;#{k}: #{v}\r\n&quot;</span>
72: }
73: }
74: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">print</span> <span class="ruby-value str">&quot;\r\n&quot;</span>
75: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">flush</span>
76: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000047" class="method-detail">
<a name="M000047"></a>
<div class="method-heading">
<a href="#M000047" class="method-signature">
<span class="method-name">serve</span><span class="method-args">(request, app)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000047-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000047-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/fastcgi.rb, line 31</span>
31: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">serve</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">app</span>)
32: <span class="ruby-identifier">env</span> = <span class="ruby-identifier">request</span>.<span class="ruby-identifier">env</span>
33: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">&quot;HTTP_CONTENT_LENGTH&quot;</span>
34:
35: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">in</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">ProperStream</span>
36:
37: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;SCRIPT_NAME&quot;</span>] = <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;SCRIPT_NAME&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;/&quot;</span>
38:
39: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">update</span>({<span class="ruby-value str">&quot;rack.version&quot;</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value">0</span>,<span class="ruby-value">1</span>],
40: <span class="ruby-value str">&quot;rack.input&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">in</span>,
41: <span class="ruby-value str">&quot;rack.errors&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">err</span>,
42:
43: <span class="ruby-value str">&quot;rack.multithread&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>,
44: <span class="ruby-value str">&quot;rack.multiprocess&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>,
45: <span class="ruby-value str">&quot;rack.run_once&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>,
46:
47: <span class="ruby-value str">&quot;rack.url_scheme&quot;</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">&quot;yes&quot;</span>, <span class="ruby-value str">&quot;on&quot;</span>, <span class="ruby-value str">&quot;1&quot;</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;HTTPS&quot;</span>]) <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;https&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;http&quot;</span>
48: })
49:
50: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;QUERY_STRING&quot;</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">&quot;&quot;</span>
51: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;HTTP_VERSION&quot;</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;SERVER_PROTOCOL&quot;</span>]
52: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;REQUEST_PATH&quot;</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">&quot;/&quot;</span>
53: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">&quot;PATH_INFO&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;PATH_INFO&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
54: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">&quot;CONTENT_TYPE&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;CONTENT_TYPE&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
55: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">&quot;CONTENT_LENGTH&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;CONTENT_LENGTH&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
56:
57: <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span> = <span class="ruby-identifier">app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
58: <span class="ruby-keyword kw">begin</span>
59: <span class="ruby-identifier">send_headers</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">out</span>, <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>
60: <span class="ruby-identifier">send_body</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">out</span>, <span class="ruby-identifier">body</span>
61: <span class="ruby-keyword kw">ensure</span>
62: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:close</span>
63: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">finish</span>
64: <span class="ruby-keyword kw">end</span>
65: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,250 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Handler::LSWS</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Handler::LSWS</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/handler/lsws_rb.html">
lib/rack/handler/lsws.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000058">run</a>&nbsp;&nbsp;
<a href="#M000061">send_body</a>&nbsp;&nbsp;
<a href="#M000060">send_headers</a>&nbsp;&nbsp;
<a href="#M000059">serve</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000058" class="method-detail">
<a name="M000058"></a>
<div class="method-heading">
<a href="#M000058" class="method-signature">
<span class="method-name">run</span><span class="method-args">(app, options=nil)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000058-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000058-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/lsws.rb, line 6</span>
6: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">run</span>(<span class="ruby-identifier">app</span>, <span class="ruby-identifier">options</span>=<span class="ruby-keyword kw">nil</span>)
7: <span class="ruby-keyword kw">while</span> <span class="ruby-constant">LSAPI</span>.<span class="ruby-identifier">accept</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
8: <span class="ruby-identifier">serve</span> <span class="ruby-identifier">app</span>
9: <span class="ruby-keyword kw">end</span>
10: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000061" class="method-detail">
<a name="M000061"></a>
<div class="method-heading">
<a href="#M000061" class="method-signature">
<span class="method-name">send_body</span><span class="method-args">(body)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000061-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000061-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/lsws.rb, line 44</span>
44: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send_body</span>(<span class="ruby-identifier">body</span>)
45: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">part</span><span class="ruby-operator">|</span>
46: <span class="ruby-identifier">print</span> <span class="ruby-identifier">part</span>
47: <span class="ruby-constant">STDOUT</span>.<span class="ruby-identifier">flush</span>
48: }
49: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000060" class="method-detail">
<a name="M000060"></a>
<div class="method-heading">
<a href="#M000060" class="method-signature">
<span class="method-name">send_headers</span><span class="method-args">(status, headers)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000060-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000060-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/lsws.rb, line 34</span>
34: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send_headers</span>(<span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>)
35: <span class="ruby-identifier">print</span> <span class="ruby-node">&quot;Status: #{status}\r\n&quot;</span>
36: <span class="ruby-identifier">headers</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">vs</span><span class="ruby-operator">|</span>
37: <span class="ruby-identifier">vs</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
38: <span class="ruby-identifier">print</span> <span class="ruby-node">&quot;#{k}: #{v}\r\n&quot;</span>
39: }
40: }
41: <span class="ruby-identifier">print</span> <span class="ruby-value str">&quot;\r\n&quot;</span>
42: <span class="ruby-constant">STDOUT</span>.<span class="ruby-identifier">flush</span>
43: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000059" class="method-detail">
<a name="M000059"></a>
<div class="method-heading">
<a href="#M000059" class="method-signature">
<span class="method-name">serve</span><span class="method-args">(app)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000059-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000059-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/lsws.rb, line 11</span>
11: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">serve</span>(<span class="ruby-identifier">app</span>)
12: <span class="ruby-identifier">env</span> = <span class="ruby-constant">ENV</span>.<span class="ruby-identifier">to_hash</span>
13: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">&quot;HTTP_CONTENT_LENGTH&quot;</span>
14: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;SCRIPT_NAME&quot;</span>] = <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;SCRIPT_NAME&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;/&quot;</span>
15: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">update</span>({<span class="ruby-value str">&quot;rack.version&quot;</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value">0</span>,<span class="ruby-value">1</span>],
16: <span class="ruby-value str">&quot;rack.input&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">STDIN</span>,
17: <span class="ruby-value str">&quot;rack.errors&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">STDERR</span>,
18: <span class="ruby-value str">&quot;rack.multithread&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>,
19: <span class="ruby-value str">&quot;rack.multiprocess&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>,
20: <span class="ruby-value str">&quot;rack.run_once&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>,
21: <span class="ruby-value str">&quot;rack.url_scheme&quot;</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">&quot;yes&quot;</span>, <span class="ruby-value str">&quot;on&quot;</span>, <span class="ruby-value str">&quot;1&quot;</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-constant">ENV</span>[<span class="ruby-value str">&quot;HTTPS&quot;</span>]) <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;https&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;http&quot;</span>
22: })
23: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;QUERY_STRING&quot;</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">&quot;&quot;</span>
24: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;HTTP_VERSION&quot;</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;SERVER_PROTOCOL&quot;</span>]
25: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;REQUEST_PATH&quot;</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">&quot;/&quot;</span>
26: <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span> = <span class="ruby-identifier">app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
27: <span class="ruby-keyword kw">begin</span>
28: <span class="ruby-identifier">send_headers</span> <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>
29: <span class="ruby-identifier">send_body</span> <span class="ruby-identifier">body</span>
30: <span class="ruby-keyword kw">ensure</span>
31: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:close</span>
32: <span class="ruby-keyword kw">end</span>
33: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,258 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Handler::Mongrel</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Handler::Mongrel</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/handler/mongrel_rb.html">
lib/rack/handler/mongrel.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
::Mongrel::HttpHandler
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000066">new</a>&nbsp;&nbsp;
<a href="#M000067">process</a>&nbsp;&nbsp;
<a href="#M000065">run</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000066" class="method-detail">
<a name="M000066"></a>
<div class="method-heading">
<a href="#M000066" class="method-signature">
<span class="method-name">new</span><span class="method-args">(app)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000066-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000066-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/mongrel.rb, line 35</span>
35: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>)
36: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
37: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000065" class="method-detail">
<a name="M000065"></a>
<div class="method-heading">
<a href="#M000065" class="method-signature">
<span class="method-name">run</span><span class="method-args">(app, options={}) {|server if block_given?| ...}</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000065-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000065-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/mongrel.rb, line 7</span>
7: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">run</span>(<span class="ruby-identifier">app</span>, <span class="ruby-identifier">options</span>={})
8: <span class="ruby-identifier">server</span> = <span class="ruby-operator">::</span><span class="ruby-constant">Mongrel</span><span class="ruby-operator">::</span><span class="ruby-constant">HttpServer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:Host</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'0.0.0.0'</span>,
9: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:Port</span>] <span class="ruby-operator">||</span> <span class="ruby-value">8080</span>)
10: <span class="ruby-comment cmt"># Acts like Rack::URLMap, utilizing Mongrel's own path finding methods.</span>
11: <span class="ruby-comment cmt"># Use is similar to #run, replacing the app argument with a hash of </span>
12: <span class="ruby-comment cmt"># { path=&gt;app, ... } or an instance of Rack::URLMap.</span>
13: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:map</span>]
14: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">app</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Hash</span>
15: <span class="ruby-identifier">app</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">path</span>, <span class="ruby-identifier">appl</span><span class="ruby-operator">|</span>
16: <span class="ruby-identifier">path</span> = <span class="ruby-value str">'/'</span><span class="ruby-operator">+</span><span class="ruby-identifier">path</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">path</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?/</span>
17: <span class="ruby-identifier">server</span>.<span class="ruby-identifier">register</span>(<span class="ruby-identifier">path</span>, <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Handler</span><span class="ruby-operator">::</span><span class="ruby-constant">Mongrel</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">appl</span>))
18: <span class="ruby-keyword kw">end</span>
19: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">app</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">URLMap</span>
20: <span class="ruby-identifier">app</span>.<span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-identifier">:@mapping</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span>(<span class="ruby-identifier">host</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">appl</span>)<span class="ruby-operator">|</span>
21: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">host</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">options</span>[<span class="ruby-identifier">:Host</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:Host</span>] <span class="ruby-operator">!=</span> <span class="ruby-identifier">host</span>
22: <span class="ruby-identifier">path</span> = <span class="ruby-value str">'/'</span><span class="ruby-operator">+</span><span class="ruby-identifier">path</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">path</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?/</span>
23: <span class="ruby-identifier">server</span>.<span class="ruby-identifier">register</span>(<span class="ruby-identifier">path</span>, <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Handler</span><span class="ruby-operator">::</span><span class="ruby-constant">Mongrel</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">appl</span>))
24: <span class="ruby-keyword kw">end</span>
25: <span class="ruby-keyword kw">else</span>
26: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;first argument should be a Hash or URLMap&quot;</span>
27: <span class="ruby-keyword kw">end</span>
28: <span class="ruby-keyword kw">else</span>
29: <span class="ruby-identifier">server</span>.<span class="ruby-identifier">register</span>(<span class="ruby-value str">'/'</span>, <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Handler</span><span class="ruby-operator">::</span><span class="ruby-constant">Mongrel</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">app</span>))
30: <span class="ruby-keyword kw">end</span>
31: <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">server</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
32: <span class="ruby-identifier">server</span>.<span class="ruby-identifier">run</span>.<span class="ruby-identifier">join</span>
33: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000067" class="method-detail">
<a name="M000067"></a>
<div class="method-heading">
<a href="#M000067" class="method-signature">
<span class="method-name">process</span><span class="method-args">(request, response)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000067-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000067-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/mongrel.rb, line 39</span>
39: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
40: <span class="ruby-identifier">env</span> = {}.<span class="ruby-identifier">replace</span>(<span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>)
41: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">&quot;HTTP_CONTENT_TYPE&quot;</span>
42: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">&quot;HTTP_CONTENT_LENGTH&quot;</span>
43:
44: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;SCRIPT_NAME&quot;</span>] = <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;SCRIPT_NAME&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;/&quot;</span>
45:
46: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">update</span>({<span class="ruby-value str">&quot;rack.version&quot;</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value">0</span>,<span class="ruby-value">1</span>],
47: <span class="ruby-value str">&quot;rack.input&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">body</span> <span class="ruby-operator">||</span> <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;&quot;</span>),
48: <span class="ruby-value str">&quot;rack.errors&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">STDERR</span>,
49:
50: <span class="ruby-value str">&quot;rack.multithread&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>,
51: <span class="ruby-value str">&quot;rack.multiprocess&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>, <span class="ruby-comment cmt"># ???</span>
52: <span class="ruby-value str">&quot;rack.run_once&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>,
53:
54: <span class="ruby-value str">&quot;rack.url_scheme&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;http&quot;</span>,
55: })
56: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;QUERY_STRING&quot;</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">&quot;&quot;</span>
57: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">&quot;PATH_INFO&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;PATH_INFO&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
58:
59: <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span> = <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
60:
61: <span class="ruby-keyword kw">begin</span>
62: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span> = <span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_i</span>
63: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">send_status</span>(<span class="ruby-keyword kw">nil</span>)
64:
65: <span class="ruby-identifier">headers</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">vs</span><span class="ruby-operator">|</span>
66: <span class="ruby-identifier">vs</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
67: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">header</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
68: }
69: }
70: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">send_header</span>
71:
72: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">part</span><span class="ruby-operator">|</span>
73: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">part</span>
74: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">socket</span>.<span class="ruby-identifier">flush</span>
75: }
76: <span class="ruby-keyword kw">ensure</span>
77: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:close</span>
78: <span class="ruby-keyword kw">end</span>
79: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,244 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Handler::SCGI</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Handler::SCGI</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/handler/scgi_rb.html">
lib/rack/handler/scgi.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
::SCGI::Processor
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000056">new</a>&nbsp;&nbsp;
<a href="#M000057">process_request</a>&nbsp;&nbsp;
<a href="#M000055">run</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="attribute-list">
<h3 class="section-bar">Attributes</h3>
<div class="name-list">
<table>
<tr class="top-aligned-row context-row">
<td class="context-item-name">app</td>
<td class="context-item-value">&nbsp;[RW]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000056" class="method-detail">
<a name="M000056"></a>
<div class="method-heading">
<a href="#M000056" class="method-signature">
<span class="method-name">new</span><span class="method-args">(settings = {})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000056-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/scgi.rb, line 16</span>
16: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">settings</span> = {})
17: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">settings</span>[<span class="ruby-identifier">:app</span>]
18: <span class="ruby-ivar">@log</span> = <span class="ruby-constant">Object</span>.<span class="ruby-identifier">new</span>
19: <span class="ruby-keyword kw">def</span> <span class="ruby-ivar">@log</span>.<span class="ruby-identifier">info</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>); <span class="ruby-keyword kw">end</span>
20: <span class="ruby-keyword kw">def</span> <span class="ruby-ivar">@log</span>.<span class="ruby-identifier">error</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>); <span class="ruby-keyword kw">end</span>
21: <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">settings</span>)
22: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000055" class="method-detail">
<a name="M000055"></a>
<div class="method-heading">
<a href="#M000055" class="method-signature">
<span class="method-name">run</span><span class="method-args">(app, options=nil)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000055-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/scgi.rb, line 9</span>
9: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">run</span>(<span class="ruby-identifier">app</span>, <span class="ruby-identifier">options</span>=<span class="ruby-keyword kw">nil</span>)
10: <span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">:app=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">app</span>,
11: <span class="ruby-identifier">:host=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">options</span>[<span class="ruby-identifier">:Host</span>],
12: <span class="ruby-identifier">:port=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">options</span>[<span class="ruby-identifier">:Port</span>],
13: <span class="ruby-identifier">:socket=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">options</span>[<span class="ruby-identifier">:Socket</span>])).<span class="ruby-identifier">listen</span>
14: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000057" class="method-detail">
<a name="M000057"></a>
<div class="method-heading">
<a href="#M000057" class="method-signature">
<span class="method-name">process_request</span><span class="method-args">(request, input_body, socket)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000057-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000057-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/scgi.rb, line 24</span>
24: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_request</span><span class="ruby-identifier">process_request</span><span class="ruby-identifier">process_request</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">input_body</span>, <span class="ruby-identifier">socket</span>)
25: <span class="ruby-identifier">env</span> = {}.<span class="ruby-identifier">replace</span>(<span class="ruby-identifier">request</span>)
26: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">&quot;HTTP_CONTENT_TYPE&quot;</span>
27: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">&quot;HTTP_CONTENT_LENGTH&quot;</span>
28: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;REQUEST_PATH&quot;</span>], <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;QUERY_STRING&quot;</span>] = <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;REQUEST_URI&quot;</span>].<span class="ruby-identifier">split</span>(<span class="ruby-value str">'?'</span>, <span class="ruby-value">2</span>)
29: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;HTTP_VERSION&quot;</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;SERVER_PROTOCOL&quot;</span>]
30: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;PATH_INFO&quot;</span>] = <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;REQUEST_PATH&quot;</span>]
31: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;QUERY_STRING&quot;</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">&quot;&quot;</span>
32: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;SCRIPT_NAME&quot;</span>] = <span class="ruby-value str">&quot;&quot;</span>
33: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">update</span>({<span class="ruby-value str">&quot;rack.version&quot;</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value">0</span>,<span class="ruby-value">1</span>],
34: <span class="ruby-value str">&quot;rack.input&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">input_body</span>),
35: <span class="ruby-value str">&quot;rack.errors&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">STDERR</span>,
36:
37: <span class="ruby-value str">&quot;rack.multithread&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>,
38: <span class="ruby-value str">&quot;rack.multiprocess&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>,
39: <span class="ruby-value str">&quot;rack.run_once&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>,
40:
41: <span class="ruby-value str">&quot;rack.url_scheme&quot;</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">&quot;yes&quot;</span>, <span class="ruby-value str">&quot;on&quot;</span>, <span class="ruby-value str">&quot;1&quot;</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;HTTPS&quot;</span>]) <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;https&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;http&quot;</span>
42: })
43: <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span> = <span class="ruby-identifier">app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
44: <span class="ruby-keyword kw">begin</span>
45: <span class="ruby-identifier">socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-node">&quot;Status: #{status}\r\n&quot;</span>)
46: <span class="ruby-identifier">headers</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">vs</span><span class="ruby-operator">|</span>
47: <span class="ruby-identifier">vs</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-node">&quot;#{k}: #{v}\r\n&quot;</span>)}
48: <span class="ruby-keyword kw">end</span>
49: <span class="ruby-identifier">socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">&quot;\r\n&quot;</span>)
50: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">s</span>)}
51: <span class="ruby-keyword kw">ensure</span>
52: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:close</span>
53: <span class="ruby-keyword kw">end</span>
54: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,111 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Handler::SwiftipliedMongrel</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Handler::SwiftipliedMongrel</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/handler/swiftiplied_mongrel_rb.html">
lib/rack/handler/swiftiplied_mongrel.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Handler::Mongrel
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,150 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Handler::Thin</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Handler::Thin</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/handler/thin_rb.html">
lib/rack/handler/thin.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000050">run</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000050" class="method-detail">
<a name="M000050"></a>
<div class="method-heading">
<a href="#M000050" class="method-signature">
<span class="method-name">run</span><span class="method-args">(app, options={}) {|server if block_given?| ...}</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000050-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000050-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/thin.rb, line 6</span>
6: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">run</span>(<span class="ruby-identifier">app</span>, <span class="ruby-identifier">options</span>={})
7: <span class="ruby-identifier">server</span> = <span class="ruby-operator">::</span><span class="ruby-constant">Thin</span><span class="ruby-operator">::</span><span class="ruby-constant">Server</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:Host</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'0.0.0.0'</span>,
8: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:Port</span>] <span class="ruby-operator">||</span> <span class="ruby-value">8080</span>,
9: <span class="ruby-identifier">app</span>)
10: <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">server</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
11: <span class="ruby-identifier">server</span>.<span class="ruby-identifier">start</span>
12: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,237 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Handler::WEBrick</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Handler::WEBrick</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/handler/webrick_rb.html">
lib/rack/handler/webrick.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
::WEBrick::HTTPServlet::AbstractServlet
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000063">new</a>&nbsp;&nbsp;
<a href="#M000062">run</a>&nbsp;&nbsp;
<a href="#M000064">service</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000063" class="method-detail">
<a name="M000063"></a>
<div class="method-heading">
<a href="#M000063" class="method-signature">
<span class="method-name">new</span><span class="method-args">(server, app)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000063-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000063-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/webrick.rb, line 15</span>
15: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">server</span>, <span class="ruby-identifier">app</span>)
16: <span class="ruby-keyword kw">super</span> <span class="ruby-identifier">server</span>
17: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
18: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000062" class="method-detail">
<a name="M000062"></a>
<div class="method-heading">
<a href="#M000062" class="method-signature">
<span class="method-name">run</span><span class="method-args">(app, options={}) {|server if block_given?| ...}</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000062-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000062-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/webrick.rb, line 7</span>
7: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">run</span>(<span class="ruby-identifier">app</span>, <span class="ruby-identifier">options</span>={})
8: <span class="ruby-identifier">server</span> = <span class="ruby-operator">::</span><span class="ruby-constant">WEBrick</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTPServer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>)
9: <span class="ruby-identifier">server</span>.<span class="ruby-identifier">mount</span> <span class="ruby-value str">&quot;/&quot;</span>, <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Handler</span><span class="ruby-operator">::</span><span class="ruby-constant">WEBrick</span>, <span class="ruby-identifier">app</span>
10: <span class="ruby-identifier">trap</span>(<span class="ruby-identifier">:INT</span>) { <span class="ruby-identifier">server</span>.<span class="ruby-identifier">shutdown</span> }
11: <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">server</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
12: <span class="ruby-identifier">server</span>.<span class="ruby-identifier">start</span>
13: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000064" class="method-detail">
<a name="M000064"></a>
<div class="method-heading">
<a href="#M000064" class="method-signature">
<span class="method-name">service</span><span class="method-args">(req, res)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000064-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000064-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/handler/webrick.rb, line 20</span>
20: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">service</span>(<span class="ruby-identifier">req</span>, <span class="ruby-identifier">res</span>)
21: <span class="ruby-identifier">env</span> = <span class="ruby-identifier">req</span>.<span class="ruby-identifier">meta_vars</span>
22: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">delete_if</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">nil?</span> }
23:
24: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">update</span>({<span class="ruby-value str">&quot;rack.version&quot;</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value">0</span>,<span class="ruby-value">1</span>],
25: <span class="ruby-value str">&quot;rack.input&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">req</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">to_s</span>),
26: <span class="ruby-value str">&quot;rack.errors&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">STDERR</span>,
27:
28: <span class="ruby-value str">&quot;rack.multithread&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>,
29: <span class="ruby-value str">&quot;rack.multiprocess&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>,
30: <span class="ruby-value str">&quot;rack.run_once&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>,
31:
32: <span class="ruby-value str">&quot;rack.url_scheme&quot;</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">&quot;yes&quot;</span>, <span class="ruby-value str">&quot;on&quot;</span>, <span class="ruby-value str">&quot;1&quot;</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-constant">ENV</span>[<span class="ruby-value str">&quot;HTTPS&quot;</span>]) <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;https&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;http&quot;</span>
33: })
34:
35: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;HTTP_VERSION&quot;</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;SERVER_PROTOCOL&quot;</span>]
36: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;QUERY_STRING&quot;</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">&quot;&quot;</span>
37: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;REQUEST_PATH&quot;</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">&quot;/&quot;</span>
38: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">&quot;PATH_INFO&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;PATH_INFO&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
39:
40: <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span> = <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
41: <span class="ruby-keyword kw">begin</span>
42: <span class="ruby-identifier">res</span>.<span class="ruby-identifier">status</span> = <span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_i</span>
43: <span class="ruby-identifier">headers</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">vs</span><span class="ruby-operator">|</span>
44: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;set-cookie&quot;</span>
45: <span class="ruby-identifier">res</span>.<span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">concat</span> <span class="ruby-identifier">vs</span>.<span class="ruby-identifier">to_a</span>
46: <span class="ruby-keyword kw">else</span>
47: <span class="ruby-identifier">vs</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
48: <span class="ruby-identifier">res</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
49: }
50: <span class="ruby-keyword kw">end</span>
51: }
52: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">part</span><span class="ruby-operator">|</span>
53: <span class="ruby-identifier">res</span>.<span class="ruby-identifier">body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">part</span>
54: }
55: <span class="ruby-keyword kw">ensure</span>
56: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:close</span>
57: <span class="ruby-keyword kw">end</span>
58: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,178 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Head</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Head</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/head_rb.html">
lib/rack/head.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000073">call</a>&nbsp;&nbsp;
<a href="#M000072">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000072" class="method-detail">
<a name="M000072"></a>
<div class="method-heading">
<a href="#M000072" class="method-signature">
<span class="method-name">new</span><span class="method-args">(app)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000072-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000072-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/head.rb, line 4</span>
4: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>)
5: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
6: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000073" class="method-detail">
<a name="M000073"></a>
<div class="method-heading">
<a href="#M000073" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000073-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000073-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/head.rb, line 8</span>
8: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
9: <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span> = <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
10:
11: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;REQUEST_METHOD&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;HEAD&quot;</span>
12: [<span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, []]
13: <span class="ruby-keyword kw">else</span>
14: [<span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span>]
15: <span class="ruby-keyword kw">end</span>
16: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,154 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Lint</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Lint</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/lint_rb.html">
lib/rack/lint.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="Lint.html">Rack::Lint</a> validates your application and the
requests and responses according to the <a href="../Rack.html">Rack</a>
spec.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000082">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000082" class="method-detail">
<a name="M000082"></a>
<div class="method-heading">
<a href="#M000082" class="method-signature">
<span class="method-name">new</span><span class="method-args">(app)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000082-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000082-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/lint.rb, line 6</span>
6: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>)
7: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
8: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,136 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Lobster</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Lobster</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/lobster_rb.html">
lib/rack/lobster.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
Paste has a Pony, <a href="../Rack.html">Rack</a> has a <a
href="Lobster.html">Lobster</a>!
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">LobsterString</td>
<td>=</td>
<td class="context-item-value">Zlib::Inflate.inflate(&quot;eJx9kEEOwyAMBO99xd7MAcytUhPlJyj2 P6jy9i4k9EQyGAnBarEXeCBqSkntNXsi/ZCvC48zGQoZKikGrFMZvgS5ZHd+aGWVuWwhVF0 t1drVmiR42HcWNz5w3QanT+2gIvTVCiE1lm1Y0eU4JGmIIbaKwextKn8rvW+p5PIwFl8ZWJ I8jyiTlhTcYXkekJAzTyYN6E08A+dk8voBkAVTJQ==&quot;.delete(&quot;\n &quot;).unpack(&quot;m*&quot;)[0])</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">LambdaLobster</td>
<td>=</td>
<td class="context-item-value">lambda { |env| if env[&quot;QUERY_STRING&quot;].include?(&quot;flip&quot;)</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,206 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::MethodOverride</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::MethodOverride</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/methodoverride_rb.html">
lib/rack/methodoverride.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000079">call</a>&nbsp;&nbsp;
<a href="#M000078">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">HTTP_METHODS</td>
<td>=</td>
<td class="context-item-value">%w(GET HEAD PUT POST DELETE OPTIONS)</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">METHOD_OVERRIDE_PARAM_KEY</td>
<td>=</td>
<td class="context-item-value">&quot;_method&quot;.freeze</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">HTTP_METHOD_OVERRIDE_HEADER</td>
<td>=</td>
<td class="context-item-value">&quot;HTTP_X_HTTP_METHOD_OVERRIDE&quot;.freeze</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000078" class="method-detail">
<a name="M000078"></a>
<div class="method-heading">
<a href="#M000078" class="method-signature">
<span class="method-name">new</span><span class="method-args">(app)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000078-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000078-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/methodoverride.rb, line 8</span>
8: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>)
9: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
10: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000079" class="method-detail">
<a name="M000079"></a>
<div class="method-heading">
<a href="#M000079" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000079-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000079-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/methodoverride.rb, line 12</span>
12: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
13: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;REQUEST_METHOD&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;POST&quot;</span>
14: <span class="ruby-identifier">req</span> = <span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">env</span>)
15: <span class="ruby-identifier">method</span> = <span class="ruby-identifier">req</span>.<span class="ruby-constant">POST</span>[<span class="ruby-constant">METHOD_OVERRIDE_PARAM_KEY</span>] <span class="ruby-operator">||</span>
16: <span class="ruby-identifier">env</span>[<span class="ruby-constant">HTTP_METHOD_OVERRIDE_HEADER</span>]
17: <span class="ruby-identifier">method</span> = <span class="ruby-identifier">method</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">upcase</span>
18: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">HTTP_METHODS</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">method</span>)
19: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;rack.methodoverride.original_method&quot;</span>] = <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;REQUEST_METHOD&quot;</span>]
20: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;REQUEST_METHOD&quot;</span>] = <span class="ruby-identifier">method</span>
21: <span class="ruby-keyword kw">end</span>
22: <span class="ruby-keyword kw">end</span>
23:
24: <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
25: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -1,375 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::MockRequest</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::MockRequest</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/mock_rb.html">
lib/rack/mock.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="MockRequest.html">Rack::MockRequest</a> helps testing your <a
href="../Rack.html">Rack</a> application without actually using HTTP.
</p>
<p>
After performing a <a href="MockRequest.html#M000119">request</a> on a URL
with get/post/put/delete, it returns a <a
href="MockResponse.html">MockResponse</a> with useful helper methods for
effective testing.
</p>
<p>
You can pass a hash with additional configuration to the
get/post/put/delete.
</p>
<table>
<tr><td valign="top"><tt>:input</tt>:</td><td>A String or IO-like to be used as rack.input.
</td></tr>
<tr><td valign="top"><tt>:fatal</tt>:</td><td>Raise a <a href="MockRequest/FatalWarning.html">FatalWarning</a> if the app
writes to rack.errors.
</td></tr>
<tr><td valign="top"><tt>:lint</tt>:</td><td>If true, wrap the application in a <a href="Lint.html">Rack::Lint</a>.
</td></tr>
</table>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000118">delete</a>&nbsp;&nbsp;
<a href="#M000120">env_for</a>&nbsp;&nbsp;
<a href="#M000115">get</a>&nbsp;&nbsp;
<a href="#M000114">new</a>&nbsp;&nbsp;
<a href="#M000116">post</a>&nbsp;&nbsp;
<a href="#M000117">put</a>&nbsp;&nbsp;
<a href="#M000119">request</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Class <a href="MockRequest/FatalWarner.html" class="link">Rack::MockRequest::FatalWarner</a><br />
Class <a href="MockRequest/FatalWarning.html" class="link">Rack::MockRequest::FatalWarning</a><br />
</div>
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">DEFAULT_ENV</td>
<td>=</td>
<td class="context-item-value">{ &quot;rack.version&quot; =&gt; [0,1], &quot;rack.input&quot; =&gt; StringIO.new, &quot;rack.errors&quot; =&gt; StringIO.new, &quot;rack.multithread&quot; =&gt; true, &quot;rack.multiprocess&quot; =&gt; true, &quot;rack.run_once&quot; =&gt; false, }</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000120" class="method-detail">
<a name="M000120"></a>
<div class="method-heading">
<a href="#M000120" class="method-signature">
<span class="method-name">env_for</span><span class="method-args">(uri=&quot;&quot;, opts={})</span>
</a>
</div>
<div class="method-description">
<p>
Return the <a href="../Rack.html">Rack</a> environment used for a <a
href="MockRequest.html#M000119">request</a> to <tt>uri</tt>.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000120-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000120-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/mock.rb, line 74</span>
74: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">env_for</span>(<span class="ruby-identifier">uri</span>=<span class="ruby-value str">&quot;&quot;</span>, <span class="ruby-identifier">opts</span>={})
75: <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>(<span class="ruby-identifier">uri</span>)
76: <span class="ruby-identifier">env</span> = <span class="ruby-constant">DEFAULT_ENV</span>.<span class="ruby-identifier">dup</span>
77:
78: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;REQUEST_METHOD&quot;</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:method</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;GET&quot;</span>
79: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;SERVER_NAME&quot;</span>] = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">host</span> <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;example.org&quot;</span>
80: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;SERVER_PORT&quot;</span>] = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">port</span> <span class="ruby-value">? </span><span class="ruby-identifier">uri</span>.<span class="ruby-identifier">port</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;80&quot;</span>
81: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;QUERY_STRING&quot;</span>] = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>.<span class="ruby-identifier">to_s</span>
82: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;PATH_INFO&quot;</span>] = (<span class="ruby-operator">!</span><span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">empty?</span>) <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;/&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>
83: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;rack.url_scheme&quot;</span>] = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;http&quot;</span>
84:
85: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;SCRIPT_NAME&quot;</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:script_name</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;&quot;</span>
86:
87: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:fatal</span>]
88: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;rack.errors&quot;</span>] = <span class="ruby-constant">FatalWarner</span>.<span class="ruby-identifier">new</span>
89: <span class="ruby-keyword kw">else</span>
90: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;rack.errors&quot;</span>] = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
91: <span class="ruby-keyword kw">end</span>
92:
93: <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:input</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">&quot;&quot;</span>
94: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">String</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:input</span>]
95: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;rack.input&quot;</span>] = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:input</span>])
96: <span class="ruby-keyword kw">else</span>
97: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;rack.input&quot;</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:input</span>]
98: <span class="ruby-keyword kw">end</span>
99:
100: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">field</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
101: <span class="ruby-identifier">env</span>[<span class="ruby-identifier">field</span>] = <span class="ruby-identifier">value</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">String</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">field</span>
102: }
103:
104: <span class="ruby-identifier">env</span>
105: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000114" class="method-detail">
<a name="M000114"></a>
<div class="method-heading">
<a href="#M000114" class="method-signature">
<span class="method-name">new</span><span class="method-args">(app)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000114-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000114-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/mock.rb, line 51</span>
51: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>)
52: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
53: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000118" class="method-detail">
<a name="M000118"></a>
<div class="method-heading">
<a href="#M000118" class="method-signature">
<span class="method-name">delete</span><span class="method-args">(uri, opts={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000118-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000118-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/mock.rb, line 58</span>
58: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">opts</span>={}) <span class="ruby-identifier">request</span>(<span class="ruby-value str">&quot;DELETE&quot;</span>, <span class="ruby-identifier">uri</span>, <span class="ruby-identifier">opts</span>) <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000115" class="method-detail">
<a name="M000115"></a>
<div class="method-heading">
<a href="#M000115" class="method-signature">
<span class="method-name">get</span><span class="method-args">(uri, opts={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000115-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000115-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/mock.rb, line 55</span>
55: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">opts</span>={}) <span class="ruby-identifier">request</span>(<span class="ruby-value str">&quot;GET&quot;</span>, <span class="ruby-identifier">uri</span>, <span class="ruby-identifier">opts</span>) <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000116" class="method-detail">
<a name="M000116"></a>
<div class="method-heading">
<a href="#M000116" class="method-signature">
<span class="method-name">post</span><span class="method-args">(uri, opts={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000116-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000116-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/mock.rb, line 56</span>
56: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">post</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">opts</span>={}) <span class="ruby-identifier">request</span>(<span class="ruby-value str">&quot;POST&quot;</span>, <span class="ruby-identifier">uri</span>, <span class="ruby-identifier">opts</span>) <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000117" class="method-detail">
<a name="M000117"></a>
<div class="method-heading">
<a href="#M000117" class="method-signature">
<span class="method-name">put</span><span class="method-args">(uri, opts={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000117-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000117-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/mock.rb, line 57</span>
57: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">put</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">opts</span>={}) <span class="ruby-identifier">request</span>(<span class="ruby-value str">&quot;PUT&quot;</span>, <span class="ruby-identifier">uri</span>, <span class="ruby-identifier">opts</span>) <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000119" class="method-detail">
<a name="M000119"></a>
<div class="method-heading">
<a href="#M000119" class="method-signature">
<span class="method-name">request</span><span class="method-args">(method=&quot;GET&quot;, uri=&quot;&quot;, opts={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000119-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000119-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/mock.rb, line 60</span>
60: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">request</span>(<span class="ruby-identifier">method</span>=<span class="ruby-value str">&quot;GET&quot;</span>, <span class="ruby-identifier">uri</span>=<span class="ruby-value str">&quot;&quot;</span>, <span class="ruby-identifier">opts</span>={})
61: <span class="ruby-identifier">env</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">env_for</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">:method</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">method</span>))
62:
63: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:lint</span>]
64: <span class="ruby-identifier">app</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Lint</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@app</span>)
65: <span class="ruby-keyword kw">else</span>
66: <span class="ruby-identifier">app</span> = <span class="ruby-ivar">@app</span>
67: <span class="ruby-keyword kw">end</span>
68:
69: <span class="ruby-identifier">errors</span> = <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;rack.errors&quot;</span>]
70: <span class="ruby-constant">MockResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span>(<span class="ruby-identifier">app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>) <span class="ruby-operator">+</span> [<span class="ruby-identifier">errors</span>]))
71: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,217 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::MockRequest::FatalWarner</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::MockRequest::FatalWarner</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/mock_rb.html">
lib/rack/mock.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000123">flush</a>&nbsp;&nbsp;
<a href="#M000121">puts</a>&nbsp;&nbsp;
<a href="#M000124">string</a>&nbsp;&nbsp;
<a href="#M000122">write</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000123" class="method-detail">
<a name="M000123"></a>
<div class="method-heading">
<a href="#M000123" class="method-signature">
<span class="method-name">flush</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000123-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000123-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/mock.rb, line 34</span>
34: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">flush</span>
35: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000121" class="method-detail">
<a name="M000121"></a>
<div class="method-heading">
<a href="#M000121" class="method-signature">
<span class="method-name">puts</span><span class="method-args">(warning)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000121-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000121-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/mock.rb, line 26</span>
26: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">puts</span>(<span class="ruby-identifier">warning</span>)
27: <span class="ruby-identifier">raise</span> <span class="ruby-constant">FatalWarning</span>, <span class="ruby-identifier">warning</span>
28: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000124" class="method-detail">
<a name="M000124"></a>
<div class="method-heading">
<a href="#M000124" class="method-signature">
<span class="method-name">string</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000124-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000124-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/mock.rb, line 37</span>
37: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">string</span>
38: <span class="ruby-value str">&quot;&quot;</span>
39: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000122" class="method-detail">
<a name="M000122"></a>
<div class="method-heading">
<a href="#M000122" class="method-signature">
<span class="method-name">write</span><span class="method-args">(warning)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000122-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000122-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/mock.rb, line 30</span>
30: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">write</span>(<span class="ruby-identifier">warning</span>)
31: <span class="ruby-identifier">raise</span> <span class="ruby-constant">FatalWarning</span>, <span class="ruby-identifier">warning</span>
32: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,111 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::MockRequest::FatalWarning</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::MockRequest::FatalWarning</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/mock_rb.html">
lib/rack/mock.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
RuntimeError
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,298 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::MockResponse</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::MockResponse</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/mock_rb.html">
lib/rack/mock.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="MockResponse.html">Rack::MockResponse</a> provides useful helpers
for testing your apps. Usually, you don&#8216;t create the <a
href="MockResponse.html">MockResponse</a> on your own, but use <a
href="MockRequest.html">MockRequest</a>.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000070">=~</a>&nbsp;&nbsp;
<a href="#M000069">[]</a>&nbsp;&nbsp;
<a href="#M000071">match</a>&nbsp;&nbsp;
<a href="#M000068">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="Response/Helpers.html">Response::Helpers</a></span>
</div>
</div>
<div id="section">
<div id="attribute-list">
<h3 class="section-bar">Attributes</h3>
<div class="name-list">
<table>
<tr class="top-aligned-row context-row">
<td class="context-item-name">body</td>
<td class="context-item-value">&nbsp;[R]&nbsp;</td>
<td class="context-item-desc">
Body
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">errors</td>
<td class="context-item-value">&nbsp;[RW]&nbsp;</td>
<td class="context-item-desc">
Errors
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">headers</td>
<td class="context-item-value">&nbsp;[R]&nbsp;</td>
<td class="context-item-desc">
Headers
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">original_headers</td>
<td class="context-item-value">&nbsp;[R]&nbsp;</td>
<td class="context-item-desc">
Headers
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">status</td>
<td class="context-item-value">&nbsp;[R]&nbsp;</td>
<td class="context-item-desc">
Status
</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000068" class="method-detail">
<a name="M000068"></a>
<div class="method-heading">
<a href="#M000068" class="method-signature">
<span class="method-name">new</span><span class="method-args">(status, headers, body, errors=StringIO.new(&quot;&quot;))</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000068-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000068-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/mock.rb, line 113</span>
113: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span>, <span class="ruby-identifier">errors</span>=<span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;&quot;</span>))
114: <span class="ruby-ivar">@status</span> = <span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_i</span>
115:
116: <span class="ruby-ivar">@original_headers</span> = <span class="ruby-identifier">headers</span>
117: <span class="ruby-ivar">@headers</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">HeaderHash</span>.<span class="ruby-identifier">new</span>
118: <span class="ruby-identifier">headers</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">field</span>, <span class="ruby-identifier">values</span><span class="ruby-operator">|</span>
119: <span class="ruby-identifier">values</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
120: <span class="ruby-ivar">@headers</span>[<span class="ruby-identifier">field</span>] = <span class="ruby-identifier">value</span>
121: }
122: <span class="ruby-ivar">@headers</span>[<span class="ruby-identifier">field</span>] = <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">values</span>.<span class="ruby-identifier">empty?</span>
123: }
124:
125: <span class="ruby-ivar">@body</span> = <span class="ruby-value str">&quot;&quot;</span>
126: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">part</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">part</span> }
127:
128: <span class="ruby-ivar">@errors</span> = <span class="ruby-identifier">errors</span>.<span class="ruby-identifier">string</span>
129: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000070" class="method-detail">
<a name="M000070"></a>
<div class="method-heading">
<a href="#M000070" class="method-signature">
<span class="method-name">=~</span><span class="method-args">(other)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000070-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000070-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/mock.rb, line 145</span>
145: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">=~</span>(<span class="ruby-identifier">other</span>)
146: <span class="ruby-ivar">@body</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">other</span>
147: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000069" class="method-detail">
<a name="M000069"></a>
<div class="method-heading">
<a href="#M000069" class="method-signature">
<span class="method-name">[]</span><span class="method-args">(field)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000069-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000069-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/mock.rb, line 137</span>
137: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">field</span>)
138: <span class="ruby-identifier">headers</span>[<span class="ruby-identifier">field</span>]
139: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000071" class="method-detail">
<a name="M000071"></a>
<div class="method-heading">
<a href="#M000071" class="method-signature">
<span class="method-name">match</span><span class="method-args">(other)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000071-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000071-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/mock.rb, line 149</span>
149: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">match</span>(<span class="ruby-identifier">other</span>)
150: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">match</span> <span class="ruby-identifier">other</span>
151: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,218 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Recursive</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Recursive</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/recursive_rb.html">
lib/rack/recursive.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="Recursive.html">Rack::Recursive</a> allows applications called
down the chain to <a href="Recursive.html#M000149">include</a> data from
other applications (by using <tt><a
href="http://'rack.recursive.include'">rack</a>[&#8230;]</tt> or raise a <a
href="ForwardRequest.html">ForwardRequest</a> to redirect internally.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000148">call</a>&nbsp;&nbsp;
<a href="#M000149">include</a>&nbsp;&nbsp;
<a href="#M000147">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000147" class="method-detail">
<a name="M000147"></a>
<div class="method-heading">
<a href="#M000147" class="method-signature">
<span class="method-name">new</span><span class="method-args">(app)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000147-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000147-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/recursive.rb, line 33</span>
33: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>)
34: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
35: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000148" class="method-detail">
<a name="M000148"></a>
<div class="method-heading">
<a href="#M000148" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000148-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000148-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/recursive.rb, line 37</span>
37: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
38: <span class="ruby-ivar">@script_name</span> = <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;SCRIPT_NAME&quot;</span>]
39: <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-value str">'rack.recursive.include'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">method</span>(<span class="ruby-identifier">:include</span>)))
40: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ForwardRequest</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">req</span>
41: <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">req</span>.<span class="ruby-identifier">env</span>))
42: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000149" class="method-detail">
<a name="M000149"></a>
<div class="method-heading">
<a href="#M000149" class="method-signature">
<span class="method-name">include</span><span class="method-args">(env, path)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000149-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000149-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/recursive.rb, line 44</span>
44: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">include</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">path</span>)
45: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">index</span>(<span class="ruby-ivar">@script_name</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">path</span>[<span class="ruby-ivar">@script_name</span>.<span class="ruby-identifier">size</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?/</span> <span class="ruby-operator">||</span>
46: <span class="ruby-identifier">path</span>[<span class="ruby-ivar">@script_name</span>.<span class="ruby-identifier">size</span>].<span class="ruby-identifier">nil?</span>)
47: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;can only include below #{@script_name}, not #{path}&quot;</span>
48: <span class="ruby-keyword kw">end</span>
49:
50: <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-value str">&quot;PATH_INFO&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">path</span>, <span class="ruby-value str">&quot;SCRIPT_NAME&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@script_name</span>,
51: <span class="ruby-value str">&quot;REQUEST_METHOD&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;GET&quot;</span>,
52: <span class="ruby-value str">&quot;CONTENT_LENGTH&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;0&quot;</span>, <span class="ruby-value str">&quot;CONTENT_TYPE&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;&quot;</span>,
53: <span class="ruby-value str">&quot;rack.input&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;&quot;</span>))
54: <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
55: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,249 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Reloader</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Reloader</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/reloader_rb.html">
lib/rack/reloader.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="Reloader.html">Rack::Reloader</a> checks on every request, but at
most every <tt>secs</tt> seconds, if a file loaded changed, and reloads it,
logging to rack.errors.
</p>
<p>
It is recommended you use <a href="ShowExceptions.html">ShowExceptions</a>
to catch SyntaxErrors etc.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000133">call</a>&nbsp;&nbsp;
<a href="#M000132">new</a>&nbsp;&nbsp;
<a href="#M000134">reload!</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000132" class="method-detail">
<a name="M000132"></a>
<div class="method-heading">
<a href="#M000132" class="method-signature">
<span class="method-name">new</span><span class="method-args">(app, secs=10)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000132-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000132-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/reloader.rb, line 11</span>
11: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>, <span class="ruby-identifier">secs</span>=<span class="ruby-value">10</span>)
12: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
13: <span class="ruby-ivar">@secs</span> = <span class="ruby-identifier">secs</span> <span class="ruby-comment cmt"># reload every @secs seconds max</span>
14: <span class="ruby-ivar">@last</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
15: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000133" class="method-detail">
<a name="M000133"></a>
<div class="method-heading">
<a href="#M000133" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000133-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000133-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/reloader.rb, line 17</span>
17: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
18: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@last</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@secs</span>
19: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">exclusive</span> {
20: <span class="ruby-identifier">reload!</span>(<span class="ruby-identifier">env</span>[<span class="ruby-value str">'rack.errors'</span>])
21: <span class="ruby-ivar">@last</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
22: }
23: <span class="ruby-keyword kw">end</span>
24:
25: <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
26: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000134" class="method-detail">
<a name="M000134"></a>
<div class="method-heading">
<a href="#M000134" class="method-signature">
<span class="method-name">reload!</span><span class="method-args">(stderr=STDERR)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000134-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000134-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/reloader.rb, line 28</span>
28: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reload!</span>(<span class="ruby-identifier">stderr</span>=<span class="ruby-constant">STDERR</span>)
29: <span class="ruby-identifier">need_reload</span> = <span class="ruby-identifier">$LOADED_FEATURES</span>.<span class="ruby-identifier">find_all</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">loaded</span><span class="ruby-operator">|</span>
30: <span class="ruby-keyword kw">begin</span>
31: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">loaded</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\A[.\/]/</span> <span class="ruby-comment cmt"># absolute filename or 1.9</span>
32: <span class="ruby-identifier">abs</span> = <span class="ruby-identifier">loaded</span>
33: <span class="ruby-keyword kw">else</span>
34: <span class="ruby-identifier">abs</span> = <span class="ruby-identifier">$LOAD_PATH</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span> <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">loaded</span>) }.
35: <span class="ruby-identifier">find</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span> <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span> <span class="ruby-identifier">file</span> }
36: <span class="ruby-keyword kw">end</span>
37:
38: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">abs</span>
39: <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">mtime</span>(<span class="ruby-identifier">abs</span>) <span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@last</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@secs</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">false</span>
40: <span class="ruby-keyword kw">else</span>
41: <span class="ruby-keyword kw">false</span>
42: <span class="ruby-keyword kw">end</span>
43: <span class="ruby-keyword kw">end</span>
44: }
45:
46: <span class="ruby-identifier">need_reload</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span>
47: <span class="ruby-identifier">$LOADED_FEATURES</span>.<span class="ruby-identifier">delete</span> <span class="ruby-identifier">l</span>
48: }
49:
50: <span class="ruby-identifier">need_reload</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">to_load</span><span class="ruby-operator">|</span>
51: <span class="ruby-keyword kw">begin</span>
52: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">require</span> <span class="ruby-identifier">to_load</span>
53: <span class="ruby-identifier">stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{self.class}: reloaded `#{to_load}'&quot;</span>
54: <span class="ruby-keyword kw">end</span>
55: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">LoadError</span>, <span class="ruby-constant">SyntaxError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
56: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span> <span class="ruby-comment cmt"># Possibly ShowExceptions</span>
57: <span class="ruby-keyword kw">end</span>
58: }
59:
60: <span class="ruby-identifier">stderr</span>.<span class="ruby-identifier">flush</span>
61: <span class="ruby-identifier">need_reload</span>
62: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -1,518 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Response</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Response</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/response_rb.html">
lib/rack/response.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="Response.html">Rack::Response</a> provides a convenient interface
to create a <a href="../Rack.html">Rack</a> response.
</p>
<p>
It allows setting of headers and cookies, and provides useful defaults (a
OK response containing HTML).
</p>
<p>
You can use <a href="Response.html#M000096">Response#write</a> to
iteratively generate your response, but note that this is buffered by <a
href="Response.html">Rack::Response</a> until you call <tt><a
href="Response.html#M000093">finish</a></tt>. <tt><a
href="Response.html#M000093">finish</a></tt> however can take a block
inside which calls to <tt><a href="Response.html#M000096">write</a></tt>
are syncronous with the <a href="../Rack.html">Rack</a> response.
</p>
<p>
Your application&#8216;s <tt>call</tt> should end returning <a
href="Response.html#M000093">Response#finish</a>.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000089">[]</a>&nbsp;&nbsp;
<a href="#M000090">[]=</a>&nbsp;&nbsp;
<a href="#M000097">close</a>&nbsp;&nbsp;
<a href="#M000092">delete_cookie</a>&nbsp;&nbsp;
<a href="#M000095">each</a>&nbsp;&nbsp;
<a href="#M000098">empty?</a>&nbsp;&nbsp;
<a href="#M000093">finish</a>&nbsp;&nbsp;
<a href="#M000088">new</a>&nbsp;&nbsp;
<a href="#M000091">set_cookie</a>&nbsp;&nbsp;
<a href="#M000094">to_a</a>&nbsp;&nbsp;
<a href="#M000096">write</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="Response/Helpers.html">Helpers</a></span>
</div>
</div>
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Module <a href="Response/Helpers.html" class="link">Rack::Response::Helpers</a><br />
</div>
<div id="aliases-list">
<h3 class="section-bar">External Aliases</h3>
<div class="name-list">
<table summary="aliases">
<tr class="top-aligned-row context-row">
<td class="context-item-name">header</td>
<td>-&gt;</td>
<td class="context-item-value">headers</td>
</tr>
</table>
</div>
</div>
<div id="attribute-list">
<h3 class="section-bar">Attributes</h3>
<div class="name-list">
<table>
<tr class="top-aligned-row context-row">
<td class="context-item-name">body</td>
<td class="context-item-value">&nbsp;[RW]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">header</td>
<td class="context-item-value">&nbsp;[R]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">status</td>
<td class="context-item-value">&nbsp;[RW]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000088" class="method-detail">
<a name="M000088"></a>
<div class="method-heading">
<a href="#M000088" class="method-signature">
<span class="method-name">new</span><span class="method-args">(body=[], status=200, header={}) {|self if block_given?| ...}</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000088-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000088-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 19</span>
19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">body</span>=[], <span class="ruby-identifier">status</span>=<span class="ruby-value">200</span>, <span class="ruby-identifier">header</span>={}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
20: <span class="ruby-ivar">@status</span> = <span class="ruby-identifier">status</span>
21: <span class="ruby-ivar">@header</span> = <span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">HeaderHash</span>.<span class="ruby-identifier">new</span>({<span class="ruby-value str">&quot;Content-Type&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;text/html&quot;</span>}.
22: <span class="ruby-identifier">merge</span>(<span class="ruby-identifier">header</span>))
23:
24: <span class="ruby-ivar">@writer</span> = <span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">x</span> }
25: <span class="ruby-ivar">@block</span> = <span class="ruby-keyword kw">nil</span>
26: <span class="ruby-ivar">@length</span> = <span class="ruby-value">0</span>
27:
28: <span class="ruby-ivar">@body</span> = []
29:
30: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:to_str</span>
31: <span class="ruby-identifier">write</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">to_str</span>
32: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:each</span>)
33: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">part</span><span class="ruby-operator">|</span>
34: <span class="ruby-identifier">write</span> <span class="ruby-identifier">part</span>.<span class="ruby-identifier">to_s</span>
35: }
36: <span class="ruby-keyword kw">else</span>
37: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-value str">&quot;stringable or iterable required&quot;</span>
38: <span class="ruby-keyword kw">end</span>
39:
40: <span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">self</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
41: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000089" class="method-detail">
<a name="M000089"></a>
<div class="method-heading">
<a href="#M000089" class="method-signature">
<span class="method-name">[]</span><span class="method-args">(key)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000089-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000089-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 46</span>
46: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">key</span>)
47: <span class="ruby-identifier">header</span>[<span class="ruby-identifier">key</span>]
48: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000090" class="method-detail">
<a name="M000090"></a>
<div class="method-heading">
<a href="#M000090" class="method-signature">
<span class="method-name">[]=</span><span class="method-args">(key, value)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000090-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000090-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 50</span>
50: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
51: <span class="ruby-identifier">header</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span>
52: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000097" class="method-detail">
<a name="M000097"></a>
<div class="method-heading">
<a href="#M000097" class="method-signature">
<span class="method-name">close</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000097-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000097-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 122</span>
122: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close</span>
123: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:close</span>)
124: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000092" class="method-detail">
<a name="M000092"></a>
<div class="method-heading">
<a href="#M000092" class="method-signature">
<span class="method-name">delete_cookie</span><span class="method-args">(key, value={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000092-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000092-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 81</span>
81: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_cookie</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>={})
82: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">Array</span> <span class="ruby-operator">===</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">&quot;Set-Cookie&quot;</span>]
83: <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">&quot;Set-Cookie&quot;</span>] = [<span class="ruby-keyword kw">self</span>[<span class="ruby-value str">&quot;Set-Cookie&quot;</span>]].<span class="ruby-identifier">compact</span>
84: <span class="ruby-keyword kw">end</span>
85:
86: <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">&quot;Set-Cookie&quot;</span>].<span class="ruby-identifier">reject!</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">cookie</span><span class="ruby-operator">|</span>
87: <span class="ruby-identifier">cookie</span> <span class="ruby-operator">=~</span> <span class="ruby-node">/\A#{Utils.escape(key)}=/</span>
88: }
89:
90: <span class="ruby-identifier">set_cookie</span>(<span class="ruby-identifier">key</span>,
91: {<span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">''</span>, <span class="ruby-identifier">:path</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:domain</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
92: <span class="ruby-identifier">:expires</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-value">0</span>) }.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">value</span>))
93: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000095" class="method-detail">
<a name="M000095"></a>
<div class="method-heading">
<a href="#M000095" class="method-signature">
<span class="method-name">each</span><span class="method-args">(&amp;callback)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000095-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000095-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 109</span>
109: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">callback</span>)
110: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">each</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">callback</span>)
111: <span class="ruby-ivar">@writer</span> = <span class="ruby-identifier">callback</span>
112: <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@block</span>
113: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000098" class="method-detail">
<a name="M000098"></a>
<div class="method-heading">
<a href="#M000098" class="method-signature">
<span class="method-name">empty?</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000098-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000098-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 126</span>
126: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">empty?</span>
127: <span class="ruby-ivar">@block</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">empty?</span>
128: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000093" class="method-detail">
<a name="M000093"></a>
<div class="method-heading">
<a href="#M000093" class="method-signature">
<span class="method-name">finish</span><span class="method-args">(&amp;block)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000093-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000093-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 96</span>
96: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">finish</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
97: <span class="ruby-ivar">@block</span> = <span class="ruby-identifier">block</span>
98:
99: <span class="ruby-keyword kw">if</span> [<span class="ruby-value">204</span>, <span class="ruby-value">304</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_i</span>)
100: <span class="ruby-identifier">header</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">&quot;Content-Type&quot;</span>
101: [<span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">header</span>.<span class="ruby-identifier">to_hash</span>, []]
102: <span class="ruby-keyword kw">else</span>
103: <span class="ruby-identifier">header</span>[<span class="ruby-value str">&quot;Content-Length&quot;</span>] <span class="ruby-operator">||=</span> <span class="ruby-ivar">@length</span>.<span class="ruby-identifier">to_s</span>
104: [<span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">header</span>.<span class="ruby-identifier">to_hash</span>, <span class="ruby-keyword kw">self</span>]
105: <span class="ruby-keyword kw">end</span>
106: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000091" class="method-detail">
<a name="M000091"></a>
<div class="method-heading">
<a href="#M000091" class="method-signature">
<span class="method-name">set_cookie</span><span class="method-args">(key, value)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000091-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000091-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 54</span>
54: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_cookie</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
55: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">value</span>
56: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Hash</span>
57: <span class="ruby-identifier">domain</span> = <span class="ruby-value str">&quot;; domain=&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">value</span>[<span class="ruby-identifier">:domain</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>[<span class="ruby-identifier">:domain</span>]
58: <span class="ruby-identifier">path</span> = <span class="ruby-value str">&quot;; path=&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">value</span>[<span class="ruby-identifier">:path</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>[<span class="ruby-identifier">:path</span>]
59: <span class="ruby-comment cmt"># According to RFC 2109, we need dashes here.</span>
60: <span class="ruby-comment cmt"># N.B.: cgi.rb uses spaces...</span>
61: <span class="ruby-identifier">expires</span> = <span class="ruby-value str">&quot;; expires=&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">value</span>[<span class="ruby-identifier">:expires</span>].<span class="ruby-identifier">clone</span>.<span class="ruby-identifier">gmtime</span>.
62: <span class="ruby-identifier">strftime</span>(<span class="ruby-value str">&quot;%a, %d-%b-%Y %H:%M:%S GMT&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>[<span class="ruby-identifier">:expires</span>]
63: <span class="ruby-identifier">secure</span> = <span class="ruby-value str">&quot;; secure&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>[<span class="ruby-identifier">:secure</span>]
64: <span class="ruby-identifier">value</span> = <span class="ruby-identifier">value</span>[<span class="ruby-identifier">:value</span>]
65: <span class="ruby-keyword kw">end</span>
66: <span class="ruby-identifier">value</span> = [<span class="ruby-identifier">value</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">Array</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">value</span>
67: <span class="ruby-identifier">cookie</span> = <span class="ruby-constant">Utils</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-identifier">key</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;=&quot;</span> <span class="ruby-operator">+</span>
68: <span class="ruby-identifier">value</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-constant">Utils</span>.<span class="ruby-identifier">escape</span> <span class="ruby-identifier">v</span> }.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;&amp;&quot;</span>) <span class="ruby-operator">+</span>
69: <span class="ruby-node">&quot;#{domain}#{path}#{expires}#{secure}&quot;</span>
70:
71: <span class="ruby-keyword kw">case</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">&quot;Set-Cookie&quot;</span>]
72: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Array</span>
73: <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">&quot;Set-Cookie&quot;</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">cookie</span>
74: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">String</span>
75: <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">&quot;Set-Cookie&quot;</span>] = [<span class="ruby-keyword kw">self</span>[<span class="ruby-value str">&quot;Set-Cookie&quot;</span>], <span class="ruby-identifier">cookie</span>]
76: <span class="ruby-keyword kw">when</span> <span class="ruby-keyword kw">nil</span>
77: <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">&quot;Set-Cookie&quot;</span>] = <span class="ruby-identifier">cookie</span>
78: <span class="ruby-keyword kw">end</span>
79: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000094" class="method-detail">
<a name="M000094"></a>
<div class="method-heading">
<span class="method-name">to_a</span><span class="method-args">(&amp;block)</span>
</div>
<div class="method-description">
<p>
Alias for <a href="Response.html#M000093">finish</a>
</p>
</div>
</div>
<div id="method-M000096" class="method-detail">
<a name="M000096"></a>
<div class="method-heading">
<a href="#M000096" class="method-signature">
<span class="method-name">write</span><span class="method-args">(str)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000096-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000096-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 115</span>
115: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">write</span>(<span class="ruby-identifier">str</span>)
116: <span class="ruby-identifier">s</span> = <span class="ruby-identifier">str</span>.<span class="ruby-identifier">to_s</span>
117: <span class="ruby-ivar">@length</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">size</span>
118: <span class="ruby-ivar">@writer</span>.<span class="ruby-identifier">call</span> <span class="ruby-identifier">s</span>
119: <span class="ruby-identifier">str</span>
120: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,479 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Rack::Response::Helpers</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Rack::Response::Helpers</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/response_rb.html">
lib/rack/response.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000103">client_error?</a>&nbsp;&nbsp;
<a href="#M000112">content_length</a>&nbsp;&nbsp;
<a href="#M000111">content_type</a>&nbsp;&nbsp;
<a href="#M000109">empty?</a>&nbsp;&nbsp;
<a href="#M000106">forbidden?</a>&nbsp;&nbsp;
<a href="#M000110">include?</a>&nbsp;&nbsp;
<a href="#M000100">informational?</a>&nbsp;&nbsp;
<a href="#M000099">invalid?</a>&nbsp;&nbsp;
<a href="#M000113">location</a>&nbsp;&nbsp;
<a href="#M000107">not_found?</a>&nbsp;&nbsp;
<a href="#M000105">ok?</a>&nbsp;&nbsp;
<a href="#M000108">redirect?</a>&nbsp;&nbsp;
<a href="#M000102">redirection?</a>&nbsp;&nbsp;
<a href="#M000104">server_error?</a>&nbsp;&nbsp;
<a href="#M000101">successful?</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="attribute-list">
<h3 class="section-bar">Attributes</h3>
<div class="name-list">
<table>
<tr class="top-aligned-row context-row">
<td class="context-item-name">headers</td>
<td class="context-item-value">&nbsp;[R]&nbsp;</td>
<td class="context-item-desc">
Headers
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">original_headers</td>
<td class="context-item-value">&nbsp;[R]&nbsp;</td>
<td class="context-item-desc">
Headers
</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000103" class="method-detail">
<a name="M000103"></a>
<div class="method-heading">
<a href="#M000103" class="method-signature">
<span class="method-name">client_error?</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000103-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000103-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 138</span>
138: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">client_error?</span>; <span class="ruby-ivar">@status</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">400</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@status</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">500</span>; <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000112" class="method-detail">
<a name="M000112"></a>
<div class="method-heading">
<a href="#M000112" class="method-signature">
<span class="method-name">content_length</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000112-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000112-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 159</span>
159: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_length</span>
160: <span class="ruby-identifier">cl</span> = <span class="ruby-identifier">headers</span>[<span class="ruby-value str">&quot;Content-Length&quot;</span>]
161: <span class="ruby-identifier">cl</span> <span class="ruby-value">? </span><span class="ruby-identifier">cl</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">cl</span>
162: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000111" class="method-detail">
<a name="M000111"></a>
<div class="method-heading">
<a href="#M000111" class="method-signature">
<span class="method-name">content_type</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000111-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000111-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 155</span>
155: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_type</span>
156: <span class="ruby-identifier">headers</span>[<span class="ruby-value str">&quot;Content-Type&quot;</span>]
157: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000109" class="method-detail">
<a name="M000109"></a>
<div class="method-heading">
<a href="#M000109" class="method-signature">
<span class="method-name">empty?</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000109-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000109-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 146</span>
146: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">empty?</span>; [<span class="ruby-value">201</span>, <span class="ruby-value">204</span>, <span class="ruby-value">304</span>].<span class="ruby-identifier">include?</span> <span class="ruby-ivar">@status</span>; <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000106" class="method-detail">
<a name="M000106"></a>
<div class="method-heading">
<a href="#M000106" class="method-signature">
<span class="method-name">forbidden?</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000106-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000106-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 142</span>
142: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">forbidden?</span>; <span class="ruby-ivar">@status</span> <span class="ruby-operator">==</span> <span class="ruby-value">403</span>; <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000110" class="method-detail">
<a name="M000110"></a>
<div class="method-heading">
<a href="#M000110" class="method-signature">
<span class="method-name">include?</span><span class="method-args">(header)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000110-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000110-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 151</span>
151: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">include?</span>(<span class="ruby-identifier">header</span>)
152: <span class="ruby-operator">!</span><span class="ruby-operator">!</span><span class="ruby-identifier">headers</span>[<span class="ruby-identifier">header</span>]
153: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000100" class="method-detail">
<a name="M000100"></a>
<div class="method-heading">
<a href="#M000100" class="method-signature">
<span class="method-name">informational?</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000100-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000100-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 135</span>
135: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">informational?</span>; <span class="ruby-ivar">@status</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">100</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@status</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">200</span>; <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000099" class="method-detail">
<a name="M000099"></a>
<div class="method-heading">
<a href="#M000099" class="method-signature">
<span class="method-name">invalid?</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000099-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000099-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 133</span>
133: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">invalid?</span>; <span class="ruby-ivar">@status</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">100</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@status</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">600</span>; <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000113" class="method-detail">
<a name="M000113"></a>
<div class="method-heading">
<a href="#M000113" class="method-signature">
<span class="method-name">location</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000113-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000113-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 164</span>
164: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">location</span>
165: <span class="ruby-identifier">headers</span>[<span class="ruby-value str">&quot;Location&quot;</span>]
166: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000107" class="method-detail">
<a name="M000107"></a>
<div class="method-heading">
<a href="#M000107" class="method-signature">
<span class="method-name">not_found?</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000107-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000107-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 143</span>
143: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">not_found?</span>; <span class="ruby-ivar">@status</span> <span class="ruby-operator">==</span> <span class="ruby-value">404</span>; <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000105" class="method-detail">
<a name="M000105"></a>
<div class="method-heading">
<a href="#M000105" class="method-signature">
<span class="method-name">ok?</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000105-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000105-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 141</span>
141: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ok?</span>; <span class="ruby-ivar">@status</span> <span class="ruby-operator">==</span> <span class="ruby-value">200</span>; <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000108" class="method-detail">
<a name="M000108"></a>
<div class="method-heading">
<a href="#M000108" class="method-signature">
<span class="method-name">redirect?</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000108-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000108-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 145</span>
145: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">redirect?</span>; [<span class="ruby-value">301</span>, <span class="ruby-value">302</span>, <span class="ruby-value">303</span>, <span class="ruby-value">307</span>].<span class="ruby-identifier">include?</span> <span class="ruby-ivar">@status</span>; <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000102" class="method-detail">
<a name="M000102"></a>
<div class="method-heading">
<a href="#M000102" class="method-signature">
<span class="method-name">redirection?</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000102-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000102-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 137</span>
137: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">redirection?</span>; <span class="ruby-ivar">@status</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">300</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@status</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">400</span>; <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000104" class="method-detail">
<a name="M000104"></a>
<div class="method-heading">
<a href="#M000104" class="method-signature">
<span class="method-name">server_error?</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000104-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000104-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 139</span>
139: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">server_error?</span>; <span class="ruby-ivar">@status</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">500</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@status</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">600</span>; <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000101" class="method-detail">
<a name="M000101"></a>
<div class="method-heading">
<a href="#M000101" class="method-signature">
<span class="method-name">successful?</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000101-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000101-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/response.rb, line 136</span>
136: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">successful?</span>; <span class="ruby-ivar">@status</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">200</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@status</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">300</span>; <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,125 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Rack::Session</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Rack::Session</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack_rb.html">
lib/rack.rb
</a>
<br />
<a href="../../files/lib/rack/session/cookie_rb.html">
lib/rack/session/cookie.rb
</a>
<br />
<a href="../../files/lib/rack/session/memcache_rb.html">
lib/rack/session/memcache.rb
</a>
<br />
<a href="../../files/lib/rack/session/pool_rb.html">
lib/rack/session/pool.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Class <a href="Session/Cookie.html" class="link">Rack::Session::Cookie</a><br />
Class <a href="Session/Memcache.html" class="link">Rack::Session::Memcache</a><br />
Class <a href="Session/Pool.html" class="link">Rack::Session::Pool</a><br />
</div>
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,200 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Session::Cookie</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Session::Cookie</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/session/cookie_rb.html">
lib/rack/session/cookie.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="Cookie.html">Rack::Session::Cookie</a> provides simple cookie
based session management. The session is a Ruby Hash stored as base64
encoded marshalled data set to :key (default: rack.session). When the
secret key is set, cookie data is checked for data integrity.
</p>
<p>
Example:
</p>
<pre>
use Rack::Session::Cookie, :key =&gt; 'rack.session',
:domain =&gt; 'foo.com',
:path =&gt; '/',
:expire_after =&gt; 2592000,
:secret =&gt; 'change_me'
All parameters are optional.
</pre>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000009">call</a>&nbsp;&nbsp;
<a href="#M000008">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000008" class="method-detail">
<a name="M000008"></a>
<div class="method-heading">
<a href="#M000008" class="method-signature">
<span class="method-name">new</span><span class="method-args">(app, options={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000008-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/session/cookie.rb, line 24</span>
24: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>, <span class="ruby-identifier">options</span>={})
25: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
26: <span class="ruby-ivar">@key</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:key</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;rack.session&quot;</span>
27: <span class="ruby-ivar">@secret</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:secret</span>]
28: <span class="ruby-ivar">@default_options</span> = {<span class="ruby-identifier">:domain</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,
29: <span class="ruby-identifier">:path</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;/&quot;</span>,
30: <span class="ruby-identifier">:expire_after</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>}.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
31: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000009" class="method-detail">
<a name="M000009"></a>
<div class="method-heading">
<a href="#M000009" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000009-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/session/cookie.rb, line 33</span>
33: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
34: <span class="ruby-identifier">load_session</span>(<span class="ruby-identifier">env</span>)
35: <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span> = <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
36: <span class="ruby-identifier">commit_session</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span>)
37: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,204 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Session::Memcache</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Session::Memcache</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/session/memcache_rb.html">
lib/rack/session/memcache.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Abstract::ID
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="Memcache.html">Rack::Session::Memcache</a> provides simple cookie
based session management. <a href="../Session.html">Session</a> data is
stored in memcached. The corresponding session key is maintained in the
cookie. You may treat <a href="Memcache.html">Session::Memcache</a> as you
would <a href="Pool.html">Session::Pool</a> with the following caveats.
</p>
<ul>
<li>Setting :expire_after to 0 would note to the <a
href="Memcache.html">Memcache</a> server to hang onto the session data
until it would drop it according to it&#8216;s own specifications. However,
the cookie sent to the client would expire immediately.
</li>
</ul>
<p>
Note that memcache does drop data before it may be listed to expire. For a
full description of behaviour, please see memcache&#8216;s documentation.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000007">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">DEFAULT_OPTIONS</td>
<td>=</td>
<td class="context-item-value">Abstract::ID::DEFAULT_OPTIONS.merge({ :namespace =&gt; 'rack:session', :memcache_server =&gt; 'localhost:11211'</td>
</tr>
</table>
</div>
</div>
<div id="attribute-list">
<h3 class="section-bar">Attributes</h3>
<div class="name-list">
<table>
<tr class="top-aligned-row context-row">
<td class="context-item-name">mutex</td>
<td class="context-item-value">&nbsp;[R]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">pool</td>
<td class="context-item-value">&nbsp;[R]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000007" class="method-detail">
<a name="M000007"></a>
<div class="method-heading">
<a href="#M000007" class="method-signature">
<span class="method-name">new</span><span class="method-args">(app, options={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000007-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/session/memcache.rb, line 29</span>
29: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>, <span class="ruby-identifier">options</span>={})
30: <span class="ruby-keyword kw">super</span>
31: <span class="ruby-ivar">@pool</span> = <span class="ruby-constant">MemCache</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@default_options</span>[<span class="ruby-identifier">:memcache_server</span>], <span class="ruby-ivar">@default_options</span>
32: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@pool</span>.<span class="ruby-identifier">servers</span>.<span class="ruby-identifier">any?</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span><span class="ruby-identifier">s</span>.<span class="ruby-identifier">alive?</span>}
33: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;#{self} unable to find server during initialization.&quot;</span>
34: <span class="ruby-keyword kw">end</span>
35: <span class="ruby-ivar">@mutex</span> = <span class="ruby-constant">Mutex</span>.<span class="ruby-identifier">new</span>
36: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,201 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Session::Pool</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Session::Pool</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/session/pool_rb.html">
lib/rack/session/pool.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Abstract::ID
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="Pool.html">Rack::Session::Pool</a> provides simple cookie based
session management. <a href="../Session.html">Session</a> data is stored in
a hash held by @pool. In the context of a multithreaded environment,
sessions being committed to the pool is done in a merging manner.
</p>
<p>
Example:
</p>
<pre>
myapp = MyRackApp.new
sessioned = Rack::Session::Pool.new(myapp,
:key =&gt; 'rack.session',
:domain =&gt; 'foo.com',
:path =&gt; '/',
:expire_after =&gt; 2592000
)
Rack::Handler::WEBrick.run sessioned
</pre>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000010">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">DEFAULT_OPTIONS</td>
<td>=</td>
<td class="context-item-value">Abstract::ID::DEFAULT_OPTIONS.dup</td>
</tr>
</table>
</div>
</div>
<div id="attribute-list">
<h3 class="section-bar">Attributes</h3>
<div class="name-list">
<table>
<tr class="top-aligned-row context-row">
<td class="context-item-name">mutex</td>
<td class="context-item-value">&nbsp;[R]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">pool</td>
<td class="context-item-value">&nbsp;[R]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000010" class="method-detail">
<a name="M000010"></a>
<div class="method-heading">
<a href="#M000010" class="method-signature">
<span class="method-name">new</span><span class="method-args">(app, options={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000010-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/session/pool.rb, line 30</span>
30: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>, <span class="ruby-identifier">options</span>={})
31: <span class="ruby-keyword kw">super</span>
32: <span class="ruby-ivar">@pool</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
33: <span class="ruby-ivar">@mutex</span> = <span class="ruby-constant">Mutex</span>.<span class="ruby-identifier">new</span>
34: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,260 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::ShowExceptions</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::ShowExceptions</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/showexceptions_rb.html">
lib/rack/showexceptions.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="ShowExceptions.html">Rack::ShowExceptions</a> catches all
exceptions raised from the app it wraps. It shows a useful backtrace with
the sourcefile and clickable context, the whole <a
href="../Rack.html">Rack</a> environment and the request data.
</p>
<p>
Be careful when you use this on public-facing sites as it could reveal
information helpful to attackers.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000086">call</a>&nbsp;&nbsp;
<a href="#M000085">new</a>&nbsp;&nbsp;
<a href="#M000087">pretty</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">CONTEXT</td>
<td>=</td>
<td class="context-item-value">7</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000085" class="method-detail">
<a name="M000085"></a>
<div class="method-heading">
<a href="#M000085" class="method-signature">
<span class="method-name">new</span><span class="method-args">(app)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000085-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000085-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/showexceptions.rb, line 17</span>
17: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>)
18: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
19: <span class="ruby-ivar">@template</span> = <span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">TEMPLATE</span>)
20: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000086" class="method-detail">
<a name="M000086"></a>
<div class="method-heading">
<a href="#M000086" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000086-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000086-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/showexceptions.rb, line 22</span>
22: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
23: <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
24: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StandardError</span>, <span class="ruby-constant">LoadError</span>, <span class="ruby-constant">SyntaxError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
25: <span class="ruby-identifier">backtrace</span> = <span class="ruby-identifier">pretty</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">e</span>)
26: [<span class="ruby-value">500</span>,
27: {<span class="ruby-value str">&quot;Content-Type&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;text/html&quot;</span>,
28: <span class="ruby-value str">&quot;Content-Length&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">join</span>.<span class="ruby-identifier">size</span>.<span class="ruby-identifier">to_s</span>},
29: <span class="ruby-identifier">backtrace</span>]
30: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000087" class="method-detail">
<a name="M000087"></a>
<div class="method-heading">
<a href="#M000087" class="method-signature">
<span class="method-name">pretty</span><span class="method-args">(env, exception)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000087-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000087-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/showexceptions.rb, line 32</span>
32: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pretty</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">exception</span>)
33: <span class="ruby-identifier">req</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">env</span>)
34: <span class="ruby-identifier">path</span> = (<span class="ruby-identifier">req</span>.<span class="ruby-identifier">script_name</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">req</span>.<span class="ruby-identifier">path_info</span>).<span class="ruby-identifier">squeeze</span>(<span class="ruby-value str">&quot;/&quot;</span>)
35:
36: <span class="ruby-identifier">frames</span> = <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
37: <span class="ruby-identifier">frame</span> = <span class="ruby-constant">OpenStruct</span>.<span class="ruby-identifier">new</span>
38: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/(.*?):(\d+)(:in `(.*)')?/</span>
39: <span class="ruby-identifier">frame</span>.<span class="ruby-identifier">filename</span> = <span class="ruby-identifier">$1</span>
40: <span class="ruby-identifier">frame</span>.<span class="ruby-identifier">lineno</span> = <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">to_i</span>
41: <span class="ruby-identifier">frame</span>.<span class="ruby-identifier">function</span> = <span class="ruby-identifier">$4</span>
42:
43: <span class="ruby-keyword kw">begin</span>
44: <span class="ruby-identifier">lineno</span> = <span class="ruby-identifier">frame</span>.<span class="ruby-identifier">lineno</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
45: <span class="ruby-identifier">lines</span> = <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">readlines</span>(<span class="ruby-identifier">frame</span>.<span class="ruby-identifier">filename</span>)
46: <span class="ruby-identifier">frame</span>.<span class="ruby-identifier">pre_context_lineno</span> = [<span class="ruby-identifier">lineno</span><span class="ruby-operator">-</span><span class="ruby-constant">CONTEXT</span>, <span class="ruby-value">0</span>].<span class="ruby-identifier">max</span>
47: <span class="ruby-identifier">frame</span>.<span class="ruby-identifier">pre_context</span> = <span class="ruby-identifier">lines</span>[<span class="ruby-identifier">frame</span>.<span class="ruby-identifier">pre_context_lineno</span><span class="ruby-operator">...</span><span class="ruby-identifier">lineno</span>]
48: <span class="ruby-identifier">frame</span>.<span class="ruby-identifier">context_line</span> = <span class="ruby-identifier">lines</span>[<span class="ruby-identifier">lineno</span>].<span class="ruby-identifier">chomp</span>
49: <span class="ruby-identifier">frame</span>.<span class="ruby-identifier">post_context_lineno</span> = [<span class="ruby-identifier">lineno</span><span class="ruby-operator">+</span><span class="ruby-constant">CONTEXT</span>, <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">size</span>].<span class="ruby-identifier">min</span>
50: <span class="ruby-identifier">frame</span>.<span class="ruby-identifier">post_context</span> = <span class="ruby-identifier">lines</span>[<span class="ruby-identifier">lineno</span><span class="ruby-operator">+</span><span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">frame</span>.<span class="ruby-identifier">post_context_lineno</span>]
51: <span class="ruby-keyword kw">rescue</span>
52: <span class="ruby-keyword kw">end</span>
53:
54: <span class="ruby-identifier">frame</span>
55: <span class="ruby-keyword kw">else</span>
56: <span class="ruby-keyword kw">nil</span>
57: <span class="ruby-keyword kw">end</span>
58: }.<span class="ruby-identifier">compact</span>
59:
60: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;rack.errors&quot;</span>].<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{exception.class}: #{exception.message}&quot;</span>
61: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;rack.errors&quot;</span>].<span class="ruby-identifier">puts</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span> <span class="ruby-value str">&quot;\t&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">l</span> }
62: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;rack.errors&quot;</span>].<span class="ruby-identifier">flush</span>
63:
64: [<span class="ruby-ivar">@template</span>.<span class="ruby-identifier">result</span>(<span class="ruby-identifier">binding</span>)]
65: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,199 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::ShowStatus</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::ShowStatus</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/showstatus_rb.html">
lib/rack/showstatus.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="ShowStatus.html">Rack::ShowStatus</a> catches all empty responses
the app it wraps and replaces them with a site explaining the error.
</p>
<p>
Additional details can be put into <tt>rack.showstatus.detail</tt> and will
be shown as HTML. If such details exist, the error page is always rendered,
even if the reply was not empty.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000084">call</a>&nbsp;&nbsp;
<a href="#M000083">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000083" class="method-detail">
<a name="M000083"></a>
<div class="method-heading">
<a href="#M000083" class="method-signature">
<span class="method-name">new</span><span class="method-args">(app)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000083-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000083-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/showstatus.rb, line 14</span>
14: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>)
15: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
16: <span class="ruby-ivar">@template</span> = <span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">TEMPLATE</span>)
17: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000084" class="method-detail">
<a name="M000084"></a>
<div class="method-heading">
<a href="#M000084" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000084-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000084-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/showstatus.rb, line 19</span>
19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
20: <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span> = <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
21: <span class="ruby-identifier">headers</span> = <span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">HeaderHash</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">headers</span>)
22: <span class="ruby-identifier">empty</span> = <span class="ruby-identifier">headers</span>[<span class="ruby-value str">'Content-Length'</span>].<span class="ruby-identifier">to_i</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-value">0</span>
23:
24: <span class="ruby-comment cmt"># client or server error, or explicit message</span>
25: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">400</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">empty</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;rack.showstatus.detail&quot;</span>]
26: <span class="ruby-identifier">req</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">env</span>)
27: <span class="ruby-identifier">message</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP_STATUS_CODES</span>[<span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_i</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_s</span>
28: <span class="ruby-identifier">detail</span> = <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;rack.showstatus.detail&quot;</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">message</span>
29: <span class="ruby-identifier">body</span> = <span class="ruby-ivar">@template</span>.<span class="ruby-identifier">result</span>(<span class="ruby-identifier">binding</span>)
30: <span class="ruby-identifier">size</span> = <span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:bytesize</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">bytesize</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">size</span>
31: [<span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-value str">&quot;Content-Type&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;text/html&quot;</span>, <span class="ruby-value str">&quot;Content-Length&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">size</span>.<span class="ruby-identifier">to_s</span>), [<span class="ruby-identifier">body</span>]]
32: <span class="ruby-keyword kw">else</span>
33: [<span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span>]
34: <span class="ruby-keyword kw">end</span>
35: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,205 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Static</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Static</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/static_rb.html">
lib/rack/static.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
The <a href="Static.html">Rack::Static</a> middleware intercepts requests
for static files (javascript files, images, stylesheets, etc) based on the
url prefixes passed in the options, and serves them using a <a
href="File.html">Rack::File</a> object. This allows a <a
href="../Rack.html">Rack</a> stack to serve both static and dynamic
content.
</p>
<p>
Examples:
</p>
<pre>
use Rack::Static, :urls =&gt; [&quot;/media&quot;]
will serve all requests beginning with /media from the &quot;media&quot; folder
located in the current directory (ie media/*).
use Rack::Static, :urls =&gt; [&quot;/css&quot;, &quot;/images&quot;], :root =&gt; &quot;public&quot;
will serve all requests beginning with /css or /images from the folder
&quot;public&quot; in the current directory (ie public/css/* and public/images/*)
</pre>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000146">call</a>&nbsp;&nbsp;
<a href="#M000145">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000145" class="method-detail">
<a name="M000145"></a>
<div class="method-heading">
<a href="#M000145" class="method-signature">
<span class="method-name">new</span><span class="method-args">(app, options={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000145-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000145-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/static.rb, line 19</span>
19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>, <span class="ruby-identifier">options</span>={})
20: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
21: <span class="ruby-ivar">@urls</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:urls</span>] <span class="ruby-operator">||</span> [<span class="ruby-value str">&quot;/favicon.ico&quot;</span>]
22: <span class="ruby-identifier">root</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:root</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">pwd</span>
23: <span class="ruby-ivar">@file_server</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">root</span>)
24: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000146" class="method-detail">
<a name="M000146"></a>
<div class="method-heading">
<a href="#M000146" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000146-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000146-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/static.rb, line 26</span>
26: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
27: <span class="ruby-identifier">path</span> = <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;PATH_INFO&quot;</span>]
28: <span class="ruby-identifier">can_serve</span> = <span class="ruby-ivar">@urls</span>.<span class="ruby-identifier">any?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">url</span><span class="ruby-operator">|</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">url</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span> }
29:
30: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">can_serve</span>
31: <span class="ruby-ivar">@file_server</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
32: <span class="ruby-keyword kw">else</span>
33: <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
34: <span class="ruby-keyword kw">end</span>
35: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,214 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::URLMap</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::URLMap</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/urlmap_rb.html">
lib/rack/urlmap.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="URLMap.html">Rack::URLMap</a> takes a hash mapping urls or paths
to apps, and dispatches accordingly. Support for HTTP/1.1 host names exists
if the URLs start with <tt>http://</tt> or <tt>https://</tt>.
</p>
<p>
<a href="URLMap.html">URLMap</a> modifies the SCRIPT_NAME and PATH_INFO
such that the part relevant for dispatch is in the SCRIPT_NAME, and the
rest in the PATH_INFO. This should be taken care of when you need to
reconstruct the URL in order to create links.
</p>
<p>
<a href="URLMap.html">URLMap</a> dispatches in such a way that the longest
paths are tried first, since they are most specific.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000077">call</a>&nbsp;&nbsp;
<a href="#M000076">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000076" class="method-detail">
<a name="M000076"></a>
<div class="method-heading">
<a href="#M000076" class="method-signature">
<span class="method-name">new</span><span class="method-args">(map)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000076-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000076-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/urlmap.rb, line 15</span>
15: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">map</span>)
16: <span class="ruby-ivar">@mapping</span> = <span class="ruby-identifier">map</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">location</span>, <span class="ruby-identifier">app</span><span class="ruby-operator">|</span>
17: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">location</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">%r{\Ahttps?://(.*?)(/.*)}</span>
18: <span class="ruby-identifier">host</span>, <span class="ruby-identifier">location</span> = <span class="ruby-identifier">$1</span>, <span class="ruby-identifier">$2</span>
19: <span class="ruby-keyword kw">else</span>
20: <span class="ruby-identifier">host</span> = <span class="ruby-keyword kw">nil</span>
21: <span class="ruby-keyword kw">end</span>
22:
23: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">location</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?/</span>
24: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;paths need to start with /&quot;</span>
25: <span class="ruby-keyword kw">end</span>
26: <span class="ruby-identifier">location</span> = <span class="ruby-identifier">location</span>.<span class="ruby-identifier">chomp</span>(<span class="ruby-value str">'/'</span>)
27:
28: [<span class="ruby-identifier">host</span>, <span class="ruby-identifier">location</span>, <span class="ruby-identifier">app</span>]
29: }.<span class="ruby-identifier">sort_by</span> { <span class="ruby-operator">|</span>(<span class="ruby-identifier">h</span>, <span class="ruby-identifier">l</span>, <span class="ruby-identifier">a</span>)<span class="ruby-operator">|</span> [<span class="ruby-operator">-</span><span class="ruby-identifier">l</span>.<span class="ruby-identifier">size</span>, <span class="ruby-identifier">h</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">size</span>] } <span class="ruby-comment cmt"># Longest path first</span>
30: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000077" class="method-detail">
<a name="M000077"></a>
<div class="method-heading">
<a href="#M000077" class="method-signature">
<span class="method-name">call</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000077-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000077-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/urlmap.rb, line 32</span>
32: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
33: <span class="ruby-identifier">path</span> = <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;PATH_INFO&quot;</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">squeeze</span>(<span class="ruby-value str">&quot;/&quot;</span>)
34: <span class="ruby-identifier">hHost</span>, <span class="ruby-identifier">sName</span>, <span class="ruby-identifier">sPort</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">values_at</span>(<span class="ruby-value str">'HTTP_HOST'</span>,<span class="ruby-value str">'SERVER_NAME'</span>,<span class="ruby-value str">'SERVER_PORT'</span>)
35: <span class="ruby-ivar">@mapping</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">host</span>, <span class="ruby-identifier">location</span>, <span class="ruby-identifier">app</span><span class="ruby-operator">|</span>
36: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">unless</span> (<span class="ruby-identifier">hHost</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">host</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">sName</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">host</span> \
37: <span class="ruby-operator">||</span> (<span class="ruby-identifier">host</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">hHost</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">sName</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">hHost</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">sName</span><span class="ruby-operator">+</span><span class="ruby-value str">':'</span><span class="ruby-operator">+</span><span class="ruby-identifier">sPort</span>)))
38: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">location</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">path</span>[<span class="ruby-value">0</span>, <span class="ruby-identifier">location</span>.<span class="ruby-identifier">size</span>]
39: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">path</span>[<span class="ruby-identifier">location</span>.<span class="ruby-identifier">size</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">path</span>[<span class="ruby-identifier">location</span>.<span class="ruby-identifier">size</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?/</span>
40: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;SCRIPT_NAME&quot;</span>] <span class="ruby-operator">+=</span> <span class="ruby-identifier">location</span>
41: <span class="ruby-identifier">env</span>[<span class="ruby-value str">&quot;PATH_INFO&quot;</span>] = <span class="ruby-identifier">path</span>[<span class="ruby-identifier">location</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
42: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
43: }
44: [<span class="ruby-value">404</span>, {<span class="ruby-value str">&quot;Content-Type&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;text/plain&quot;</span>}, [<span class="ruby-node">&quot;Not Found: #{path}&quot;</span>]]
45: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,377 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Rack::Utils</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Rack::Utils</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/rack/utils_rb.html">
lib/rack/utils.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="Utils.html">Rack::Utils</a> contains a grab-bag of useful methods
for writing web applications adopted from all kinds of Ruby libraries.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000025">build_query</a>&nbsp;&nbsp;
<a href="#M000022">escape</a>&nbsp;&nbsp;
<a href="#M000026">escape_html</a>&nbsp;&nbsp;
<a href="#M000024">parse_query</a>&nbsp;&nbsp;
<a href="#M000027">select_best_encoding</a>&nbsp;&nbsp;
<a href="#M000023">unescape</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Module <a href="Utils/Multipart.html" class="link">Rack::Utils::Multipart</a><br />
Class <a href="Utils/Context.html" class="link">Rack::Utils::Context</a><br />
Class <a href="Utils/HeaderHash.html" class="link">Rack::Utils::HeaderHash</a><br />
</div>
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">HTTP_STATUS_CODES</td>
<td>=</td>
<td class="context-item-value">{ 100 =&gt; 'Continue', 101 =&gt; 'Switching Protocols', 200 =&gt; 'OK', 201 =&gt; 'Created', 202 =&gt; 'Accepted', 203 =&gt; 'Non-Authoritative Information', 204 =&gt; 'No Content', 205 =&gt; 'Reset Content', 206 =&gt; 'Partial Content', 300 =&gt; 'Multiple Choices', 301 =&gt; 'Moved Permanently', 302 =&gt; 'Found', 303 =&gt; 'See Other', 304 =&gt; 'Not Modified', 305 =&gt; 'Use Proxy', 307 =&gt; 'Temporary Redirect', 400 =&gt; 'Bad Request', 401 =&gt; 'Unauthorized', 402 =&gt; 'Payment Required', 403 =&gt; 'Forbidden', 404 =&gt; 'Not Found', 405 =&gt; 'Method Not Allowed', 406 =&gt; 'Not Acceptable', 407 =&gt; 'Proxy Authentication Required', 408 =&gt; 'Request Timeout', 409 =&gt; 'Conflict', 410 =&gt; 'Gone', 411 =&gt; 'Length Required', 412 =&gt; 'Precondition Failed', 413 =&gt; 'Request Entity Too Large', 414 =&gt; 'Request-URI Too Large', 415 =&gt; 'Unsupported Media Type', 416 =&gt; 'Requested Range Not Satisfiable', 417 =&gt; 'Expectation Failed', 500 =&gt; 'Internal Server Error', 501 =&gt; 'Not Implemented', 502 =&gt; 'Bad Gateway', 503 =&gt; 'Service Unavailable', 504 =&gt; 'Gateway Timeout', 505 =&gt; 'HTTP Version Not Supported'</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Every standard HTTP code mapped to the appropriate message. Stolen from
Mongrel.
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">STATUS_WITH_NO_ENTITY_BODY</td>
<td>=</td>
<td class="context-item-value">Set.new((100..199).to_a &lt;&lt; 204 &lt;&lt; 304)</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Responses with HTTP status codes that should not have an entity body
</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000025" class="method-detail">
<a name="M000025"></a>
<div class="method-heading">
<a href="#M000025" class="method-signature">
<span class="method-name">build_query</span><span class="method-args">(params)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000025-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/utils.rb, line 54</span>
54: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_query</span>(<span class="ruby-identifier">params</span>)
55: <span class="ruby-identifier">params</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
56: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Array</span>
57: <span class="ruby-identifier">build_query</span>(<span class="ruby-identifier">v</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> [<span class="ruby-identifier">k</span>, <span class="ruby-identifier">x</span>] })
58: <span class="ruby-keyword kw">else</span>
59: <span class="ruby-identifier">escape</span>(<span class="ruby-identifier">k</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;=&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">escape</span>(<span class="ruby-identifier">v</span>)
60: <span class="ruby-keyword kw">end</span>
61: }.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;&amp;&quot;</span>)
62: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000022" class="method-detail">
<a name="M000022"></a>
<div class="method-heading">
<a href="#M000022" class="method-signature">
<span class="method-name">escape</span><span class="method-args">(s)</span>
</a>
</div>
<div class="method-description">
<p>
Performs URI escaping so that you can construct proper query strings
faster. Use this rather than the cgi.rb version since it&#8216;s faster.
(Stolen from Camping).
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000022-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/utils.rb, line 12</span>
12: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escape</span>(<span class="ruby-identifier">s</span>)
13: <span class="ruby-identifier">s</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([^ a-zA-Z0-9_.-]+)/n</span>) {
14: <span class="ruby-value str">'%'</span><span class="ruby-operator">+</span><span class="ruby-identifier">$1</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">'H2'</span><span class="ruby-operator">*</span><span class="ruby-identifier">$1</span>.<span class="ruby-identifier">size</span>).<span class="ruby-identifier">join</span>(<span class="ruby-value str">'%'</span>).<span class="ruby-identifier">upcase</span>
15: }.<span class="ruby-identifier">tr</span>(<span class="ruby-value str">' '</span>, <span class="ruby-value str">'+'</span>)
16: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000026" class="method-detail">
<a name="M000026"></a>
<div class="method-heading">
<a href="#M000026" class="method-signature">
<span class="method-name">escape_html</span><span class="method-args">(string)</span>
</a>
</div>
<div class="method-description">
<p>
Escape ampersands, brackets and quotes to their HTML/XML entities.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000026-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/utils.rb, line 66</span>
66: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escape_html</span>(<span class="ruby-identifier">string</span>)
67: <span class="ruby-identifier">string</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">&quot;&amp;&quot;</span>, <span class="ruby-value str">&quot;&amp;amp;&quot;</span>).
68: <span class="ruby-identifier">gsub</span>(<span class="ruby-value str">&quot;&lt;&quot;</span>, <span class="ruby-value str">&quot;&amp;lt;&quot;</span>).
69: <span class="ruby-identifier">gsub</span>(<span class="ruby-value str">&quot;&gt;&quot;</span>, <span class="ruby-value str">&quot;&amp;gt;&quot;</span>).
70: <span class="ruby-identifier">gsub</span>(<span class="ruby-value str">&quot;'&quot;</span>, <span class="ruby-value str">&quot;&amp;#39;&quot;</span>).
71: <span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'&quot;'</span>, <span class="ruby-value str">&quot;&amp;quot;&quot;</span>)
72: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000024" class="method-detail">
<a name="M000024"></a>
<div class="method-heading">
<a href="#M000024" class="method-signature">
<span class="method-name">parse_query</span><span class="method-args">(qs, d = '&amp;;')</span>
</a>
</div>
<div class="method-description">
<p>
Stolen from Mongrel, with some small modifications: Parses a query string
by breaking it up at the &#8217;&amp;&#8217; and &#8217;;&#8217;
characters. You can also use this to parse cookies by changing the
characters used in the second parameter (which defaults to
&#8217;&amp;;&#8217;).
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000024-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/utils.rb, line 33</span>
33: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_query</span>(<span class="ruby-identifier">qs</span>, <span class="ruby-identifier">d</span> = <span class="ruby-value str">'&amp;;'</span>)
34: <span class="ruby-identifier">params</span> = {}
35:
36: (<span class="ruby-identifier">qs</span> <span class="ruby-operator">||</span> <span class="ruby-value str">''</span>).<span class="ruby-identifier">split</span>(<span class="ruby-node">/[#{d}] */n</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
37: <span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span> = <span class="ruby-identifier">unescape</span>(<span class="ruby-identifier">p</span>).<span class="ruby-identifier">split</span>(<span class="ruby-value str">'='</span>, <span class="ruby-value">2</span>)
38:
39: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cur</span> = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>]
40: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cur</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Array</span>
41: <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">v</span>
42: <span class="ruby-keyword kw">else</span>
43: <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] = [<span class="ruby-identifier">cur</span>, <span class="ruby-identifier">v</span>]
44: <span class="ruby-keyword kw">end</span>
45: <span class="ruby-keyword kw">else</span>
46: <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
47: <span class="ruby-keyword kw">end</span>
48: <span class="ruby-keyword kw">end</span>
49:
50: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">params</span>
51: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000027" class="method-detail">
<a name="M000027"></a>
<div class="method-heading">
<a href="#M000027" class="method-signature">
<span class="method-name">select_best_encoding</span><span class="method-args">(available_encodings, accept_encoding)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000027-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/utils.rb, line 75</span>
75: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">select_best_encoding</span>(<span class="ruby-identifier">available_encodings</span>, <span class="ruby-identifier">accept_encoding</span>)
76: <span class="ruby-comment cmt"># http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html</span>
77:
78: <span class="ruby-identifier">expanded_accept_encoding</span> =
79: <span class="ruby-identifier">accept_encoding</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span>, <span class="ruby-identifier">q</span><span class="ruby-operator">|</span>
80: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">m</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;*&quot;</span>
81: (<span class="ruby-identifier">available_encodings</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">accept_encoding</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m2</span>, <span class="ruby-identifier">_</span><span class="ruby-operator">|</span> <span class="ruby-identifier">m2</span> }).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m2</span><span class="ruby-operator">|</span> [<span class="ruby-identifier">m2</span>, <span class="ruby-identifier">q</span>] }
82: <span class="ruby-keyword kw">else</span>
83: [[<span class="ruby-identifier">m</span>, <span class="ruby-identifier">q</span>]]
84: <span class="ruby-keyword kw">end</span>
85: }.<span class="ruby-identifier">inject</span>([]) { <span class="ruby-operator">|</span><span class="ruby-identifier">mem</span>, <span class="ruby-identifier">list</span><span class="ruby-operator">|</span>
86: <span class="ruby-identifier">mem</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">list</span>
87: }
88:
89: <span class="ruby-identifier">encoding_candidates</span> = <span class="ruby-identifier">expanded_accept_encoding</span>.<span class="ruby-identifier">sort_by</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">_</span>, <span class="ruby-identifier">q</span><span class="ruby-operator">|</span> <span class="ruby-operator">-</span><span class="ruby-identifier">q</span> }.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span>, <span class="ruby-identifier">_</span><span class="ruby-operator">|</span> <span class="ruby-identifier">m</span> }
90:
91: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">encoding_candidates</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">&quot;identity&quot;</span>)
92: <span class="ruby-identifier">encoding_candidates</span>.<span class="ruby-identifier">push</span>(<span class="ruby-value str">&quot;identity&quot;</span>)
93: <span class="ruby-keyword kw">end</span>
94:
95: <span class="ruby-identifier">expanded_accept_encoding</span>.<span class="ruby-identifier">find_all</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span>, <span class="ruby-identifier">q</span><span class="ruby-operator">|</span>
96: <span class="ruby-identifier">q</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span><span class="ruby-value">.0</span>
97: }.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span>, <span class="ruby-identifier">_</span><span class="ruby-operator">|</span>
98: <span class="ruby-identifier">encoding_candidates</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">m</span>)
99: }
100:
101: <span class="ruby-keyword kw">return</span> (<span class="ruby-identifier">encoding_candidates</span> <span class="ruby-operator">&amp;</span> <span class="ruby-identifier">available_encodings</span>)[<span class="ruby-value">0</span>]
102: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000023" class="method-detail">
<a name="M000023"></a>
<div class="method-heading">
<a href="#M000023" class="method-signature">
<span class="method-name">unescape</span><span class="method-args">(s)</span>
</a>
</div>
<div class="method-description">
<p>
Unescapes a URI escaped string. (Stolen from Camping).
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000023-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/utils.rb, line 20</span>
20: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unescape</span>(<span class="ruby-identifier">s</span>)
21: <span class="ruby-identifier">s</span>.<span class="ruby-identifier">tr</span>(<span class="ruby-value str">'+'</span>, <span class="ruby-value str">' '</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/((?:%[0-9a-fA-F]{2})+)/n</span>){
22: [<span class="ruby-identifier">$1</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'%'</span>)].<span class="ruby-identifier">pack</span>(<span class="ruby-value str">'H*'</span>)
23: }
24: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,299 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Utils::Context</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Utils::Context</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/utils_rb.html">
lib/rack/utils.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Proc
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
The recommended manner in which to implement a contexting application is to
define a method <a href="Context.html#M000031">context</a> in which a <a
href="Context.html#M000029">new</a> <a href="Context.html">Context</a> is
instantiated.
</p>
<p>
As a <a href="Context.html">Context</a> is a glorified block, it is highly
recommended that you define the contextual block within the
application&#8216;s operational scope. This would typically the application
as you&#8216;re place into <a href="../../Rack.html">Rack</a>&#8216;s
stack.
</p>
<pre>
class MyObject
...
def context app
Rack::Utils::Context.new app do |env|
do_stuff
response = app.call(env)
do_more_stuff
end
end
...
end
</pre>
<p>
mobj = MyObject.new app = mobj.context other_app Rack::Handler::Mongrel.new
app
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000031">context</a>&nbsp;&nbsp;
<a href="#M000030">inspect</a>&nbsp;&nbsp;
<a href="#M000029">new</a>&nbsp;&nbsp;
<a href="#M000032">pretty_print</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="aliases-list">
<h3 class="section-bar">External Aliases</h3>
<div class="name-list">
<table summary="aliases">
<tr class="top-aligned-row context-row">
<td class="context-item-name">inspect</td>
<td>-&gt;</td>
<td class="context-item-value">old_inspect</td>
</tr>
</table>
</div>
</div>
<div id="attribute-list">
<h3 class="section-bar">Attributes</h3>
<div class="name-list">
<table>
<tr class="top-aligned-row context-row">
<td class="context-item-name">app</td>
<td class="context-item-value">&nbsp;[R]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">for</td>
<td class="context-item-value">&nbsp;[R]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000029" class="method-detail">
<a name="M000029"></a>
<div class="method-heading">
<a href="#M000029" class="method-signature">
<span class="method-name">new</span><span class="method-args">(app_f, app_r)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000029-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/utils.rb, line 130</span>
130: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">app_f</span>, <span class="ruby-identifier">app_r</span>
131: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'running context not provided'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">app_f</span>
132: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'running context does not respond to #context'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">app_f</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:context</span>
133: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'application context not provided'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">app_r</span>
134: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'application context does not respond to #call'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">app_r</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:call</span>
135: <span class="ruby-ivar">@for</span> = <span class="ruby-identifier">app_f</span>
136: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app_r</span>
137: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000031" class="method-detail">
<a name="M000031"></a>
<div class="method-heading">
<a href="#M000031" class="method-signature">
<span class="method-name">context</span><span class="method-args">(app_r)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000031-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/utils.rb, line 141</span>
141: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">context</span> <span class="ruby-identifier">app_r</span>
142: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'new application context not provided'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">app_r</span>
143: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'new application context does not respond to #call'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">app_r</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:call</span>
144: <span class="ruby-ivar">@for</span>.<span class="ruby-identifier">context</span> <span class="ruby-identifier">app_r</span>
145: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000030" class="method-detail">
<a name="M000030"></a>
<div class="method-heading">
<a href="#M000030" class="method-signature">
<span class="method-name">inspect</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000030-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/utils.rb, line 138</span>
138: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
139: <span class="ruby-node">&quot;#{old_inspect} ==&gt; #{@for.inspect} ==&gt; #{@app.inspect}&quot;</span>
140: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000032" class="method-detail">
<a name="M000032"></a>
<div class="method-heading">
<a href="#M000032" class="method-signature">
<span class="method-name">pretty_print</span><span class="method-args">(pp)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000032-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/utils.rb, line 146</span>
146: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pretty_print</span> <span class="ruby-identifier">pp</span>
147: <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">text</span> <span class="ruby-identifier">old_inspect</span>
148: <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">nest</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">do</span>
149: <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">breakable</span>
150: <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">text</span> <span class="ruby-value str">'=for&gt; '</span>
151: <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">pp</span> <span class="ruby-ivar">@for</span>
152: <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">breakable</span>
153: <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">text</span> <span class="ruby-value str">'=app&gt; '</span>
154: <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">pp</span> <span class="ruby-ivar">@app</span>
155: <span class="ruby-keyword kw">end</span>
156: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,373 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Rack::Utils::HeaderHash</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Rack::Utils::HeaderHash</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/utils_rb.html">
lib/rack/utils.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Hash
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
A case-insensitive Hash that preserves the original case of a header when
set.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000035">[]</a>&nbsp;&nbsp;
<a href="#M000036">[]=</a>&nbsp;&nbsp;
<a href="#M000037">delete</a>&nbsp;&nbsp;
<a href="#M000039">has_key?</a>&nbsp;&nbsp;
<a href="#M000038">include?</a>&nbsp;&nbsp;
<a href="#M000041">key?</a>&nbsp;&nbsp;
<a href="#M000040">member?</a>&nbsp;&nbsp;
<a href="#M000043">merge</a>&nbsp;&nbsp;
<a href="#M000042">merge!</a>&nbsp;&nbsp;
<a href="#M000033">new</a>&nbsp;&nbsp;
<a href="#M000034">to_hash</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000033" class="method-detail">
<a name="M000033"></a>
<div class="method-heading">
<a href="#M000033" class="method-signature">
<span class="method-name">new</span><span class="method-args">(hash={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000033-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/utils.rb, line 162</span>
162: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">hash</span>={})
163: <span class="ruby-ivar">@names</span> = {}
164: <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span> }
165: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000035" class="method-detail">
<a name="M000035"></a>
<div class="method-heading">
<a href="#M000035" class="method-signature">
<span class="method-name">[]</span><span class="method-args">(k)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000035-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/utils.rb, line 171</span>
171: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">k</span>)
172: <span class="ruby-keyword kw">super</span> <span class="ruby-ivar">@names</span>[<span class="ruby-identifier">k</span>.<span class="ruby-identifier">downcase</span>]
173: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000036" class="method-detail">
<a name="M000036"></a>
<div class="method-heading">
<a href="#M000036" class="method-signature">
<span class="method-name">[]=</span><span class="method-args">(k, v)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000036-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/utils.rb, line 175</span>
175: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>)
176: <span class="ruby-identifier">delete</span> <span class="ruby-identifier">k</span>
177: <span class="ruby-ivar">@names</span>[<span class="ruby-identifier">k</span>.<span class="ruby-identifier">downcase</span>] = <span class="ruby-identifier">k</span>
178: <span class="ruby-keyword kw">super</span> <span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>
179: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000037" class="method-detail">
<a name="M000037"></a>
<div class="method-heading">
<a href="#M000037" class="method-signature">
<span class="method-name">delete</span><span class="method-args">(k)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000037-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/utils.rb, line 181</span>
181: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">k</span>)
182: <span class="ruby-keyword kw">super</span> <span class="ruby-ivar">@names</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">k</span>.<span class="ruby-identifier">downcase</span>)
183: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000039" class="method-detail">
<a name="M000039"></a>
<div class="method-heading">
<span class="method-name">has_key?</span><span class="method-args">(k)</span>
</div>
<div class="method-description">
<p>
Alias for include?
</p>
</div>
</div>
<div id="method-M000038" class="method-detail">
<a name="M000038"></a>
<div class="method-heading">
<a href="#M000038" class="method-signature">
<span class="method-name">include?</span><span class="method-args">(k)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000038-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/utils.rb, line 185</span>
185: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">include?</span>(<span class="ruby-identifier">k</span>)
186: <span class="ruby-ivar">@names</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">downcase</span>
187: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000041" class="method-detail">
<a name="M000041"></a>
<div class="method-heading">
<span class="method-name">key?</span><span class="method-args">(k)</span>
</div>
<div class="method-description">
<p>
Alias for include?
</p>
</div>
</div>
<div id="method-M000040" class="method-detail">
<a name="M000040"></a>
<div class="method-heading">
<span class="method-name">member?</span><span class="method-args">(k)</span>
</div>
<div class="method-description">
<p>
Alias for include?
</p>
</div>
</div>
<div id="method-M000043" class="method-detail">
<a name="M000043"></a>
<div class="method-heading">
<a href="#M000043" class="method-signature">
<span class="method-name">merge</span><span class="method-args">(other)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000043-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000043-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/utils.rb, line 198</span>
198: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">merge</span>(<span class="ruby-identifier">other</span>)
199: <span class="ruby-identifier">hash</span> = <span class="ruby-identifier">dup</span>
200: <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">other</span>
201: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000042" class="method-detail">
<a name="M000042"></a>
<div class="method-heading">
<a href="#M000042" class="method-signature">
<span class="method-name">merge!</span><span class="method-args">(other)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000042-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000042-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/utils.rb, line 193</span>
193: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">other</span>)
194: <span class="ruby-identifier">other</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span> }
195: <span class="ruby-keyword kw">self</span>
196: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000034" class="method-detail">
<a name="M000034"></a>
<div class="method-heading">
<a href="#M000034" class="method-signature">
<span class="method-name">to_hash</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000034-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/utils.rb, line 167</span>
167: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_hash</span>
168: {}.<span class="ruby-identifier">replace</span>(<span class="ruby-keyword kw">self</span>)
169: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,246 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Rack::Utils::Multipart</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Rack::Utils::Multipart</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/rack/utils_rb.html">
lib/rack/utils.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
A multipart form data parser, adapted from IOWA.
</p>
<p>
Usually, <a href="../Request.html#M000177">Rack::Request#POST</a> takes
care of calling this.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000028">parse_multipart</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">EOL</td>
<td>=</td>
<td class="context-item-value">&quot;\r\n&quot;</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000028" class="method-detail">
<a name="M000028"></a>
<div class="method-heading">
<a href="#M000028" class="method-signature">
<span class="method-name">parse_multipart</span><span class="method-args">(env)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000028-source">
<pre>
<span class="ruby-comment cmt"># File lib/rack/utils.rb, line 259</span>
259: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse_multipart</span>(<span class="ruby-identifier">env</span>)
260: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">'CONTENT_TYPE'</span>] <span class="ruby-operator">=~</span>
261: <span class="ruby-regexp re">%r|\Amultipart/form-data.*boundary=\&quot;?([^\&quot;;,]+)\&quot;?|n</span>
262: <span class="ruby-keyword kw">nil</span>
263: <span class="ruby-keyword kw">else</span>
264: <span class="ruby-identifier">boundary</span> = <span class="ruby-node">&quot;--#{$1}&quot;</span>
265:
266: <span class="ruby-identifier">params</span> = {}
267: <span class="ruby-identifier">buf</span> = <span class="ruby-value str">&quot;&quot;</span>
268: <span class="ruby-identifier">content_length</span> = <span class="ruby-identifier">env</span>[<span class="ruby-value str">'CONTENT_LENGTH'</span>].<span class="ruby-identifier">to_i</span>
269: <span class="ruby-identifier">input</span> = <span class="ruby-identifier">env</span>[<span class="ruby-value str">'rack.input'</span>]
270:
271: <span class="ruby-identifier">boundary_size</span> = <span class="ruby-identifier">boundary</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">+</span> <span class="ruby-constant">EOL</span>.<span class="ruby-identifier">size</span>
272: <span class="ruby-identifier">bufsize</span> = <span class="ruby-value">16384</span>
273:
274: <span class="ruby-identifier">content_length</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">boundary_size</span>
275:
276: <span class="ruby-identifier">status</span> = <span class="ruby-identifier">input</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">boundary_size</span>)
277: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EOFError</span>, <span class="ruby-value str">&quot;bad content body&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">boundary</span> <span class="ruby-operator">+</span> <span class="ruby-constant">EOL</span>
278:
279: <span class="ruby-identifier">rx</span> = <span class="ruby-node">/(?:#{EOL})?#{Regexp.quote boundary}(#{EOL}|--)/</span>
280:
281: <span class="ruby-identifier">loop</span> {
282: <span class="ruby-identifier">head</span> = <span class="ruby-keyword kw">nil</span>
283: <span class="ruby-identifier">body</span> = <span class="ruby-value str">''</span>
284: <span class="ruby-identifier">filename</span> = <span class="ruby-identifier">content_type</span> = <span class="ruby-identifier">name</span> = <span class="ruby-keyword kw">nil</span>
285:
286: <span class="ruby-keyword kw">until</span> <span class="ruby-identifier">head</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">buf</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">rx</span>
287: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">head</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">i</span> = <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">&quot;\r\n\r\n&quot;</span>)
288: <span class="ruby-identifier">head</span> = <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">+</span><span class="ruby-value">2</span>) <span class="ruby-comment cmt"># First \r\n</span>
289: <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>, <span class="ruby-value">2</span>) <span class="ruby-comment cmt"># Second \r\n</span>
290:
291: <span class="ruby-identifier">filename</span> = <span class="ruby-identifier">head</span>[<span class="ruby-regexp re">/Content-Disposition:.* filename=&quot;?([^\&quot;;]*)&quot;?/n</span><span class="ruby-identifier">i</span>, <span class="ruby-value">1</span>]
292: <span class="ruby-identifier">content_type</span> = <span class="ruby-identifier">head</span>[<span class="ruby-regexp re">/Content-Type: (.*)\r\n/n</span><span class="ruby-identifier">i</span>, <span class="ruby-value">1</span>]
293: <span class="ruby-identifier">name</span> = <span class="ruby-identifier">head</span>[<span class="ruby-regexp re">/Content-Disposition:.* name=&quot;?([^\&quot;;]*)&quot;?/n</span><span class="ruby-identifier">i</span>, <span class="ruby-value">1</span>]
294:
295: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">filename</span>
296: <span class="ruby-identifier">body</span> = <span class="ruby-constant">Tempfile</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;RackMultipart&quot;</span>)
297: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">binmode</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:binmode</span>)
298: <span class="ruby-keyword kw">end</span>
299:
300: <span class="ruby-keyword kw">next</span>
301: <span class="ruby-keyword kw">end</span>
302:
303: <span class="ruby-comment cmt"># Save the read body part.</span>
304: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">head</span> <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">boundary_size</span><span class="ruby-operator">+</span><span class="ruby-value">4</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">size</span>)
305: <span class="ruby-identifier">body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">-</span> (<span class="ruby-identifier">boundary_size</span><span class="ruby-operator">+</span><span class="ruby-value">4</span>))
306: <span class="ruby-keyword kw">end</span>
307:
308: <span class="ruby-identifier">c</span> = <span class="ruby-identifier">input</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">bufsize</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">content_length</span> <span class="ruby-value">? </span><span class="ruby-identifier">bufsize</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">content_length</span>)
309: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EOFError</span>, <span class="ruby-value str">&quot;bad content body&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">empty?</span>
310: <span class="ruby-identifier">buf</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">c</span>
311: <span class="ruby-identifier">content_length</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">size</span>
312: <span class="ruby-keyword kw">end</span>
313:
314: <span class="ruby-comment cmt"># Save the rest.</span>
315: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span> = <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">rx</span>)
316: <span class="ruby-identifier">body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">i</span>)
317: <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">boundary_size</span><span class="ruby-operator">+</span><span class="ruby-value">2</span>)
318:
319: <span class="ruby-identifier">content_length</span> = <span class="ruby-value">-1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$1</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;--&quot;</span>
320: <span class="ruby-keyword kw">end</span>
321:
322: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">filename</span>
323: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">rewind</span>
324: <span class="ruby-identifier">data</span> = {<span class="ruby-identifier">:filename</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">filename</span>, <span class="ruby-identifier">:type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">content_type</span>,
325: <span class="ruby-identifier">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">name</span>, <span class="ruby-identifier">:tempfile</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">body</span>, <span class="ruby-identifier">:head</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">head</span>}
326: <span class="ruby-keyword kw">else</span>
327: <span class="ruby-identifier">data</span> = <span class="ruby-identifier">body</span>
328: <span class="ruby-keyword kw">end</span>
329:
330: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">name</span>
331: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">name</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\[\]\z/</span>
332: <span class="ruby-identifier">params</span>[<span class="ruby-identifier">name</span>] <span class="ruby-operator">||=</span> []
333: <span class="ruby-identifier">params</span>[<span class="ruby-identifier">name</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">data</span>
334: <span class="ruby-keyword kw">else</span>
335: <span class="ruby-identifier">params</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">data</span>
336: <span class="ruby-keyword kw">end</span>
337: <span class="ruby-keyword kw">end</span>
338:
339: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">content_length</span> <span class="ruby-operator">==</span> <span class="ruby-value">-1</span>
340: }
341:
342: <span class="ruby-identifier">params</span>
343: <span class="ruby-keyword kw">end</span>
344: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1 +0,0 @@
Fri, 09 Jan 2009 17:40:34 +0100

View File

@ -1,127 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: KNOWN-ISSUES</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>KNOWN-ISSUES</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>KNOWN-ISSUES
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Sat Mar 03 11:16:44 +0100 2007</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<h1>Known issues with <a href="../classes/Rack.html">Rack</a> and Web servers</h1>
<ul>
<li>Lighttpd sets wrong SCRIPT_NAME and PATH_INFO if you mount your FastCGI app
at &quot;/&quot;. This can be fixed by using this middleware:
<pre>
class LighttpdScriptNameFix
def initialize(app)
@app = app
end
def call(env)
env[&quot;PATH_INFO&quot;] = env[&quot;SCRIPT_NAME&quot;].to_s + env[&quot;PATH_INFO&quot;].to_s
env[&quot;SCRIPT_NAME&quot;] = &quot;&quot;
@app.call(env)
end
end
</pre>
<p>
Of course, use this only when your app runs at &quot;/&quot;.
</p>
</li>
</ul>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,961 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: RDOX</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>RDOX</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>RDOX
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Fri Jan 09 17:40:33 +0100 2009</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<h2><a href="../classes/Rack/Auth/Basic.html">Rack::Auth::Basic</a></h2>
<ul>
<li>should challenge correctly when no credentials are specified
</li>
<li>should rechallenge if incorrect credentials are specified
</li>
<li>should return application output if correct credentials are specified
</li>
<li>should return 400 Bad Request if different auth scheme used
</li>
</ul>
<h2>Rack::Auth::Digest::MD5</h2>
<ul>
<li>should challenge when no credentials are specified
</li>
<li>should return application output if correct credentials given
</li>
<li>should return application output if correct credentials given (hashed
passwords)
</li>
<li>should rechallenge if incorrect username given
</li>
<li>should rechallenge if incorrect password given
</li>
<li>should rechallenge with stale parameter if nonce is stale
</li>
<li>should return 400 Bad Request if incorrect qop given
</li>
<li>should return 400 Bad Request if incorrect uri given
</li>
<li>should return 400 Bad Request if different auth scheme used
</li>
</ul>
<h2><a href="../classes/Rack/Auth/OpenID.html">Rack::Auth::OpenID</a></h2>
<ul>
<li>realm uri should be absolute and have a path
</li>
<li>uri options should be absolute
</li>
<li>return_to should be absolute and be under the realm
</li>
<li>extensions should be a module
</li>
<li>extensions should have required constants defined
</li>
<li>extensions should have Request and Response defined and inherit from
OpenID::Extension
</li>
<li>extensions should have NS_URI defined and be a string of an absolute http
uri
</li>
</ul>
<h2><a href="../classes/Rack/Builder.html">Rack::Builder</a></h2>
<ul>
<li>chains apps by default
</li>
<li>has implicit to_app
</li>
<li>supports blocks on use
</li>
<li>has explicit to_app
</li>
<li>apps are initialized once
</li>
</ul>
<h2><a href="../classes/Rack/Adapter/Camping.html">Rack::Adapter::Camping</a></h2>
<ul>
<li>works with GET
</li>
<li>works with POST
</li>
</ul>
<h2><a href="../classes/Rack/Cascade.html">Rack::Cascade</a></h2>
<ul>
<li>should dispatch onward on 404 by default
</li>
<li>should dispatch onward on whatever is passed
</li>
<li>should fail if empty
</li>
<li>should append new app
</li>
</ul>
<h2><a href="../classes/Rack/Handler/CGI.html">Rack::Handler::CGI</a></h2>
<ul>
<li>startup (empty)
</li>
<li>should respond
</li>
<li>should be a lighttpd
</li>
<li>should have rack headers
</li>
<li>should have CGI headers on GET
</li>
<li>should have CGI headers on POST
</li>
<li>should support HTTP auth
</li>
<li>should set status
</li>
<li>shutdown
</li>
</ul>
<h2><a href="../classes/Rack/CommonLogger.html">Rack::CommonLogger</a></h2>
<ul>
<li>should log to rack.errors by default
</li>
<li>should log to anything with &lt;&lt;
</li>
</ul>
<h2><a href="../classes/Rack/ConditionalGet.html">Rack::ConditionalGet</a></h2>
<ul>
<li>should set a 304 status and truncate body when If-Modified-Since hits
</li>
<li>should set a 304 status and truncate body when If-None-Match hits
</li>
<li>should not affect non-GET/HEAD requests
</li>
</ul>
<h2><a href="../classes/Rack/ContentLength.html">Rack::ContentLength</a></h2>
<ul>
<li>sets Content-Length on String bodies if none is set
</li>
<li>sets Content-Length on Array bodies if none is set
</li>
<li>does not set Content-Length on variable length bodies
</li>
<li>does not change Content-Length if it is already set
</li>
<li>does not set Content-Length on 304 responses
</li>
<li>does not set Content-Length when Transfer-Encoding is chunked
</li>
</ul>
<h2><a href="../classes/Rack/Deflater.html">Rack::Deflater</a></h2>
<ul>
<li>should be able to deflate bodies that respond to each
</li>
<li>should be able to deflate String bodies
</li>
<li>should be able to gzip bodies that respond to each
</li>
<li>should be able to fallback to no deflation
</li>
<li>should be able to skip when there is no response entity body
</li>
<li>should handle the lack of an acceptable encoding
</li>
<li>should handle gzip response with Last-Modified header
</li>
<li>should do nothing when no-transform Cache-Control directive present
</li>
</ul>
<h2><a href="../classes/Rack/Directory.html">Rack::Directory</a></h2>
<ul>
<li>serves directory indices
</li>
<li>passes to app if file found
</li>
<li>serves uri with URL encoded filenames
</li>
<li>does not allow directory traversal
</li>
<li>404s if it can&#8216;t find the file
</li>
</ul>
<h2><a href="../classes/Rack/Handler/FastCGI.html">Rack::Handler::FastCGI</a></h2>
<ul>
<li>startup (empty)
</li>
<li>should respond
</li>
<li>should be a lighttpd
</li>
<li>should have rack headers
</li>
<li>should have CGI headers on GET
</li>
<li>should have CGI headers on POST
</li>
<li>should support HTTP auth
</li>
<li>should set status
</li>
<li>shutdown
</li>
</ul>
<h2><a href="../classes/Rack/File.html">Rack::File</a></h2>
<ul>
<li>serves files
</li>
<li>sets Last-Modified header
</li>
<li>serves files with URL encoded filenames
</li>
<li>does not allow directory traversal
</li>
<li>does not allow directory traversal with encoded periods
</li>
<li>404s if it can&#8216;t find the file
</li>
<li>detects SystemCallErrors
</li>
</ul>
<h2><a href="../classes/Rack/Handler.html">Rack::Handler</a></h2>
<ul>
<li>has registered default handlers
</li>
<li>should get unregistered handler by name
</li>
<li>should register custom handler
</li>
</ul>
<h2><a href="../classes/Rack/Head.html">Rack::Head</a></h2>
<ul>
<li>response (empty)
</li>
<li>passes GET, POST, PUT, DELETE, OPTIONS, TRACE requests
</li>
<li>removes body from HEAD requests
</li>
</ul>
<h2><a href="../classes/Rack/Lint.html">Rack::Lint</a></h2>
<ul>
<li>passes valid request
</li>
<li>notices fatal errors
</li>
<li>notices environment errors
</li>
<li>notices input errors
</li>
<li>notices error errors
</li>
<li>notices status errors
</li>
<li>notices header errors
</li>
<li>notices content-type errors
</li>
<li>notices content-length errors
</li>
<li>notices body errors
</li>
<li>notices input handling errors
</li>
<li>notices error handling errors
</li>
<li>notices HEAD errors
</li>
</ul>
<h2>Rack::Lint::InputWrapper</h2>
<ul>
<li>delegates :size to underlying IO object
</li>
<li>delegates :rewind to underlying IO object
</li>
</ul>
<h2>Rack::Lobster::LambdaLobster</h2>
<ul>
<li>should be a single lambda
</li>
<li>should look like a lobster
</li>
<li>should be flippable
</li>
</ul>
<h2><a href="../classes/Rack/Lobster.html">Rack::Lobster</a></h2>
<ul>
<li>should look like a lobster
</li>
<li>should be flippable
</li>
<li>should provide crashing for testing purposes
</li>
</ul>
<h2><a href="../classes/Rack/MethodOverride.html">Rack::MethodOverride</a></h2>
<ul>
<li>should not affect GET requests
</li>
<li>_method parameter should modify REQUEST_METHOD for POST requests
</li>
<li>X-HTTP-Method-Override header should modify REQUEST_METHOD for POST
requests
</li>
<li>should not modify REQUEST_METHOD if the method is unknown
</li>
<li>should not modify REQUEST_METHOD when _method is nil
</li>
<li>should store the original REQUEST_METHOD prior to overriding
</li>
</ul>
<h2><a href="../classes/Rack/MockRequest.html">Rack::MockRequest</a></h2>
<ul>
<li>should return a MockResponse
</li>
<li>should be able to only return the environment
</li>
<li>should provide sensible defaults
</li>
<li>should allow GET/POST/PUT/DELETE
</li>
<li>should allow posting
</li>
<li>should use all parts of an URL
</li>
<li>should behave valid according to the <a
href="../classes/Rack.html">Rack</a> spec
</li>
</ul>
<h2><a href="../classes/Rack/MockResponse.html">Rack::MockResponse</a></h2>
<ul>
<li>should provide access to the HTTP status
</li>
<li>should provide access to the HTTP headers
</li>
<li>should provide access to the HTTP body
</li>
<li>should provide access to the <a href="../classes/Rack.html">Rack</a> errors
</li>
<li>should optionally make <a href="../classes/Rack.html">Rack</a> errors fatal
</li>
</ul>
<h2><a href="../classes/Rack/Handler/Mongrel.html">Rack::Handler::Mongrel</a></h2>
<ul>
<li>should respond
</li>
<li>should be a Mongrel
</li>
<li>should have rack headers
</li>
<li>should have CGI headers on GET
</li>
<li>should have CGI headers on POST
</li>
<li>should support HTTP auth
</li>
<li>should set status
</li>
<li>should provide a .run
</li>
<li>should provide a .run that maps a hash
</li>
<li>should provide a .run that maps a urlmap
</li>
<li>should provide a .run that maps a urlmap restricting by host
</li>
<li>should stream each part of the response
</li>
</ul>
<h2><a href="../classes/Rack/Recursive.html">Rack::Recursive</a></h2>
<ul>
<li>should allow for subrequests
</li>
<li>should raise error on requests not below the app
</li>
<li>should support forwarding
</li>
</ul>
<h2><a href="../classes/Rack/Request.html">Rack::Request</a></h2>
<ul>
<li>wraps the rack variables
</li>
<li>can figure out the correct host
</li>
<li>can parse the query string
</li>
<li>can parse POST data
</li>
<li>can parse POST data with explicit content type
</li>
<li>does not parse POST data when media type is not form-data
</li>
<li>rewinds input after parsing POST data
</li>
<li>does not rewind unwindable CGI input
</li>
<li>can get value by key from params with #[]
</li>
<li>can set value to key on params with #[]=
</li>
<li>values_at answers values by keys in order given
</li>
<li>referrer should be extracted correct
</li>
<li>can cache, but invalidates the cache
</li>
<li>can figure out if called via XHR
</li>
<li>can parse cookies
</li>
<li>parses cookies according to RFC 2109
</li>
<li>provides setters
</li>
<li>provides the original env
</li>
<li>can restore the URL
</li>
<li>can restore the full path
</li>
<li>can handle multiple media type parameters
</li>
<li>can parse multipart form data
</li>
<li>can parse big multipart form data
</li>
<li>can detect invalid multipart form data
</li>
<li>should work around buggy 1.8.* Tempfile equality
</li>
<li>does conform to the <a href="../classes/Rack.html">Rack</a> spec
</li>
<li>should parse Accept-Encoding correctly
</li>
<li>should provide ip information
</li>
</ul>
<h2><a href="../classes/Rack/Response.html">Rack::Response</a></h2>
<ul>
<li>has sensible default values
</li>
<li>can be written to
</li>
<li>can set and read headers
</li>
<li>can set cookies
</li>
<li>formats the Cookie expiration date accordingly to RFC 2109
</li>
<li>can set secure cookies
</li>
<li>can delete cookies
</li>
<li>has a useful constructor
</li>
<li>has a constructor that can take a block
</li>
<li>doesn&#8216;t return invalid responses
</li>
<li>knows if it&#8216;s empty
</li>
<li>should provide access to the HTTP status
</li>
<li>should provide access to the HTTP headers
</li>
</ul>
<h2><a href="../classes/Rack/Session/Cookie.html">Rack::Session::Cookie</a></h2>
<ul>
<li>creates a new cookie
</li>
<li>loads from a cookie
</li>
<li>survives broken cookies
</li>
<li>barks on too big cookies
</li>
<li>creates a new cookie with integrity hash
</li>
<li>loads from a cookie wih integrity hash
</li>
<li>ignores tampered with session cookies
</li>
</ul>
<h2><a href="../classes/Rack/Session/Memcache.html">Rack::Session::Memcache</a></h2>
<ul>
<li>startup (empty)
</li>
<li>faults on no connection
</li>
<li>creates a new cookie
</li>
<li>determines session from a cookie
</li>
<li>survives broken cookies
</li>
<li>maintains freshness
</li>
<li>multithread: should cleanly merge sessions
</li>
<li>shutdown
</li>
</ul>
<h2><a href="../classes/Rack/Session/Pool.html">Rack::Session::Pool</a></h2>
<ul>
<li>creates a new cookie
</li>
<li>determines session from a cookie
</li>
<li>survives broken cookies
</li>
<li>maintains freshness
</li>
<li>multithread: should merge sessions
</li>
</ul>
<h2><a href="../classes/Rack/ShowExceptions.html">Rack::ShowExceptions</a></h2>
<ul>
<li>catches exceptions
</li>
</ul>
<h2><a href="../classes/Rack/ShowStatus.html">Rack::ShowStatus</a></h2>
<ul>
<li>should provide a default status message
</li>
<li>should let the app provide additional information
</li>
<li>should not replace existing messages
</li>
<li>should pass on original headers
</li>
<li>should replace existing messages if there is detail
</li>
</ul>
<h2><a href="../classes/Rack/Static.html">Rack::Static</a></h2>
<ul>
<li>serves files
</li>
<li>404s if url root is known but it can&#8216;t find the file
</li>
<li>calls down the chain if url root is not known
</li>
</ul>
<h2><a href="../classes/Rack/Handler/Thin.html">Rack::Handler::Thin</a></h2>
<ul>
<li>should respond
</li>
<li>should be a Thin
</li>
<li>should have rack headers
</li>
<li>should have CGI headers on GET
</li>
<li>should have CGI headers on POST
</li>
<li>should support HTTP auth
</li>
<li>should set status
</li>
</ul>
<h2><a href="../classes/Rack/URLMap.html">Rack::URLMap</a></h2>
<ul>
<li>dispatches paths correctly
</li>
<li>dispatches hosts correctly
</li>
<li>should be nestable
</li>
<li>should route root apps correctly
</li>
</ul>
<h2><a href="../classes/Rack/Utils.html">Rack::Utils</a></h2>
<ul>
<li>should escape correctly
</li>
<li>should unescape correctly
</li>
<li>should parse query strings correctly
</li>
<li>should build query strings correctly
</li>
<li>should figure out which encodings are acceptable
</li>
</ul>
<h2><a href="../classes/Rack/Utils/HeaderHash.html">Rack::Utils::HeaderHash</a></h2>
<ul>
<li>should retain header case
</li>
<li>should check existence of keys case insensitively
</li>
<li>should merge case-insensitively
</li>
<li>should overwrite case insensitively and assume the new key&#8216;s case
</li>
<li>should be converted to real Hash
</li>
</ul>
<h2><a href="../classes/Rack/Utils/Context.html">Rack::Utils::Context</a></h2>
<ul>
<li>should perform checks on both arguments
</li>
<li>should set context correctly
</li>
<li>should alter app on recontexting
</li>
<li>should run different apps
</li>
</ul>
<h2><a href="../classes/Rack/Handler/WEBrick.html">Rack::Handler::WEBrick</a></h2>
<ul>
<li>should respond
</li>
<li>should be a WEBrick
</li>
<li>should have rack headers
</li>
<li>should have CGI headers on GET
</li>
<li>should have CGI headers on POST
</li>
<li>should support HTTP auth
</li>
<li>should set status
</li>
<li>should correctly set cookies
</li>
<li>should provide a .run
</li>
</ul>
<p>
244 specifications, 4 empty (1004 requirements), 0 failures
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,720 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: README</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>README</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>README
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Fri Jan 09 17:31:18 +0100 2009</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<h1><a href="../classes/Rack.html">Rack</a>, a modular Ruby webserver interface</h1>
<p>
<a href="../classes/Rack.html">Rack</a> provides a minimal, modular and
adaptable interface for developing web applications in Ruby. By wrapping
HTTP requests and responses in the simplest way possible, it unifies and
distills the API for web servers, web frameworks, and software in between
(the so-called middleware) into a single method call.
</p>
<p>
The exact details of this are described in the <a
href="../classes/Rack.html">Rack</a> specification, which all <a
href="../classes/Rack.html">Rack</a> applications should conform to.
</p>
<h2>Supported web servers</h2>
<p>
The included <b>handlers</b> connect all kinds of web servers to <a
href="../classes/Rack.html">Rack</a>:
</p>
<ul>
<li>Mongrel
</li>
<li>EventedMongrel
</li>
<li>SwiftipliedMongrel
</li>
<li>WEBrick
</li>
<li>FCGI
</li>
<li>CGI
</li>
<li>SCGI
</li>
<li>LiteSpeed
</li>
<li>Thin
</li>
</ul>
<p>
These web servers include <a href="../classes/Rack.html">Rack</a> handlers
in their distributions:
</p>
<ul>
<li>Ebb
</li>
<li>Fuzed
</li>
<li>Phusion Passenger (which is mod_rack for Apache)
</li>
</ul>
<p>
Any valid <a href="../classes/Rack.html">Rack</a> app will run the same on
all these handlers, without changing anything.
</p>
<h2>Supported web frameworks</h2>
<p>
The included <b>adapters</b> connect <a
href="../classes/Rack.html">Rack</a> with existing Ruby web frameworks:
</p>
<ul>
<li>Camping
</li>
</ul>
<p>
These frameworks include <a href="../classes/Rack.html">Rack</a> adapters
in their distributions:
</p>
<ul>
<li>Coset
</li>
<li>Halcyon
</li>
<li>Mack
</li>
<li>Maveric
</li>
<li>Merb
</li>
<li>Racktools::SimpleApplication
</li>
<li>Ramaze
</li>
<li>Ruby on Rails
</li>
<li>Sinatra
</li>
<li>Sin
</li>
<li>Vintage
</li>
<li>Waves
</li>
</ul>
<p>
Current links to these projects can be found at <a
href="http://ramaze.net/#other-frameworks">ramaze.net/#other-frameworks</a>
</p>
<h2>Available middleware</h2>
<p>
Between the server and the framework, <a
href="../classes/Rack.html">Rack</a> can be customized to your applications
needs using middleware, for example:
</p>
<ul>
<li><a href="../classes/Rack/URLMap.html">Rack::URLMap</a>, to route to
multiple applications inside the same process.
</li>
<li><a href="../classes/Rack/CommonLogger.html">Rack::CommonLogger</a>, for
creating Apache-style logfiles.
</li>
<li>Rack::ShowException, for catching unhandled exceptions and presenting them
in a nice and helpful way with clickable backtrace.
</li>
<li><a href="../classes/Rack/File.html">Rack::File</a>, for serving static
files.
</li>
<li>&#8230;many others!
</li>
</ul>
<p>
All these components use the same interface, which is described in detail
in the <a href="../classes/Rack.html">Rack</a> specification. These
optional components can be used in any way you wish.
</p>
<h2>Convenience</h2>
<p>
If you want to develop outside of existing frameworks, implement your own
ones, or develop middleware, <a href="../classes/Rack.html">Rack</a>
provides many helpers to create <a href="../classes/Rack.html">Rack</a>
applications quickly and without doing the same web stuff all over:
</p>
<ul>
<li><a href="../classes/Rack/Request.html">Rack::Request</a>, which also
provides query string parsing and multipart handling.
</li>
<li><a href="../classes/Rack/Response.html">Rack::Response</a>, for convenient
generation of HTTP replies and cookie handling.
</li>
<li><a href="../classes/Rack/MockRequest.html">Rack::MockRequest</a> and <a
href="../classes/Rack/MockResponse.html">Rack::MockResponse</a> for
efficient and quick testing of <a href="../classes/Rack.html">Rack</a>
application without real HTTP round-trips.
</li>
</ul>
<h2>rack-contrib</h2>
<p>
The plethora of useful middleware created the need for a project that
collects fresh <a href="../classes/Rack.html">Rack</a> middleware.
rack-contrib includes a variety of add-on components for <a
href="../classes/Rack.html">Rack</a> and it is easy to contribute new
modules.
</p>
<ul>
<li><a
href="http://github.com/rack/rack-contrib">github.com/rack/rack-contrib</a>
</li>
</ul>
<h2>rackup</h2>
<p>
rackup is a useful tool for running <a href="../classes/Rack.html">Rack</a>
applications, which uses the <a
href="../classes/Rack/Builder.html">Rack::Builder</a> DSL to configure
middleware and build up applications easily.
</p>
<p>
rackup automatically figures out the environment it is run in, and runs
your application as FastCGI, CGI, or standalone with Mongrel or
WEBrick&#8212;all from the same configuration.
</p>
<h2>Quick start</h2>
<p>
Try the lobster!
</p>
<p>
Either with the embedded WEBrick starter:
</p>
<pre>
ruby -Ilib lib/rack/lobster.rb
</pre>
<p>
Or with rackup:
</p>
<pre>
bin/rackup -Ilib example/lobster.ru
</pre>
<p>
By default, the lobster is found at <a
href="http://localhost:9292">localhost:9292</a>.
</p>
<h2>Installing with RubyGems</h2>
<p>
A Gem of <a href="../classes/Rack.html">Rack</a> is available. You can
install it with:
</p>
<pre>
gem install rack
</pre>
<p>
I also provide a local mirror of the gems (and development snapshots) at my
site:
</p>
<pre>
gem install rack --source http://chneukirchen.org/releases/gems/
</pre>
<h2>Running the tests</h2>
<p>
Testing <a href="../classes/Rack.html">Rack</a> requires the test/spec
testing framework:
</p>
<pre>
gem install test-spec
</pre>
<p>
There are two rake-based test tasks:
</p>
<pre>
rake test tests all the fast tests (no Handlers or Adapters)
rake fulltest runs all the tests
</pre>
<p>
The fast testsuite has no dependencies outside of the core Ruby
installation and test-spec.
</p>
<p>
To run the test suite completely, you need:
</p>
<pre>
* camping
* mongrel
* fcgi
* ruby-openid
* memcache-client
</pre>
<p>
The full set of tests test FCGI access with lighttpd (on port 9203) so you
will need lighttpd installed as well as the FCGI libraries and the fcgi
gem:
</p>
<p>
Download and install lighttpd:
</p>
<pre>
http://www.lighttpd.net/download
</pre>
<p>
Installing the FCGI libraries:
</p>
<pre>
curl -O http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
tar xzvf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure --prefix=/usr/local
make
sudo make install
cd ..
</pre>
<p>
Installing the Ruby fcgi gem:
</p>
<pre>
gem install fcgi
</pre>
<p>
Furthermore, to test Memcache sessions, you need memcached (will be run on
port 11211) and memcache-client installed.
</p>
<h2>History</h2>
<ul>
<li>March 3rd, 2007: First public release 0.1.
</li>
<li>May 16th, 2007: Second public release 0.2.
<ul>
<li>HTTP Basic authentication.
</li>
<li>Cookie Sessions.
</li>
<li>Static file handler.
</li>
<li>Improved <a href="../classes/Rack/Request.html">Rack::Request</a>.
</li>
<li>Improved <a href="../classes/Rack/Response.html">Rack::Response</a>.
</li>
<li>Added <a href="../classes/Rack/ShowStatus.html">Rack::ShowStatus</a>, for
better default error messages.
</li>
<li>Bug fixes in the Camping adapter.
</li>
<li>Removed Rails adapter, was too alpha.
</li>
</ul>
</li>
<li>February 26th, 2008: Third public release 0.3.
<ul>
<li>LiteSpeed handler, by Adrian Madrid.
</li>
<li>SCGI handler, by Jeremy Evans.
</li>
<li>Pool sessions, by blink.
</li>
<li>OpenID authentication, by blink.
</li>
<li>:Port and :File options for opening FastCGI sockets, by blink.
</li>
<li>Last-Modified HTTP header for <a
href="../classes/Rack/File.html">Rack::File</a>, by blink.
</li>
<li>Rack::Builder#use now accepts blocks, by Corey Jewett. (See
example/protectedlobster.ru)
</li>
<li>HTTP status 201 can contain a Content-Type and a body now.
</li>
<li>Many bugfixes, especially related to Cookie handling.
</li>
</ul>
</li>
<li>August 21st, 2008: Fourth public release 0.4.
<ul>
<li>New middleware, <a href="../classes/Rack/Deflater.html">Rack::Deflater</a>,
by Christoffer Sawicki.
</li>
<li>OpenID authentication now needs ruby-openid 2.
</li>
<li>New Memcache sessions, by blink.
</li>
<li>Explicit EventedMongrel handler, by Joshua Peek &lt;josh@joshpeek.com&gt;
</li>
<li><a href="../classes/Rack/Reloader.html">Rack::Reloader</a> is not loaded in
rackup development mode.
</li>
<li>rackup can daemonize with -D.
</li>
<li>Many bugfixes, especially for pool sessions, URLMap, thread safety and
tempfile handling.
</li>
<li>Improved tests.
</li>
<li><a href="../classes/Rack.html">Rack</a> moved to Git.
</li>
</ul>
</li>
<li>January 6th, 2009: Fifth public release 0.9.
<ul>
<li><a href="../classes/Rack.html">Rack</a> is now managed by the <a
href="../classes/Rack.html">Rack</a> Core Team.
</li>
<li><a href="../classes/Rack/Lint.html">Rack::Lint</a> is stricter and follows
the HTTP RFCs more closely.
</li>
<li>Added ConditionalGet middleware.
</li>
<li>Added ContentLength middleware.
</li>
<li>Added Deflater middleware.
</li>
<li>Added Head middleware.
</li>
<li>Added MethodOverride middleware.
</li>
<li><a href="../classes/Rack/Mime.html">Rack::Mime</a> now provides popular
MIME-types and their extension.
</li>
<li>Mongrel Header now streams.
</li>
<li>Added Thin handler.
</li>
<li>Official support for swiftiplied Mongrel.
</li>
<li>Secure cookies.
</li>
<li>Made HeaderHash case-preserving.
</li>
<li>Many bugfixes and small improvements.
</li>
</ul>
</li>
<li>January 9th, 2009: Sixth public release 0.9.1.
<ul>
<li>Fix directory traversal exploits in <a
href="../classes/Rack/File.html">Rack::File</a> and <a
href="../classes/Rack/Directory.html">Rack::Directory</a>.
</li>
</ul>
</li>
</ul>
<h2>Contact</h2>
<p>
Please mail bugs, suggestions and patches to &lt;<a
href="mailto:rack-devel@googlegroups.com">rack-devel@googlegroups.com</a>&gt;.
</p>
<p>
Mailing list archives are available at &lt;<a
href="http://groups.google.com/group/rack-devel">groups.google.com/group/rack-devel</a>&gt;.
</p>
<p>
There is a bug tracker at &lt;<a
href="http://rack.lighthouseapp.com">rack.lighthouseapp.com</a>/&gt;.
</p>
<p>
Git repository (patches rebased on master are most welcome):
</p>
<ul>
<li><a href="http://github.com/rack/rack">github.com/rack/rack</a>
</li>
<li><a
href="http://git.vuxu.org/cgi-bin/gitweb.cgi?p=rack.git">git.vuxu.org/cgi-bin/gitweb.cgi?p=rack.git</a>
</li>
</ul>
<p>
You are also welcome to join the rack channel on irc.freenode.net.
</p>
<h2>Thanks</h2>
<p>
The <a href="../classes/Rack.html">Rack</a> Core Team, consisting of
</p>
<ul>
<li>Christian Neukirchen (chneukirchen)
</li>
<li>James Tucker (raggi)
</li>
<li>Josh Peek (josh)
</li>
<li>Michael Fellinger (manveru)
</li>
<li>Ryan Tomayko (rtomayko)
</li>
<li>Scytrin dai Kinthra (scytrin)
</li>
</ul>
<p>
would like to thank:
</p>
<ul>
<li>Adrian Madrid, for the LiteSpeed handler.
</li>
<li>Christoffer Sawicki, for the first Rails adapter and <a
href="../classes/Rack/Deflater.html">Rack::Deflater</a>.
</li>
<li>Tim Fletcher, for the HTTP authentication code.
</li>
<li>Luc Heinrich for the Cookie sessions, the static file handler and bugfixes.
</li>
<li>Armin Ronacher, for the logo and racktools.
</li>
<li>Aredridel, Ben Alpert, Dan Kubb, Daniel Roethlisberger, Matt Todd, Tom
Robinson, and Phil Hagelberg for bug fixing and other improvements.
</li>
<li>Stephen Bannasch, for bug reports and documentation.
</li>
<li>Gary Wright, for proposing a better <a
href="../classes/Rack/Response.html">Rack::Response</a> interface.
</li>
<li>Jonathan Buch, for improvements regarding <a
href="../classes/Rack/Response.html">Rack::Response</a>.
</li>
<li>Armin Röhrl, for tracking down bugs in the Cookie generator.
</li>
<li>Alexander Kellett for testing the Gem and reviewing the announcement.
</li>
<li>Marcus Rückert, for help with configuring and debugging lighttpd.
</li>
<li>The WSGI team for the well-done and documented work they&#8216;ve done and
<a href="../classes/Rack.html">Rack</a> builds up on.
</li>
<li>All bug reporters and patch contributers not mentioned above.
</li>
</ul>
<h2>Copyright</h2>
<p>
Copyright (C) 2007, 2008, 2009 Christian Neukirchen &lt;<a
href="http://purl.org/net/chneukirchen">purl.org/net/chneukirchen</a>&gt;
</p>
<p>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
&quot;Software&quot;), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the
following conditions:
</p>
<p>
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
</p>
<p>
THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
</p>
<h2>Links</h2>
<table>
<tr><td valign="top"><a href="../classes/Rack.html">Rack</a>:</td><td>&lt;<a href="http://rack.rubyforge.org">rack.rubyforge.org</a>/&gt;
</td></tr>
<tr><td valign="top"><a href="../classes/Rack.html">Rack</a>&#8216;s Rubyforge project:</td><td>&lt;<a
href="http://rubyforge.org/projects/rack">rubyforge.org/projects/rack</a>&gt;
</td></tr>
<tr><td valign="top">Official <a href="../classes/Rack.html">Rack</a> repositories:</td><td>&lt;<a href="http://github.com/rack">github.com/rack</a>&gt;
</td></tr>
<tr><td valign="top">rack-devel mailing list:</td><td>&lt;<a
href="http://groups.google.com/group/rack-devel">groups.google.com/group/rack-devel</a>&gt;
</td></tr>
<tr><td valign="top">Christian Neukirchen:</td><td>&lt;<a href="http://chneukirchen.org">chneukirchen.org</a>/&gt;
</td></tr>
</table>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,318 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: SPEC</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>SPEC</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>SPEC
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Fri Jan 09 17:40:06 +0100 2009</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
This specification aims to formalize the <a
href="../classes/Rack.html">Rack</a> protocol. You can (and should) use <a
href="../classes/Rack/Lint.html">Rack::Lint</a> to enforce it. When you
develop middleware, be sure to add a Lint before and after to catch all
mistakes.
</p>
<h1><a href="../classes/Rack.html">Rack</a> applications</h1>
<p>
A <a href="../classes/Rack.html">Rack</a> application is an Ruby object
(not a class) that responds to <tt>call</tt>. It takes exactly one
argument, the <b>environment</b> and returns an Array of exactly three
values: The <b>status</b>, the <b>headers</b>, and the <b>body</b>.
</p>
<h2>The Environment</h2>
<p>
The environment must be an true instance of Hash (no subclassing allowed)
that includes CGI-like headers. The application is free to modify the
environment. The environment is required to include these variables
(adopted from PEP333), except when they&#8216;d be empty, but see below.
</p>
<table>
<tr><td valign="top"><tt>REQUEST_METHOD</tt>:</td><td>The HTTP request method, such as &quot;GET&quot; or &quot;POST&quot;. This
cannot ever be an empty string, and so is always required.
</td></tr>
<tr><td valign="top"><tt>SCRIPT_NAME</tt>:</td><td>The initial portion of the request URL&#8216;s &quot;path&quot; that
corresponds to the application object, so that the application knows its
virtual &quot;location&quot;. This may be an empty string, if the
application corresponds to the &quot;root&quot; of the server.
</td></tr>
<tr><td valign="top"><tt>PATH_INFO</tt>:</td><td>The remainder of the request URL&#8216;s &quot;path&quot;, designating the
virtual &quot;location&quot; of the request&#8216;s target within the
application. This may be an empty string, if the request URL targets the
application root and does not have a trailing slash.
</td></tr>
<tr><td valign="top"><tt>QUERY_STRING</tt>:</td><td>The portion of the request URL that follows the <tt>?</tt>, if any. May be
empty, but is always required!
</td></tr>
<tr><td valign="top"><tt>SERVER_NAME</tt>, <tt>SERVER_PORT</tt>:</td><td>When combined with <tt>SCRIPT_NAME</tt> and <tt>PATH_INFO</tt>, these
variables can be used to complete the URL. Note, however, that
<tt>HTTP_HOST</tt>, if present, should be used in preference to
<tt>SERVER_NAME</tt> for reconstructing the request URL.
<tt>SERVER_NAME</tt> and <tt>SERVER_PORT</tt> can never be empty strings,
and so are always required.
</td></tr>
<tr><td valign="top"><tt>HTTP_</tt> Variables:</td><td>Variables corresponding to the client-supplied HTTP request headers (i.e.,
variables whose names begin with <tt>HTTP_</tt>). The presence or absence
of these variables should correspond with the presence or absence of the
appropriate HTTP header in the request.
</td></tr>
</table>
<p>
In addition to this, the <a href="../classes/Rack.html">Rack</a>
environment must include these <a
href="../classes/Rack.html">Rack</a>-specific variables:
</p>
<table>
<tr><td valign="top"><tt>rack.version</tt>:</td><td>The Array [0,1], representing this version of <a
href="../classes/Rack.html">Rack</a>.
</td></tr>
<tr><td valign="top"><tt>rack.url_scheme</tt>:</td><td><tt>http</tt> or <tt>https</tt>, depending on the request URL.
</td></tr>
<tr><td valign="top"><tt>rack.input</tt>:</td><td>See below, the input stream.
</td></tr>
<tr><td valign="top"><tt>rack.errors</tt>:</td><td>See below, the error stream.
</td></tr>
<tr><td valign="top"><tt>rack.multithread</tt>:</td><td>true if the application object may be simultaneously invoked by another
thread in the same process, false otherwise.
</td></tr>
<tr><td valign="top"><tt>rack.multiprocess</tt>:</td><td>true if an equivalent application object may be simultaneously invoked by
another process, false otherwise.
</td></tr>
<tr><td valign="top"><tt>rack.run_once</tt>:</td><td>true if the server expects (but does not guarantee!) that the application
will only be invoked this one time during the life of its containing
process. Normally, this will only be true for a server based on CGI (or
something similar).
</td></tr>
</table>
<p>
The server or the application can store their own data in the environment,
too. The keys must contain at least one dot, and should be prefixed
uniquely. The prefix <tt>rack.</tt> is reserved for use with the <a
href="../classes/Rack.html">Rack</a> core distribution and must not be used
otherwise. The environment must not contain the keys
<tt>HTTP_CONTENT_TYPE</tt> or <tt>HTTP_CONTENT_LENGTH</tt> (use the
versions without <tt>HTTP_</tt>). The CGI keys (named without a period)
must have String values. There are the following restrictions:
</p>
<ul>
<li><tt>rack.version</tt> must be an array of Integers.
</li>
<li><tt>rack.url_scheme</tt> must either be <tt>http</tt> or <tt>https</tt>.
</li>
<li>There must be a valid input stream in <tt>rack.input</tt>.
</li>
<li>There must be a valid error stream in <tt>rack.errors</tt>.
</li>
<li>The <tt>REQUEST_METHOD</tt> must be a valid token.
</li>
<li>The <tt>SCRIPT_NAME</tt>, if non-empty, must start with <tt>/</tt>
</li>
<li>The <tt>PATH_INFO</tt>, if non-empty, must start with <tt>/</tt>
</li>
<li>The <tt>CONTENT_LENGTH</tt>, if given, must consist of digits only.
</li>
<li>One of <tt>SCRIPT_NAME</tt> or <tt>PATH_INFO</tt> must be set.
<tt>PATH_INFO</tt> should be <tt>/</tt> if <tt>SCRIPT_NAME</tt> is empty.
<tt>SCRIPT_NAME</tt> never should be <tt>/</tt>, but instead be empty.
</li>
</ul>
<h3>The Input Stream</h3>
<p>
The input stream must respond to <tt>gets</tt>, <tt>each</tt> and
<tt>read</tt>.
</p>
<ul>
<li><tt>gets</tt> must be called without arguments and return a string, or
<tt>nil</tt> on EOF.
</li>
<li><tt>read</tt> must be called without or with one integer argument and
return a string, or <tt>nil</tt> on EOF.
</li>
<li><tt>each</tt> must be called without arguments and only yield Strings.
</li>
<li><tt>close</tt> must never be called on the input stream.
</li>
</ul>
<h3>The Error Stream</h3>
<p>
The error stream must respond to <tt>puts</tt>, <tt>write</tt> and
<tt>flush</tt>.
</p>
<ul>
<li><tt>puts</tt> must be called with a single argument that responds to
<tt>to_s</tt>.
</li>
<li><tt>write</tt> must be called with a single argument that is a String.
</li>
<li><tt>flush</tt> must be called without arguments and must be called in order
to make the error appear for sure.
</li>
<li><tt>close</tt> must never be called on the error stream.
</li>
</ul>
<h2>The Response</h2>
<h3>The Status</h3>
<p>
The status, if parsed as integer (<tt>to_i</tt>), must be greater than or
equal to 100.
</p>
<h3>The Headers</h3>
<p>
The header must respond to each, and yield values of key and value. The
header keys must be Strings. The header must not contain a <tt>Status</tt>
key, contain keys with <tt>:</tt> or newlines in their name, contain keys
names that end in <tt>-</tt> or <tt>_</tt>, but only contain keys that
consist of letters, digits, <tt>_</tt> or <tt>-</tt> and start with a
letter. The values of the header must respond to each. The values passed on
each must be Strings and not contain characters below 037.
</p>
<h3>The Content-Type</h3>
<p>
There must be a <tt>Content-Type</tt>, except when the <tt>Status</tt> is
1xx, 204 or 304, in which case there must be none given.
</p>
<h3>The Content-Length</h3>
<p>
There must be a <tt>Content-Length</tt>, except when the <tt>Status</tt> is
1xx, 204 or 304, in which case there must be none given.
</p>
<h3>The Body</h3>
<p>
The Body must respond to each and must only yield String values. If the
Body responds to close, it will be called after iteration. The Body
commonly is an Array of Strings, the application instance itself, or a
File-like object.
</p>
<h2>Thanks</h2>
<p>
Some parts of this specification are adopted from PEP333: Python Web Server
Gateway Interface v1.0 (<a
href="http://www.python.org/dev/peps/pep-0333">www.python.org/dev/peps/pep-0333</a>/).
I&#8216;d like to thank everyone involved in that effort.
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,101 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: camping.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>camping.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/adapter/camping.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Fri Dec 05 15:00:31 +0100 2008</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,109 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: basic.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>basic.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/auth/basic.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Mon Dec 31 19:31:13 +0100 2007</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="requires-list">
<h3 class="section-bar">Required files</h3>
<div class="name-list">
rack/auth/abstract/handler&nbsp;&nbsp;
rack/auth/abstract/request&nbsp;&nbsp;
</div>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,119 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: openid.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>openid.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/auth/openid.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Tue Jan 06 12:35:41 +0100 2009</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
AUTHOR: blink &lt;blinketje@gmail.com&gt;; blink#ruby-lang@irc.freenode.net
</p>
</div>
<div id="requires-list">
<h3 class="section-bar">Required files</h3>
<div class="name-list">
rack/auth/abstract/handler&nbsp;&nbsp;
uri&nbsp;&nbsp;
pp&nbsp;&nbsp;
openid&nbsp;&nbsp;
openid/extension&nbsp;&nbsp;
openid/store/memory&nbsp;&nbsp;
</div>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,101 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: builder.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>builder.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/builder.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Fri Nov 28 15:54:54 +0100 2008</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,101 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: cascade.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>cascade.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/cascade.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Sun Aug 17 12:14:20 +0200 2008</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,101 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: commonlogger.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>commonlogger.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/commonlogger.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Sun Aug 17 12:15:19 +0200 2008</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,101 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: conditionalget.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>conditionalget.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/conditionalget.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Tue Dec 30 12:19:30 +0100 2008</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,101 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: content_length.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>content_length.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/content_length.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Tue Dec 30 12:19:30 +0100 2008</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,110 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: deflater.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>deflater.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/deflater.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Tue Dec 30 12:19:30 +0100 2008</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="requires-list">
<h3 class="section-bar">Required files</h3>
<div class="name-list">
zlib&nbsp;&nbsp;
stringio&nbsp;&nbsp;
time&nbsp;&nbsp;
</div>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,109 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: directory.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>directory.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/directory.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Fri Jan 09 17:15:50 +0100 2009</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="requires-list">
<h3 class="section-bar">Required files</h3>
<div class="name-list">
time&nbsp;&nbsp;
rack/mime&nbsp;&nbsp;
</div>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,109 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: file.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>file.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/file.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Fri Jan 09 17:16:39 +0100 2009</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="requires-list">
<h3 class="section-bar">Required files</h3>
<div class="name-list">
time&nbsp;&nbsp;
rack/mime&nbsp;&nbsp;
</div>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,111 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: forward.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>forward.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/forward.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Thu Dec 06 16:30:08 +0100 2007</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="requires-list">
<h3 class="section-bar">Required files</h3>
<div class="name-list">
net/http&nbsp;&nbsp;
rack&nbsp;&nbsp;
rack/lobster&nbsp;&nbsp;
rack/handler/mongrel&nbsp;&nbsp;
</div>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,101 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: cgi.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>cgi.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/handler/cgi.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Wed May 16 16:47:16 +0200 2007</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,108 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: evented_mongrel.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>evented_mongrel.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/handler/evented_mongrel.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Sun Sep 07 22:14:00 +0200 2008</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="requires-list">
<h3 class="section-bar">Required files</h3>
<div class="name-list">
swiftcore/evented_mongrel&nbsp;&nbsp;
</div>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,109 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: fastcgi.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>fastcgi.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/handler/fastcgi.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Fri Sep 05 21:33:18 +0200 2008</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="requires-list">
<h3 class="section-bar">Required files</h3>
<div class="name-list">
fcgi&nbsp;&nbsp;
socket&nbsp;&nbsp;
</div>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,108 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: lsws.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>lsws.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/handler/lsws.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Thu Jul 12 10:21:39 +0200 2007</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="requires-list">
<h3 class="section-bar">Required files</h3>
<div class="name-list">
lsapi&nbsp;&nbsp;
</div>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,109 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: mongrel.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>mongrel.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/handler/mongrel.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Fri Nov 28 15:44:32 +0100 2008</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="requires-list">
<h3 class="section-bar">Required files</h3>
<div class="name-list">
mongrel&nbsp;&nbsp;
stringio&nbsp;&nbsp;
</div>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,109 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: scgi.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>scgi.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/handler/scgi.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Fri Jan 25 09:35:38 +0100 2008</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="requires-list">
<h3 class="section-bar">Required files</h3>
<div class="name-list">
scgi&nbsp;&nbsp;
stringio&nbsp;&nbsp;
</div>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,108 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: swiftiplied_mongrel.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>swiftiplied_mongrel.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/handler/swiftiplied_mongrel.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Sun Sep 07 22:14:00 +0200 2008</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="requires-list">
<h3 class="section-bar">Required files</h3>
<div class="name-list">
swiftcore/swiftiplied_mongrel&nbsp;&nbsp;
</div>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,108 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: thin.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>thin.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/handler/thin.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Fri Dec 19 15:22:03 +0100 2008</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="requires-list">
<h3 class="section-bar">Required files</h3>
<div class="name-list">
thin&nbsp;&nbsp;
</div>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View File

@ -1,109 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: webrick.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>webrick.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/rack/handler/webrick.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Mon Jan 05 13:11:08 +0100 2009</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="requires-list">
<h3 class="section-bar">Required files</h3>
<div class="name-list">
webrick&nbsp;&nbsp;
stringio&nbsp;&nbsp;
</div>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More