aboutsummaryrefslogtreecommitdiffstats
path: root/lib/cgi
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-06 03:56:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-06 03:56:38 +0000
commit287a34ae0dfc23e4158f67cb7783d239f202c368 (patch)
tree5e35d5b41aae961b37cf6632f60c42f51c7aa775 /lib/cgi
parent9b52ae2e6491bb5d6c59e1799449f6268baf6f89 (diff)
downloadruby-287a34ae0dfc23e4158f67cb7783d239f202c368.tar.gz
* {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/cgi')
-rw-r--r--lib/cgi/cookie.rb8
-rw-r--r--lib/cgi/core.rb42
-rw-r--r--lib/cgi/html.rb116
-rw-r--r--lib/cgi/session.rb54
-rw-r--r--lib/cgi/session/pstore.rb6
-rw-r--r--lib/cgi/util.rb4
6 files changed, 115 insertions, 115 deletions
diff --git a/lib/cgi/cookie.rb b/lib/cgi/cookie.rb
index befe1402e6..5c2cd62a27 100644
--- a/lib/cgi/cookie.rb
+++ b/lib/cgi/cookie.rb
@@ -15,16 +15,16 @@
# 'expires' => Time.now, # optional
# 'secure' => true # optional
# )
- #
+ #
# cgi.out("cookie" => [cookie1, cookie2]) { "string" }
- #
+ #
# name = cookie1.name
# values = cookie1.value
# path = cookie1.path
# domain = cookie1.domain
# expires = cookie1.expires
# secure = cookie1.secure
- #
+ #
# cookie1.name = 'name'
# cookie1.value = ['value1', 'value2', ...]
# cookie1.path = 'path'
@@ -48,7 +48,7 @@ class CGI
# domain:: the domain for which this cookie applies.
# expires:: the time at which this cookie expires, as a +Time+ object.
# secure:: whether this cookie is a secure cookie or not (default to
- # false). Secure cookies are only transmitted to HTTPS
+ # false). Secure cookies are only transmitted to HTTPS
# servers.
#
# These keywords correspond to attributes of the cookie object.
diff --git a/lib/cgi/core.rb b/lib/cgi/core.rb
index 95cf423d83..69c7f28603 100644
--- a/lib/cgi/core.rb
+++ b/lib/cgi/core.rb
@@ -13,7 +13,7 @@ class CGI
REVISION = '$Id$' #:nodoc:
- NEEDS_BINMODE = true if /WIN/i.match(RUBY_PLATFORM)
+ NEEDS_BINMODE = true if /WIN/i.match(RUBY_PLATFORM)
# Path separators in different environments.
PATH_SEPARATOR = {'UNIX'=>'/', 'WINDOWS'=>'\\', 'MACINTOSH'=>':'}
@@ -48,7 +48,7 @@ class CGI
# :startdoc:
- def env_table
+ def env_table
ENV
end
@@ -79,7 +79,7 @@ class CGI
# status:: the HTTP status code, returned as the Status header. See the
# list of available status codes below.
# server:: the server software, returned as the Server header.
- # connection:: the connection type, returned as the Connection header (for
+ # connection:: the connection type, returned as the Connection header (for
# instance, "close".
# length:: the length of the content that will be sent, returned as the
# Content-Length header.
@@ -89,19 +89,19 @@ class CGI
# object, returned as the Expires header.
# cookie:: a cookie or cookies, returned as one or more Set-Cookie headers.
# The value can be the literal string of the cookie; a CGI::Cookie
- # object; an Array of literal cookie strings or Cookie objects; or a
+ # object; an Array of literal cookie strings or Cookie objects; or a
# hash all of whose values are literal cookie strings or Cookie objects.
# These cookies are in addition to the cookies held in the
# @output_cookies field.
#
# Other header lines can also be set; they are appended as key: value.
- #
+ #
# header
# # Content-Type: text/html
- #
+ #
# header("text/plain")
# # Content-Type: text/plain
- #
+ #
# header("nph" => true,
# "status" => "OK", # == "200 OK"
# # "status" => "200 GOOD",
@@ -116,9 +116,9 @@ class CGI
# "cookie" => [cookie1, cookie2],
# "my_header1" => "my_value"
# "my_header2" => "my_value")
- #
+ #
# The status codes are:
- #
+ #
# "OK" --> "200 OK"
# "PARTIAL_CONTENT" --> "206 Partial Content"
# "MULTIPLE_CHOICES" --> "300 Multiple Choices"
@@ -137,8 +137,8 @@ class CGI
# "NOT_IMPLEMENTED" --> "501 Method Not Implemented"
# "BAD_GATEWAY" --> "502 Bad Gateway"
# "VARIANT_ALSO_VARIES" --> "506 Variant Also Negotiates"
- #
- # This method does not perform charset conversion.
+ #
+ # This method does not perform charset conversion.
def header(options='text/html')
if options.is_a?(String)
content_type = options
@@ -277,13 +277,13 @@ class CGI
# # Content-Length: 6
# #
# # string
- #
+ #
# cgi.out("text/plain") { "string" }
# # Content-Type: text/plain
# # Content-Length: 6
# #
# # string
- #
+ #
# cgi.out("nph" => true,
# "status" => "OK", # == "200 OK"
# "server" => ENV['SERVER_SOFTWARE'],
@@ -296,16 +296,16 @@ class CGI
# "cookie" => [cookie1, cookie2],
# "my_header1" => "my_value",
# "my_header2" => "my_value") { "string" }
- #
+ #
# Content-Length is automatically calculated from the size of
# the String returned by the content block.
#
# If ENV['REQUEST_METHOD'] == "HEAD", then only the header
# is outputted (the content block is still required, but it
# is ignored).
- #
+ #
# If the charset is "iso-2022-jp" or "euc-jp" or "shift_jis" then
- # the content is converted to this charset, and the language is set
+ # the content is converted to this charset, and the language is set
# to "ja".
def out(options = "text/html") # :yield:
@@ -358,7 +358,7 @@ class CGI
# Mixin module. It provides the follow functionality groups:
#
- # 1. Access to CGI environment variables as methods. See
+ # 1. Access to CGI environment variables as methods. See
# documentation to the CGI class for a list of these variables.
#
# 2. Access to cookies, including the cookies attribute.
@@ -617,7 +617,7 @@ class CGI
# Get the value for the parameter with a given key.
#
- # If the parameter has multiple values, only the first will be
+ # If the parameter has multiple values, only the first will be
# retrieved; use #params() to get the array of values.
def [](key)
params = @params[key]
@@ -658,7 +658,7 @@ class CGI
# This default value default is "UTF-8"
# If you want to change the default accept character set
# when create a new CGI instance, set this:
- #
+ #
# CGI.accept_charset = "EUC-JP"
#
@@ -700,11 +700,11 @@ class CGI
#
# == block
#
- # When you use a block, you can write a process
+ # When you use a block, you can write a process
# that query encoding is invalid. Example:
#
# encoding_error={}
- # cgi=CGI.new(:accept_charset=>"EUC-JP") do |name,value|
+ # cgi=CGI.new(:accept_charset=>"EUC-JP") do |name,value|
# encoding_error[key] = value
# end
#
diff --git a/lib/cgi/html.rb b/lib/cgi/html.rb
index 62f1fc1898..8ee38000c5 100644
--- a/lib/cgi/html.rb
+++ b/lib/cgi/html.rb
@@ -66,7 +66,7 @@ class CGI
# Modules Http3, Http4, etc., contain more basic HTML-generation methods
# (:title, :center, etc.).
#
- # See class CGI for a detailed example.
+ # See class CGI for a detailed example.
#
module HtmlExtension
@@ -99,7 +99,7 @@ class CGI
end
end
- # Generate a Document Base URI element as a String.
+ # Generate a Document Base URI element as a String.
#
# +href+ can either by a string, giving the base URL for the HREF
# attribute, or it can be a has of the element's attributes.
@@ -179,10 +179,10 @@ class CGI
#
# checkbox("name")
# # = checkbox("NAME" => "name")
- #
+ #
# checkbox("name", "value")
# # = checkbox("NAME" => "name", "VALUE" => "value")
- #
+ #
# checkbox("name", "value", true)
# # = checkbox("NAME" => "name", "VALUE" => "value", "CHECKED" => true)
def checkbox(name = "", value = nil, checked = nil)
@@ -220,23 +220,23 @@ class CGI
# # <INPUT TYPE="checkbox" NAME="name" VALUE="foo">foo
# # <INPUT TYPE="checkbox" NAME="name" VALUE="bar">bar
# # <INPUT TYPE="checkbox" NAME="name" VALUE="baz">baz
- #
+ #
# checkbox_group("name", ["foo"], ["bar", true], "baz")
# # <INPUT TYPE="checkbox" NAME="name" VALUE="foo">foo
# # <INPUT TYPE="checkbox" CHECKED NAME="name" VALUE="bar">bar
# # <INPUT TYPE="checkbox" NAME="name" VALUE="baz">baz
- #
+ #
# checkbox_group("name", ["1", "Foo"], ["2", "Bar", true], "Baz")
# # <INPUT TYPE="checkbox" NAME="name" VALUE="1">Foo
# # <INPUT TYPE="checkbox" CHECKED NAME="name" VALUE="2">Bar
# # <INPUT TYPE="checkbox" NAME="name" VALUE="Baz">Baz
- #
+ #
# checkbox_group("NAME" => "name",
# "VALUES" => ["foo", "bar", "baz"])
- #
+ #
# checkbox_group("NAME" => "name",
# "VALUES" => [["foo"], ["bar", true], "baz"])
- #
+ #
# checkbox_group("NAME" => "name",
# "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"])
def checkbox_group(name = "", *values)
@@ -272,13 +272,13 @@ class CGI
#
# file_field("name")
# # <INPUT TYPE="file" NAME="name" SIZE="20">
- #
+ #
# file_field("name", 40)
# # <INPUT TYPE="file" NAME="name" SIZE="40">
- #
+ #
# file_field("name", 40, 100)
# # <INPUT TYPE="file" NAME="name" SIZE="40" MAXLENGTH="100">
- #
+ #
# file_field("NAME" => "name", "SIZE" => 40)
# # <INPUT TYPE="file" NAME="name" SIZE="40">
def file_field(name = "", size = 20, maxlength = nil)
@@ -298,7 +298,7 @@ class CGI
#
# +method+ should be either "get" or "post", and defaults to the latter.
# +action+ defaults to the current CGI script name. +enctype+
- # defaults to "application/x-www-form-urlencoded".
+ # defaults to "application/x-www-form-urlencoded".
#
# Alternatively, the attributes can be specified as a hash.
#
@@ -306,19 +306,19 @@ class CGI
#
# form{ "string" }
# # <FORM METHOD="post" ENCTYPE="application/x-www-form-urlencoded">string</FORM>
- #
+ #
# form("get") { "string" }
# # <FORM METHOD="get" ENCTYPE="application/x-www-form-urlencoded">string</FORM>
- #
+ #
# form("get", "url") { "string" }
# # <FORM METHOD="get" ACTION="url" ENCTYPE="application/x-www-form-urlencoded">string</FORM>
- #
+ #
# form("METHOD" => "post", "ENCTYPE" => "enctype") { "string" }
# # <FORM METHOD="post" ENCTYPE="enctype">string</FORM>
def form(method = "post", action = script_name, enctype = "application/x-www-form-urlencoded")
attributes = if method.kind_of?(String)
{ "METHOD" => method, "ACTION" => action,
- "ENCTYPE" => enctype }
+ "ENCTYPE" => enctype }
else
unless method.has_key?("METHOD")
method["METHOD"] = "post"
@@ -350,10 +350,10 @@ class CGI
#
# hidden("name")
# # <INPUT TYPE="hidden" NAME="name">
- #
+ #
# hidden("name", "value")
# # <INPUT TYPE="hidden" NAME="name" VALUE="value">
- #
+ #
# hidden("NAME" => "name", "VALUE" => "reset", "ID" => "foo")
# # <INPUT TYPE="hidden" NAME="name" VALUE="value" ID="foo">
def hidden(name = "", value = nil)
@@ -376,36 +376,36 @@ class CGI
# should include the entire text of this tag, including angle brackets.
#
# The body of the html element is supplied as a block.
- #
+ #
# html{ "string" }
# # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML>string</HTML>
- #
+ #
# html("LANG" => "ja") { "string" }
# # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML LANG="ja">string</HTML>
- #
+ #
# html("DOCTYPE" => false) { "string" }
# # <HTML>string</HTML>
- #
+ #
# html("DOCTYPE" => '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">') { "string" }
# # <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><HTML>string</HTML>
- #
+ #
# html("PRETTY" => " ") { "<BODY></BODY>" }
# # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
# # <HTML>
# # <BODY>
# # </BODY>
# # </HTML>
- #
+ #
# html("PRETTY" => "\t") { "<BODY></BODY>" }
# # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
# # <HTML>
# # <BODY>
# # </BODY>
# # </HTML>
- #
+ #
# html("PRETTY") { "<BODY></BODY>" }
# # = html("PRETTY" => " ") { "<BODY></BODY>" }
- #
+ #
# html(if $VERBOSE then "PRETTY" end) { "HTML string" }
#
def html(attributes = {}) # :yield:
@@ -444,17 +444,17 @@ class CGI
# Generate an Image Button Input element as a string.
#
- # +src+ is the URL of the image to use for the button. +name+
+ # +src+ is the URL of the image to use for the button. +name+
# is the input name. +alt+ is the alternative text for the image.
#
# Alternatively, the attributes can be specified as a hash.
- #
+ #
# image_button("url")
# # <INPUT TYPE="image" SRC="url">
- #
+ #
# image_button("url", "name", "string")
# # <INPUT TYPE="image" SRC="url" NAME="name" ALT="string">
- #
+ #
# image_button("SRC" => "url", "ATL" => "strng")
# # <INPUT TYPE="image" SRC="url" ALT="string">
def image_button(src = "", name = nil, alt = nil)
@@ -480,7 +480,7 @@ class CGI
#
# img("src", "alt", 100, 50)
# # <IMG SRC="src" ALT="alt" WIDTH="100" HEIGHT="50">
- #
+ #
# img("SRC" => "src", "ALT" => "alt", "WIDTH" => 100, "HEIGHT" => 50)
# # <IMG SRC="src" ALT="alt" WIDTH="100" HEIGHT="50">
def img(src = "", alt = "", width = nil, height = nil)
@@ -506,15 +506,15 @@ class CGI
#
# multipart_form{ "string" }
# # <FORM METHOD="post" ENCTYPE="multipart/form-data">string</FORM>
- #
+ #
# multipart_form("url") { "string" }
# # <FORM METHOD="post" ACTION="url" ENCTYPE="multipart/form-data">string</FORM>
def multipart_form(action = nil, enctype = "multipart/form-data")
attributes = if action == nil
- { "METHOD" => "post", "ENCTYPE" => enctype }
+ { "METHOD" => "post", "ENCTYPE" => enctype }
elsif action.kind_of?(String)
{ "METHOD" => "post", "ACTION" => action,
- "ENCTYPE" => enctype }
+ "ENCTYPE" => enctype }
else
unless action.has_key?("METHOD")
action["METHOD"] = "post"
@@ -542,13 +542,13 @@ class CGI
#
# password_field("name")
# # <INPUT TYPE="password" NAME="name" SIZE="40">
- #
+ #
# password_field("name", "value")
# # <INPUT TYPE="password" NAME="name" VALUE="value" SIZE="40">
- #
+ #
# password_field("password", "value", 80, 200)
# # <INPUT TYPE="password" NAME="name" VALUE="value" SIZE="80" MAXLENGTH="200">
- #
+ #
# password_field("NAME" => "name", "VALUE" => "value")
# # <INPUT TYPE="password" NAME="name" VALUE="value">
def password_field(name = "", value = nil, size = 40, maxlength = nil)
@@ -584,21 +584,21 @@ class CGI
# # <OPTION VALUE="bar">bar</OPTION>
# # <OPTION VALUE="baz">baz</OPTION>
# # </SELECT>
- #
+ #
# popup_menu("name", ["foo"], ["bar", true], "baz")
# # <SELECT NAME="name">
# # <OPTION VALUE="foo">foo</OPTION>
# # <OPTION VALUE="bar" SELECTED>bar</OPTION>
# # <OPTION VALUE="baz">baz</OPTION>
# # </SELECT>
- #
+ #
# popup_menu("name", ["1", "Foo"], ["2", "Bar", true], "Baz")
# # <SELECT NAME="name">
# # <OPTION VALUE="1">Foo</OPTION>
# # <OPTION SELECTED VALUE="2">Bar</OPTION>
# # <OPTION VALUE="Baz">Baz</OPTION>
# # </SELECT>
- #
+ #
# popup_menu("NAME" => "name", "SIZE" => 2, "MULTIPLE" => true,
# "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"])
# # <SELECT NAME="name" MULTIPLE SIZE="2">
@@ -649,10 +649,10 @@ class CGI
#
# radio_button("name", "value")
# # <INPUT TYPE="radio" NAME="name" VALUE="value">
- #
+ #
# radio_button("name", "value", true)
# # <INPUT TYPE="radio" NAME="name" VALUE="value" CHECKED>
- #
+ #
# radio_button("NAME" => "name", "VALUE" => "value", "ID" => "foo")
# # <INPUT TYPE="radio" NAME="name" VALUE="value" ID="foo">
def radio_button(name = "", value = nil, checked = nil)
@@ -670,28 +670,28 @@ class CGI
#
# This works the same as #checkbox_group(). However, it is not valid
# to have more than one radiobutton in a group checked.
- #
+ #
# radio_group("name", "foo", "bar", "baz")
# # <INPUT TYPE="radio" NAME="name" VALUE="foo">foo
# # <INPUT TYPE="radio" NAME="name" VALUE="bar">bar
# # <INPUT TYPE="radio" NAME="name" VALUE="baz">baz
- #
+ #
# radio_group("name", ["foo"], ["bar", true], "baz")
# # <INPUT TYPE="radio" NAME="name" VALUE="foo">foo
# # <INPUT TYPE="radio" CHECKED NAME="name" VALUE="bar">bar
# # <INPUT TYPE="radio" NAME="name" VALUE="baz">baz
- #
+ #
# radio_group("name", ["1", "Foo"], ["2", "Bar", true], "Baz")
# # <INPUT TYPE="radio" NAME="name" VALUE="1">Foo
# # <INPUT TYPE="radio" CHECKED NAME="name" VALUE="2">Bar
# # <INPUT TYPE="radio" NAME="name" VALUE="Baz">Baz
- #
+ #
# radio_group("NAME" => "name",
# "VALUES" => ["foo", "bar", "baz"])
- #
+ #
# radio_group("NAME" => "name",
# "VALUES" => [["foo"], ["bar", true], "baz"])
- #
+ #
# radio_group("NAME" => "name",
# "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"])
def radio_group(name = "", *values)
@@ -723,10 +723,10 @@ class CGI
#
# reset
# # <INPUT TYPE="reset">
- #
+ #
# reset("reset")
# # <INPUT TYPE="reset" VALUE="reset">
- #
+ #
# reset("VALUE" => "reset", "ID" => "foo")
# # <INPUT TYPE="reset" VALUE="reset" ID="foo">
def reset(value = nil, name = nil)
@@ -750,13 +750,13 @@ class CGI
#
# submit
# # <INPUT TYPE="submit">
- #
+ #
# submit("ok")
# # <INPUT TYPE="submit" VALUE="ok">
- #
+ #
# submit("ok", "button1")
# # <INPUT TYPE="submit" VALUE="ok" NAME="button1">
- #
+ #
# submit("VALUE" => "ok", "NAME" => "button1", "ID" => "foo")
# # <INPUT TYPE="submit" VALUE="ok" NAME="button1" ID="foo">
def submit(value = nil, name = nil)
@@ -779,16 +779,16 @@ class CGI
#
# text_field("name")
# # <INPUT TYPE="text" NAME="name" SIZE="40">
- #
+ #
# text_field("name", "value")
# # <INPUT TYPE="text" NAME="name" VALUE="value" SIZE="40">
- #
+ #
# text_field("name", "value", 80)
# # <INPUT TYPE="text" NAME="name" VALUE="value" SIZE="80">
- #
+ #
# text_field("name", "value", 80, 200)
# # <INPUT TYPE="text" NAME="name" VALUE="value" SIZE="80" MAXLENGTH="200">
- #
+ #
# text_field("NAME" => "name", "VALUE" => "value")
# # <INPUT TYPE="text" NAME="name" VALUE="value">
def text_field(name = "", value = nil, size = 40, maxlength = nil)
diff --git a/lib/cgi/session.rb b/lib/cgi/session.rb
index 2b5aa846d9..65d6442b37 100644
--- a/lib/cgi/session.rb
+++ b/lib/cgi/session.rb
@@ -13,7 +13,7 @@
#
# This file provides the +CGI::Session+ class, which provides session
# support for CGI scripts. A session is a sequence of HTTP requests
-# and responses linked together and associated with a single client.
+# and responses linked together and associated with a single client.
# Information associated with the session is stored
# on the server between requests. A session id is passed between client
# and server with every request and response, transparently
@@ -28,7 +28,7 @@ require 'tmpdir'
class CGI
- # Class representing an HTTP session. See documentation for the file
+ # Class representing an HTTP session. See documentation for the file
# cgi/session.rb for an introduction to HTTP sessions.
#
# == Lifecycle
@@ -47,7 +47,7 @@ class CGI
# == Setting and retrieving session data.
#
# The Session class associates data with a session as key-value pairs.
- # This data can be set and retrieved by indexing the Session instance
+ # This data can be set and retrieved by indexing the Session instance
# using '[]', much the same as hashes (although other hash methods
# are not supported).
#
@@ -60,21 +60,21 @@ class CGI
#
# == Storing session state
#
- # The caller can specify what form of storage to use for the session's
+ # The caller can specify what form of storage to use for the session's
# data with the +database_manager+ option to CGI::Session::new. The
# following storage classes are provided as part of the standard library:
#
- # CGI::Session::FileStore:: stores data as plain text in a flat file. Only
- # works with String data. This is the default
+ # CGI::Session::FileStore:: stores data as plain text in a flat file. Only
+ # works with String data. This is the default
# storage type.
- # CGI::Session::MemoryStore:: stores data in an in-memory hash. The data
- # only persists for as long as the current ruby
+ # CGI::Session::MemoryStore:: stores data in an in-memory hash. The data
+ # only persists for as long as the current ruby
# interpreter instance does.
# CGI::Session::PStore:: stores data in Marshalled format. Provided by
- # cgi/session/pstore.rb. Supports data of any type,
+ # cgi/session/pstore.rb. Supports data of any type,
# and provides file-locking and transaction support.
#
- # Custom storage types can also be created by defining a class with
+ # Custom storage types can also be created by defining a class with
# the following methods:
#
# new(session, options)
@@ -99,14 +99,14 @@ class CGI
# The simplest way to do this is via cookies. The CGI::Session class
# provides transparent support for session id communication via cookies
# if the client has cookies enabled.
- #
+ #
# If the client has cookies disabled, the session id must be included
# as a parameter of all requests sent by the client to the server. The
# CGI::Session class in conjunction with the CGI class will transparently
# add the session id as a hidden input field to all forms generated
# using the CGI#form() HTML generation method. No built-in support is
# provided for other mechanisms, such as URL re-writing. The caller is
- # responsible for extracting the session id from the session_id
+ # responsible for extracting the session id from the session_id
# attribute and manually encoding it in URLs and adding it as a hidden
# input to HTML forms created by other mechanisms. Also, session expiry
# is not automatically handled.
@@ -124,10 +124,10 @@ class CGI
# session = CGI::Session.new(cgi,
# 'database_manager' => CGI::Session::PStore, # use PStore
# 'session_key' => '_rb_sess_id', # custom session key
- # 'session_expires' => Time.now + 30 * 60, # 30 minute timeout
+ # 'session_expires' => Time.now + 30 * 60, # 30 minute timeout
# 'prefix' => 'pstore_sid_') # PStore option
# if cgi.has_key?('user_name') and cgi['user_name'] != ''
- # # coerce to String: cgi[] returns the
+ # # coerce to String: cgi[] returns the
# # string-like CGI::QueryExtension::Value
# session['user_name'] = cgi['user_name'].to_s
# elsif !session['user_name']
@@ -143,11 +143,11 @@ class CGI
# cgi = CGI.new("html4")
#
# # We make sure to delete an old session if one exists,
- # # not just to free resources, but to prevent the session
+ # # not just to free resources, but to prevent the session
# # from being maliciously hijacked later on.
# begin
- # session = CGI::Session.new(cgi, 'new_session' => false)
- # session.delete
+ # session = CGI::Session.new(cgi, 'new_session' => false)
+ # session.delete
# rescue ArgumentError # if no old session
# end
# session = CGI::Session.new(cgi, 'new_session' => true)
@@ -172,7 +172,7 @@ class CGI
# The session id is an MD5 hash based upon the time,
# a random number, and a constant string. This routine
# is used internally for automatically generated
- # session ids.
+ # session ids.
def create_new_id
require 'securerandom'
begin
@@ -205,7 +205,7 @@ class CGI
# it is retrieved from the +session_key+ parameter
# of the request, or automatically generated for
# a new session.
- # new_session:: if true, force creation of a new session. If not set,
+ # new_session:: if true, force creation of a new session. If not set,
# a new session is only created if none currently
# exists. If false, a new session is never created,
# and if none currently exists and the +session_id+
@@ -220,7 +220,7 @@ class CGI
# The following options are also recognised, but only apply if the
# session id is stored in a cookie.
#
- # session_expires:: the time the current session expires, as a
+ # session_expires:: the time the current session expires, as a
# +Time+ object. If not set, the session will terminate
# when the user's browser is closed.
# session_domain:: the hostname domain for which this session is valid.
@@ -232,10 +232,10 @@ class CGI
# +option+ is also passed on to the session storage class initializer; see
# the documentation for each session storage class for the options
# they support.
- #
+ #
# The retrieved or created session is automatically added to +request+
# as a cookie, and also to its +output_hidden+ table, which is used
- # to add hidden input elements to forms.
+ # to add hidden input elements to forms.
#
# *WARNING* the +output_hidden+
# fields are surrounded by a <fieldset> tag in HTML 4 generation, which
@@ -294,7 +294,7 @@ class CGI
"expires" => option['session_expires'],
"domain" => option['session_domain'],
"secure" => option['session_secure'],
- "path" =>
+ "path" =>
if option['session_path']
option['session_path']
elsif ENV["SCRIPT_NAME"]
@@ -323,11 +323,11 @@ class CGI
# Store session data on the server. For some session storage types,
# this is a no-op.
- def update
+ def update
@dbman.update
end
- # Store session data on the server and close the session storage.
+ # Store session data on the server and close the session storage.
# For some session storage types, this is a no-op.
def close
@dbman.close
@@ -359,7 +359,7 @@ class CGI
# created. The session id must only contain alphanumeric
# characters; automatically generated session ids observe
# this requirement.
- #
+ #
# +option+ is a hash of options for the initializer. The
# following options are recognised:
#
@@ -450,7 +450,7 @@ class CGI
# In-memory session storage class.
#
# Implements session storage as a global in-memory hash. Session
- # data will only persist for as long as the ruby interpreter
+ # data will only persist for as long as the ruby interpreter
# instance does.
class MemoryStore
GLOBAL_HASH_TABLE = {} #:nodoc:
diff --git a/lib/cgi/session/pstore.rb b/lib/cgi/session/pstore.rb
index 3cd3e46000..a63d7d3984 100644
--- a/lib/cgi/session/pstore.rb
+++ b/lib/cgi/session/pstore.rb
@@ -2,7 +2,7 @@
# cgi/session/pstore.rb - persistent storage of marshalled session data
#
# Documentation: William Webber (william@williamwebber.com)
-#
+#
# == Overview
#
# This file provides the CGI::Session::PStore class, which builds
@@ -29,7 +29,7 @@ class CGI
# created. The session id must only contain alphanumeric
# characters; automatically generated session ids observe
# this requirement.
- #
+ #
# +option+ is a hash of options for the initializer. The
# following options are recognised:
#
@@ -77,7 +77,7 @@ class CGI
end
# Save session state to the session's PStore file.
- def update
+ def update
@p.transaction do
@p['hash'] = @hash
end
diff --git a/lib/cgi/util.rb b/lib/cgi/util.rb
index 991b68ce73..b7b0233b4d 100644
--- a/lib/cgi/util.rb
+++ b/lib/cgi/util.rb
@@ -119,7 +119,7 @@ class CGI
# print CGI::unescapeElement(
# CGI::escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG")
# # "&lt;BR&gt;<A HREF="url"></A>"
- #
+ #
# print CGI::unescapeElement(
# CGI::escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"])
# # "&lt;BR&gt;<A HREF="url"></A>"
@@ -161,7 +161,7 @@ class CGI
# # <BODY>
# # </BODY>
# # </HTML>
- #
+ #
# print CGI::pretty("<HTML><BODY></BODY></HTML>", "\t")
# # <HTML>
# # <BODY>