<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -7,28 +7,27 @@ PSGI - Perl Web Server Gateway Interface Specification
 =head1 ABSTRACT
 
 This document specifies a standard interface between web servers and
-Perl web applications or frameworks, to promote web application
-portability and reduce the duplicated efforts by web application
+Perl web applications or frameworks. This interface is designed to promote web application
+portability and reduce the duplication of effort by web application
 framework developers.
 
-Keep in mind that PSGI is not Yet Another web application
+Please keep in mind that PSGI is not Yet Another web application
 framework. PSGI is a specification to decouple web server environments
-from web application framework code. PSGI is also not the web
-application API. Web application developers (end users) are not
-supposed to run their web applications directly using the PSGI
+from web application framework code. Nor is PSGI is a web
+application API. Web application developers (end users) will not
+run their web applications directly using the PSGI
 interface, but instead are encouraged to use frameworks that
-support PSGI, or use the helper implementations like Plack (more on
-that later).
+support PSGI. There is also a reference PSGI implementation called Plack.
 
-=head1 TERMINOLOGIES
+=head1 TERMINOLOGY
 
 =over 4
 
 =item Servers
 
-Servers are web servers that accept HTTP requests, dispatch the
-requests to the web applications and return the HTTP response to the
-clients. In PSGI specification it's a Perl process that's running
+A I&lt;Server&gt; is a web server that accepts HTTP requests, dispatches the
+request to web applications, and returns the HTTP response to the
+client. In the context of PSGI the server could be a Perl process running
 inside an HTTP server (e.g. mod_perl in Apache), a daemon process
 called from a web server (e.g. FastCGI daemon) or a pure perl HTTP
 server.
@@ -38,35 +37,36 @@ I&lt;Backends&gt;.
 
 =item Applications
 
-Applications are web applications that actually get HTTP requests
-and return HTTP response. In PSGI it's a code reference: see below.
+I&lt;Applications&gt; are web applications that accept an HTTP request
+and return an HTTP response. In PSGI an application is a code reference.
 
 =item Middleware
 
-Middleware is a PSGI application, which is a code reference, but also
-runs like a server to run other applications. It can be thought of a
-I&lt;plugin&gt; to extend PSGI application: see below.
+I&lt;Middleware&gt; is a PSGI application (a code reference) I&lt;and&gt; a
+I&lt;Server&gt;. I&lt;Middleware&gt; looks like an I&lt;application&gt; when called from a
+I&lt;server&gt;, and it in turn can call other I&lt;applications&gt;. It can be thought of
+a I&lt;plugin&gt; to extend a PSGI application.
 
 =item Framework developers
 
-Framework developers are authors of web application frameworks. They
-need to write adapters (or engines) to read PSGI input, then run the
-application logic and returns PSGI response to the server.
+I&lt;Framework developers&gt; are the authors of web application frameworks. They
+write adapters (or engines) which accept PSGI input, run a web
+application, and return a PSGI response to the I&lt;server&gt;.
 
 =item Web application developers
 
-Web application developers are developers who write code that uses one
-of the web application framework that uses PSGI interface. They
-usually don't need to deal with nor care about PSGI protocol at all.
+I&lt;Web application developers&gt; are developers who write code on top of a web
+application framework. These developers should never have to deal with PSGI
+directly.
 
 =back
 
 =head1 SPECIFICATION
 
-=head2 Applications
+=head2 Application
 
 A PSGI application is a Perl code reference. It takes exactly one
-argument, the environment and returns an array reference of exactly
+argument, the environment, and returns an array reference containing exactly
 three values.
 
   sub app {
@@ -80,33 +80,50 @@ three values.
 
 =head3 The Environment
 
-The environment MUST be a hash reference that includes CGI-like
-headers. The application is free to modify the environment. The
-environment is required to include these variables (adopted from
-PEP333, Rack and JSGI) except when they'd be empty, but see below:
+The environment B&lt;MUST&gt; be a hash reference that includes CGI-like headers, as
+detailed below. The application is free to modify the environment. The
+environment B&lt;MUST&gt; include these keys (adopted from L&lt;PEP
+333|http://www.python.org/dev/peps/pep-0333/&gt;,
+L&lt;Rack|http://rack.rubyforge.org/doc/files/SPEC.html&gt; and
+L&lt;JSGI|http://jackjs.org/jsgi-spec.html&gt;) except when they would normally be
+empty.
+
+When an environment key is described as a boolean, itss value B&lt;MUST&gt; conform
+to Perl's notion of boolean-ness. These variables B&lt;SHOULD&gt; contain a C&lt;0&gt; or
+C&lt;1&gt;. An empty value or the absence of a key B&lt;MAY&gt; also be used to indicate a
+false value.
+
+The values for all CGI keys (named without a period) B&lt;MUST&gt; be a scalar
+string except where otherwise specified.
+
+See below for details.
 
 =over 4
 
 =item *
 
 C&lt;REQUEST_METHOD&gt;: The HTTP request method, such as &quot;GET&quot; or
-&quot;POST&quot;. This cannot ever be an empty string, and so is always
+&quot;POST&quot;. This B&lt;MUST NOT&gt; be an empty string, and so is always
 required.
 
 =item *
 
-C&lt;SCRIPT_NAME&gt;: The initial portion of the request URL's I&lt;path&gt; that
-corresponds to the application, so that the application knows its
+C&lt;SCRIPT_NAME&gt;: The initial portion of the request URL's I&lt;path&gt;,
+corresponding to the application. This tells the application its
 virtual &quot;location&quot;. This may be an empty string if the application
-corresponds to the &quot;root&quot; of the server.
+corresponds to the server's root URI.
+
+If this key is not empty, it B&lt;MUST&gt; start with a forward slash (C&lt;/&gt;).
 
 =item *
 
-C&lt;PATH_INFO&gt;: The remainder of the request URL's &quot;path&quot;, designating
+C&lt;PATH_INFO&gt;: The remainder of the request URL's I&lt;path&gt;, designating
 the virtual &quot;location&quot; 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. This value
-should be URI decoded by servers to be compatible to RFC 3875.
+should be URI decoded by servers in order to be compatible with L&lt;RFC 3875|http://www.ietf.org/rfc/rfc3875&gt;.
+
+If this key is not empty, it B&lt;MUST&gt; start with a forward slash (C&lt;/&gt;).
 
 =item *
 
@@ -114,23 +131,22 @@ C&lt;REQUEST_URI&gt;: The undecoded, raw request URL line. It is the raw URI
 path and query part that appears in the HTTP C&lt;GET /... HTTP/1.x&gt; line
 and doesn't contain URI scheme and host names.
 
-Unlike C&lt;PATH_INFO&gt;, this value SHOULD NOT be decoded by servers and
-hence it is an application's responsibility to properly decode paths
-to map URL to application handlers, when using C&lt;REQUEST_URI&gt; over
-C&lt;PATH_INFO&gt;.
+Unlike C&lt;PATH_INFO&gt;, this value B&lt;SHOULD NOT&gt; be decoded by servers. It is an
+application's responsibility to properly decode paths in order to map URLs to
+application handlers if they choose to use this key instead of C&lt;PATH_INFO&gt;.
 
 =item *
 
 C&lt;QUERY_STRING&gt;: The portion of the request URL that follows the C&lt;?&gt;,
-if any. May be empty, but is always required.
+if any. This key B&lt;MAY&gt; be empty, but B&lt;MUST&gt; always be present, even if empty.
 
 =item *
 
 C&lt;SERVER_NAME&gt;, C&lt;SERVER_PORT&gt;: When combined with C&lt;SCRIPT_NAME&gt; and
-C&lt;PATH_INFO&gt;, these variables can be used to complete the URL. Note,
+C&lt;PATH_INFO&gt;, these keys can be used to complete the URL. Note,
 however, that C&lt;HTTP_HOST&gt;, if present, should be used in preference
 to C&lt;SERVER_NAME&gt; for reconstructing the request URL. C&lt;SERVER_NAME&gt;
-and C&lt;SERVER_PORT&gt; can never be empty strings, and so are always
+and C&lt;SERVER_PORT&gt; I&lt;MUST NOT&gt; be empty strings, and are always
 required.
 
 =item *
@@ -142,26 +158,35 @@ treat any HTTP request headers.
 
 =item *
 
-C&lt;HTTP_&gt; Variables: Variables corresponding to the client-supplied
-HTTP request headers (i.e., variables whose names begin with
-C&lt;HTTP_&gt;). The presence or absence of these variables should
+C&lt;CONTENT_LENGTH&gt;: The length of the content in bytes, as an integer. This key
+B&lt;MAY&gt; be omitted.
+
+=item *
+
+C&lt;CONTENT_TYPE&gt;: The request's MIME type, as specified by the client. This key
+B&lt;MAY&gt; be omitted.
+
+=item *
+
+C&lt;HTTP_*&gt; Keys: These keys correspond to the client-supplied
+HTTP request headers. The presence or absence of these keys should
 correspond to the presence or absence of the appropriate HTTP header
 in the request.
 
 If there are multiple header lines sent with the same key, the server
-should treat them as if they're sent in one line, i.e. combine them
-with C&lt;, &gt; as in RFC 2616.
+should treat them as if they were sent in one line and combine them
+with C&lt;, &gt;, as in L&lt;RFC 2616|http://www.ietf.org/rfc/rfc2616&gt;.
 
 =back
 
-In addition to this, the PSGI environment MUST include these
-PSGI-specific variables:
+In addition to the keys above, the PSGI environment B&lt;MUST&gt; also include these
+PSGI-specific keys:
 
 =over 4
 
 =item *
 
-C&lt;psgi.version&gt;: An array ref [1,0] representing this version of PSGI.
+C&lt;psgi.version&gt;: An array reference [1,0] representing this version of PSGI. The first number is the major version and the second it the minor version.
 
 =item *
 
@@ -169,118 +194,83 @@ C&lt;psgi.url_scheme&gt;: A string C&lt;http&gt; or C&lt;https&gt;, depending on the request URL.
 
 =item *
 
-C&lt;psgi.input&gt;: the input stream. See below.
+C&lt;psgi.input&gt;: the input stream. See below for details.
 
 =item *
 
-C&lt;psgi.errors&gt;: the error stream. See below.
+C&lt;psgi.errors&gt;: the error stream. See below for details.
 
 =item *
 
-C&lt;psgi.multithread&gt;: true if the application may be simultaneously
+C&lt;psgi.multithread&gt;: This is a boolean value, which I&lt;MUST&gt; be true if the application may be simultaneously
 invoked by another thread in the same process, false otherwise.
 
 =item *
 
-C&lt;psgi.multiprocess&gt;: true if an equivalent application object may be
+C&lt;psgi.multiprocess&gt;: This is a boolean value, which I&lt;MUST&gt; be true if an equivalent application object may be
 simultaneously invoked by another process, false otherwise.
 
 =back
 
-The PSGI environment MAY include these optional PSGI variables:
+The PSGI environment B&lt;MAY&gt; also include these optional PSGI keys:
 
 =over 4
 
 =item *
 
-C&lt;psgi.run_once&gt;: true if the server expects (but does not guarantee!)
+C&lt;psgi.run_once&gt;: A boolean which is 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).
 
 =item *
 
-C&lt;psgi.nonblocking&gt;: true if the server is calling the application in an
+C&lt;psgi.nonblocking&gt;: A boolean which is true if the server is calling the application in an
 non-blocking event loop.
 
 =item *
 
-C&lt;psgi.streaming&gt;: true if the server supports callback style delayed
+C&lt;psgi.streaming&gt;: A boolean which is true if the server supports callback style delayed
 response and streaming writer object.
 
 =back
 
 The server or the application can store its own data in the
-environment, too. The keys MUST contain at least one dot, and should
-be prefixed uniquely. The prefix C&lt;psgi.&gt; is reserved for use with the
-PSGI core implementation and other accepted extensions and MUST NOT be
-used otherwise. The environment MUST NOT contain the keys
-C&lt;HTTP_CONTENT_TYPE&gt; or C&lt;HTTP_CONTENT_LENGTH&gt; (use the versions
-without C&lt;HTTP_&gt;). The CGI keys (named without a period) MUST have a
-scalar variable containing strings. There are the following
-restrictions:
-
-=over 4
-
-=item *
+environment as well. These keys B&lt;MUST&gt; contain at least one dot, and B&lt;SHOULD&gt;
+be prefixed uniquely. The C&lt;psgi.&gt; prefix is reserved for use with the
+PSGI core implementation and officially blessed extensions. This prefix B&lt;MUST NOT&gt; be
+used by other servers or application.
 
-C&lt;psgi.version&gt; MUST be an array of integers.
-
-=item *
-
-C&lt;psgi.url_scheme&gt; MUST be a scalar variable containing either the
-string C&lt;http&gt; or C&lt;https&gt;.
-
-=item *
-
-There MUST be a valid input stream in C&lt;psgi.input&gt;.
-
-=item *
-
-There MUST be a valid error stream in C&lt;psgi.errors&gt;.
-
-=item *
-
-The C&lt;REQUEST_METHOD&gt; MUST be a valid token.
-
-=item *
+The environment B&lt;MUST NOT&gt; contain keys named C&lt;HTTP_CONTENT_TYPE&gt; or
+C&lt;HTTP_CONTENT_LENGTH&gt;.
 
-The C&lt;SCRIPT_NAME&gt;, if non-empty, MUST start with C&lt;/&gt;
-
-=item *
-
-The C&lt;PATH_INFO&gt;, if non-empty, MUST start with C&lt;/&gt;
-
-=item *
-
-The C&lt;CONTENT_LENGTH&gt;, if given, MUST consist of digits only.
-
-=item *
-
-One of C&lt;SCRIPT_NAME&gt; or C&lt;PATH_INFO&gt; MUST be set. C&lt;PATH_INFO&gt; should
-be C&lt;/&gt; if C&lt;SCRIPT_NAME&gt; is empty. C&lt;SCRIPT_NAME&gt; should never be C&lt;/&gt;,
-but should instead be empty.
+One of C&lt;SCRIPT_NAME&gt; or C&lt;PATH_INFO&gt; B&lt;MUST&gt; be set. C&lt;PATH_INFO&gt; should be
+C&lt;/&gt; if C&lt;SCRIPT_NAME&gt; is empty. C&lt;SCRIPT_NAME&gt; B&lt;MUST NOT&gt; be C&lt;/&gt;, but
+B&lt;MAY&gt; be empty.
 
 =back
 
 =head3 The Input Stream
 
-The input stream in C&lt;psgi.input&gt; is an IO::Handle-like object which
+The input stream in C&lt;psgi.input&gt; is an L&lt;IO::Handle&gt;-like object which
 streams the raw HTTP POST or PUT data. If it is a file handle then it
-MUST be opened in binary mode. The input stream MUST respond to
-C&lt;read&gt; and MAY implement C&lt;seek&gt;.
+B&lt;MUST&gt; be opened in binary mode. The input stream B&lt;MUST&gt; respond to
+C&lt;read&gt; and B&lt;MAY&gt; implement C&lt;seek&gt;.
+
+Perl's built-in filehandles or L&lt;IO::Handle&gt; based objects should work as-is
+in a PSGI server. Application developers B&lt;SHOULD NOT&gt; inspect the type or
+class of the stream. Instead, they B&lt;SHOULD&gt; simply call C&lt;read&gt; on the object.
+
+Application developers B&lt;SHOULD NOT&gt; use Perl's built-in C&lt;read&gt; or iterator
+(C&lt;&lt; &lt;$fh&gt; &gt;&gt;) to read from the input stream, because. Instead, application
+developers should call C&lt;read&gt; as a method (C&lt;&lt; $fh-&gt;read &gt;&gt;) to allow for
+duck typing.
 
-The built-in filehandle or IO::Handle based objects should work fine
-everywhere. Application developers SHOULD NOT inspect the type or
-class of the stream, but instead just call C&lt;read&gt; to duck type.
+Framework developers, if they know the input stream will be used with the
+built-in read() in any upstream code they can't touch, B&lt;SHOULD&gt; use PerlIO or
+a tied handle to work around with this problem.
 
-Application developers SHOULD NOT use the built-in C&lt;read&gt; function to
-read from the input stream, because C&lt;read&gt; function only works with
-the real IO object (a glob ref based file handle or PerlIO) and makes
-duck typing difficult. Web application framework developers, if
-they know the input stream will be used with the built-in read() in any
-upstream code they can't touch, SHOULD use PerlIO or tie handle to
-work around with this problem.
+The input stream objet is expected to provide a C&lt;read&gt; method:
 
 =over 4
 
@@ -291,6 +281,12 @@ work around with this problem.
 Returns the number of characters actually read, 0 at end of file, or
 undef if there was an error.
 
+=back
+
+It may also implement an optional C&lt;seek&gt; method.
+
+=over 4
+
 =item seek
 
   $input-&gt;seek($pos, $whence);
@@ -299,14 +295,18 @@ Returns 1 on success, 0 otherwise.
 
 =back
 
+See the L&lt;IO::Handle&gt; documentation for more details on exactly how these
+methods should work.
+
 =head3 The Error Stream
 
-The error stream in C&lt;psgi.errors&gt; is an IO::Handle-like object to
-print errors. The error stream must implement C&lt;print&gt;.
+The error stream in C&lt;psgi.errors&gt; is an L&lt;IO::Handle&gt;-like object to
+print errors. The error stream must implement a C&lt;print&gt; method.
 
-The built-in filehandle or IO::Handle based objects should work fine
-everywhere. Application developers SHOULD NOT inspect the type or
-class of the stream, but instead just call C&lt;print&gt; to duck type.
+As with the input stream, Perl's built-in filehandles or L&lt;IO::Handle&gt; based
+objects should work as-is in a PSGI server. Application developers B&lt;SHOULD
+NOT&gt; inspect the type or class of the stream. Instead, they B&lt;SHOULD&gt; simply call C&lt;print&gt;
+on the object.
 
 =over 4
 
@@ -320,73 +320,74 @@ Returns true if successful.
 
 =head3 The Response
 
-The response MUST be a three element array reference if the
-application wants to directly return the HTTP response.
+Applications B&lt;MUST&gt; return a response as  a three element array reference.
+
+B&lt;IF&gt; the server supports the streaming (see below), an application B&lt;MAY&gt;
+choose to return other type of responses such as a code reference to delay the
+response.
 
-An application MAY choose to return other type of responses such as a
-code reference, to delay the response only if the server supports the
-streaming (See below).
+The response array reference consists of the following elements:
 
 =head4 Status
 
-HTTP status code, is an integer and MUST be greater than or equal to 100.
+An HTTP status code. This B&lt;MUST&gt; be an integer greater than or equal to 100,
+and B&lt;SHOULD&gt; be an HTTP status code as documented in L&lt;RFC
+2616|http://www.w3.org/Protocols/rfc2616&gt;.
 
 =head4 Headers
 
-The headers must be an array reference (and NOT a hash reference!)
-containing key and value pairs.  Its number of elements MUST be
-even. The header MUST NOT contain a C&lt;Status&gt; key, contain keys with
-C&lt;:&gt; or newlines in their name, contain keys that end in C&lt;-&gt; or C&lt;_&gt;
-but only contain keys that consist of letters, digits, C&lt;_&gt; or C&lt;-&gt;
-and start with a letter. The value of the header must be a scalar
-value that contain a string. The value string MUST NOT contain
-characters below chr(37) except chr(32) (whitespace).
+The headers B&lt;MUST&gt; be an array reference (B&lt;not&gt; a hash reference)
+of key/value pairs. This means it B&lt;MUST&gt; contain an even number of elements.
+
+The header B&lt;MUST NOT&gt; contain a key named C&lt;Status&gt;, onr any keys with
+C&lt;:&gt; or newlines in their name. It B&lt;MUST NOT&gt; contain any keys that end in C&lt;-&gt; or C&lt;_&gt;.
+
+All keys B&lt;MUST&gt; consist only of letters, digits, C&lt;_&gt; or C&lt;-&gt;. All keys
+B&lt;MUST&gt; start with a letter. The value of the header must be a scalar
+string. The value string B&lt;MUST NOT&gt; contain characters below ASCII chr(37) except for
+chr(32) (whitespace).
 
 If the same key name appears multiple times in an array ref, those
-header lines MUST be sent to the client separately (e.g. multiple
+header lines B&lt;MUST&gt; be sent to the client separately (e.g. multiple
 C&lt;Set-Cookie&gt; lines).
 
 =head4 Content-Type
 
-There MUST be a C&lt;Content-Type&gt; except when the C&lt;Status&gt; is 1xx, 204
-or 304, in which case there MUST be none given.
+There B&lt;MUST&gt; be a C&lt;Content-Type&gt; except when the C&lt;Status&gt; is 1xx, 204
+or 304, in which case there B&lt;MUST NOT&gt; be a content type.
 
 =head4 Content-Length
 
-There MUST NOT be a C&lt;Content-Length&gt; header when the C&lt;Status&gt; is
+There B&lt;MUST NOT&gt; be a C&lt;Content-Length&gt; header when the C&lt;Status&gt; is
 1xx, 204 or 304.
 
 If the Status is not 1xx, 204 or 304 and there is no C&lt;Content-Length&gt;
-header, servers MAY calculate the content length by looking at Body,
-in case it can be calculated (i.e. if it's an array ref of body chunk
-or a real file handle), and append to the outgoing headers.
+header, a PSGI server B&lt;MAY&gt; calculate the content length by looking at the Body. This value can then be appended to the list of headers returned by the application.
 
 =head4 Body
 
-The response body is returned from the application in one of following
-two types of scalar variable.
+The response body B&lt;MUST&gt; be returned from the application as either an array
+reference or a handle.
 
 =over 4
 
 =item *
 
-An array reference containing body as lines.
+If it an array reference, it is expected to contain an array of lines which make up the body.
 
   my $body = [ &quot;Hello\n&quot;, &quot;World\n&quot; ];
 
-Note that the elements in an array reference are NOT REQUIRED to end
-in a newline. The servers SHOULD just write each elements as is to the
-client, and SHOULD NOT care if the line ends with newline or not.
-
-So, when you have a big chunk of HTML in a single scalar C&lt;$body&gt;,
+Note that the elements in an array reference are B&lt;NOT REQUIRED&gt; to end
+in a newline. A server B&lt;SHOULD&gt; write each elements as-is to the
+client, and B&lt;SHOULD NOT&gt; care if the line ends with newline or not.
 
-  [ $body ]
-
-is a valid response body.
+An array reference with a single value is valid. So C&lt;[ $body ]&gt; is a valid
+response body.
 
 =item *
 
-An IO::Handle-like object or a built-in filehandle.
+The body can instead be a handle, either a Perl built-in filehandle or an
+L&lt;IO::Handle&gt;-like object.
 
   open my $body, &quot;&lt;/path/to/file&quot;;
   open my $body, &quot;&lt;:via(SomePerlIO)&quot;, ...;
@@ -394,64 +395,68 @@ An IO::Handle-like object or a built-in filehandle.
 
   my $body = SomeClass-&gt;new(); # mock class that implements getline() and close()
 
-Servers SHOULD NOT check the type or class of the body but instead
-just call C&lt;getline&gt; (i.e. duck type) to iterate over the body and
+Servers B&lt;SHOULD NOT&gt; check the type or class of the body. Instead, they should
+simply call C&lt;getline&gt; to iterate over the body, and
 call C&lt;close&gt; when done.
 
-Servers MAY check if the body is a real filehandle using C&lt;fileno&gt; and
-C&lt;Scalar::Util::reftype&gt; and if it's a real filehandle that has a file
-descriptor, it MAY optimize the file serving using techniques like
-I&lt;sendfile(2)&gt;.
+Servers B&lt;MAY&gt; check if the body is a real filehandle using C&lt;fileno&gt; and
+C&lt;Scalar::Util::reftype&gt;. If the body is real filehandle, the server B&lt;MAY&gt;
+optimize using techniques like I&lt;sendfile(2)&gt;.
+
+The body object B&lt;MAY&gt; also respond to a C&lt;path&gt; method. This method is
+expected to return the path to a file accessible by the server. This allows
+the server to use this information instead of a file descriptor number to
+server the file.
 
-The body object MAY respond to C&lt;path&gt; method to return the local file
-system path, which MAY be used by some servers to switch to more
-efficient file serving method using the file path instead of a file
-descriptor.
+Servers B&lt;SHOULD&gt; set the C&lt;$/&gt; special variable to the buffer size when
+reading content from C&lt;$body&gt; using the C&lt;getline&gt; method. This is done by
+setting C&lt;$/&gt; with a reference to an integer (C&lt;$/ = \8192&gt;).
 
-Servers are RECOMMENDED to set C&lt;$/&gt; special variable to the buffer
-size when reading content from C&lt;$body&gt; using C&lt;getline&gt; method, in
-case it's a binary filehandle. Applications, when it returns a mock
-object that implements C&lt;getline&gt; are NOT REQUIRED to respect the
-C&lt;$/&gt; value.
+If the body filehandle is a Perl built-in filehandle L&lt;IO::Handle&gt; object,
+they will respect this value. Similarly, an object which provides the same API
+B&lt;MAY&gt; also respect this special variable, but are not required to do so.
 
 =back
 
-=head2 Delayed Reponse and Streaming Body
+=head2 Delayed Response and Streaming Body
 
-PSGI interface allows applications and servers optionally handle
-callback-style response (instead of three-element array reference) to
-delay the HTTP response and stream content (server push).
+The PSGI interface allows applications and servers to provide a callback-style
+response instead of the three-element array reference. This allows for a
+delayed response and a streaming body (server push).
 
-To enable delayed response, an application SHOULD check if
-C&lt;psgi.streaming&gt; environment is true, and in that case, MAY return a
-callback that is passed another callback (response starter) as its
-first argument, and pass the three element response to the callback.
+To enable a delayed response, an application B&lt;SHOULD&gt; check if
+the C&lt;psgi.streaming&gt; environment is true. If it is, the application B&lt;MAY&gt; return a
+callback as its response.
+
+This callback will be called with I&lt;another&gt; subroutine reference (referred to
+as the I&lt;responder&gt; from now on) as it's only argument. The I&lt;responder&gt;
+should in turn be called with the standard three element array reference
+response. This is best illustrated with an example:
 
   my $app = sub {
       my $env = shift;
 
       # Delays response until it fetches content from the network
       return sub {
-          my $respond = shift;
-          fetch_content_from_server(sub {
-              my $content = shift;
-              # ...
-              $respond-&gt;([ 200, $headers, [ $content ] ]);
-          });
+          my $responder = shift;
+
+          my $content = fetch_content_from_server();
+          $responder-&gt;([ 200, $headers, [ $content ] ]);
       };
   };
 
-Similarly, an application MAY omit the third element (the body) in the
-callback to get a response writer object, that implements C&lt;write&gt;,
-C&lt;poll_cb&gt; and C&lt;close&gt; method to push the response body.
+An application B&lt;MAY&gt; omit the third element (the body) when calling the
+I&lt;responder&gt;. If the body is omitted, the I&lt;responder&gt; will return I&lt;yet
+another&gt; an object which implements C&lt;write&gt;, C&lt;poll_cb&gt; and C&lt;close&gt;
+methods. Again, an example illustrates this best.
 
   my $app = sub {
       my $env = shift;
 
       # immediately starts the response and stream the content
       return sub {
-          my $respond = shift;
-          my $writer = $respond-&gt;([ 200, [ 'Content-Type', 'application/json' ]]);
+          my $responder = shift;
+          my $writer = $responder-&gt;([ 200, [ 'Content-Type', 'application/json' ]]);
 
           wait_for_events(sub {
               my $new_event = shift;
@@ -466,25 +471,26 @@ C&lt;poll_cb&gt; and C&lt;close&gt; method to push the response body.
       };
   };
 
-Delayed response and streaming should be useful if you want to
-implement non-blocking I/O based server streaming or long-poll Comet
-push technology. IO::Handle-like object is I&lt;pull&gt;, while this
-streaming response implements I&lt;push&gt;.
+B&lt;XXX: still need detalis on write, poll_cb, and close API methods.&gt;
+
+This delayed response and streaming API is useful if you want to
+implement a non-blocking I/O based server streaming or long-poll Comet
+push technology.
+
+This interface is optional: An application B&lt;SHOULD&gt; check if the server
+supports streaming before attempting to use it. Servers B&lt;MAY&gt; throw an
+exception if they do not support streaming a response.
 
-This interface is optional: An applciation SHOULD check if the server
-supports streaming. Servers MAY decide to not accept this streaming
-response and throws an exception. Servers MUST set C&lt;psgi.streaming&gt;
-to true if this interface is supported. Servers MUST return a writer
-object if the third argument (response body) is omitted or not
-defined in the response starter callback arguments.
+Servers B&lt;MUST&gt; set C&lt;psgi.streaming&gt; to true if this interface is
+supported, and if it is supported, servers B&lt;MUST&gt; return a writer object when the third argument
+(response body) to the I&lt;responder&gt; is omitted.
 
 =head2 Middleware
 
-Middleware is itself a PSGI application but it takes an existing PSGI
-application and runs it like a server, mostly to do pre-processing on
-C&lt;$env&gt; or post-processing on the response objects.
+A piece of I&lt;middleware&gt; is itself a PSGI application, one which takes an existing PSGI
+application and runs it like a server. Generally, this will be done in order to implement some sort of pre-processing on the PSGI environment has or  post-processing on the response.
 
-Here's a simple example that appends special HTTP header
+Here's a simple example that appends a special HTTP header
 I&lt;X-PSGI-Used&gt; to any PSGI application.
 
   # $app is a simple PSGI application
@@ -493,7 +499,7 @@ I&lt;X-PSGI-Used&gt; to any PSGI application.
       return [ '200', [ 'Content-Type' =&gt; 'text/plain' ], [ &quot;Hello World&quot; ] ];
   };
 
-  # $xheader is a middleware to wrap $app
+  # $xheader is a piece of middleware that wraps $app
   my $xheader = sub {
       my $env = shift;
       my $res = $app-&gt;($env);
@@ -501,10 +507,10 @@ I&lt;X-PSGI-Used&gt; to any PSGI application.
       return $res;
   };
 
-Middleware itself MUST behave exactly like a PSGI application: take
-C&lt;$env&gt; and return C&lt;$res&gt;. Middleware MAY decide not to support the
-streaming interface (see above) but SHOULD pass through the response
-types that it doesn't understand.
+Middleware B&lt;MUST&gt; behave exactly like a PSGI application from the perspective
+of a server. Middleware B&lt;MAY&gt; decide not to support the streaming interface
+discussed earlier, but B&lt;SHOULD&gt; pass through the response types that it doesn't
+understand.
 
 =head1 ACKNOWLEDGEMENTS
 </diff>
      <filename>PSGI.pod</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>fc80fb98dc932a7cbac25d5591988f5796cc83e9</id>
    </parent>
  </parents>
  <author>
    <name>Dave Rolsky</name>
    <email>autarch@urth.org</email>
  </author>
  <url>http://github.com/autarch/psgi-specs/commit/3e2dde3c19cb9d2c308ce815997199835333ca80</url>
  <id>3e2dde3c19cb9d2c308ce815997199835333ca80</id>
  <committed-date>2009-10-27T16:28:00-07:00</committed-date>
  <authored-date>2009-10-27T16:28:00-07:00</authored-date>
  <message>English cleanup, rewriting parts for clarity, adding links, and small bits of re-org.</message>
  <tree>5beef78f23bc756e5aab8eb2d148395235f6c558</tree>
  <committer>
    <name>Dave Rolsky</name>
    <email>autarch@urth.org</email>
  </committer>
</commit>
