[html5] r6371 - [giow] (1) Change text/event-stream to drop final events not followed by a blank [...]

whatwg at whatwg.org whatwg at whatwg.org
Thu Aug 4 14:54:07 PDT 2011


Author: ianh
Date: 2011-08-04 14:54:06 -0700 (Thu, 04 Aug 2011)
New Revision: 6371

Modified:
   complete.html
   source
Log:
[giow] (1) Change text/event-stream to drop final events not followed by a blank line, since otherwise interrupted streams would fire incomplete events.
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=13071

Modified: complete.html
===================================================================
--- complete.html	2011-08-04 21:46:02 UTC (rev 6370)
+++ complete.html	2011-08-04 21:54:06 UTC (rev 6371)
@@ -79840,8 +79840,7 @@
 event         = *( comment / field ) end-of-line
 comment       = colon *any-char end-of-line
 field         = 1*name-char [ colon [ space ] *any-char ] end-of-line
-end-of-line   = ( cr lf / cr / lf / eof )
-eof           = < matches repeatedly at the end of the stream >
+end-of-line   = ( cr lf / cr / lf )
 
 ; characters
 lf            = %x000A ; U+000A LINE FEED (LF)
@@ -79934,11 +79933,11 @@
 
    </dd>
 
-  </dl><p>Once the end of the file is reached, the user agent must <a href=#dispatchMessage>dispatch the event</a> one final time, as
-  defined below.</p>
+  </dl><p>Once the end of the file is reached, any pending data must be
+  discarded. (If the file ends in the middle of an event, before the
+  final empty line, the incomplete event is not dispatched.)</p>
 
-
-  <p id=processField>The steps to <dfn title="">process the
+  <hr><p id=processField>The steps to <dfn title="">process the
   field</dfn> given a field name and a field value depend on the field
   name, as given in the following list. Field names must be compared
   literally, with no case folding performed.</p>
@@ -80089,10 +80088,11 @@
    and also has an "id" field, this time with no value, which resets
    the last event ID to the empty string (meaning no <code title=http-last-event-id><a href=#last-event-id>Last-Event-ID</a></code> header will now be
    sent in the event of a reconnection being attempted). Finally, the
-   last block just fires an event with the data " third event"
-   (with a single leading space character). Note that the last block
-   doesn't have to end with a blank line, the end of the stream is
-   enough to trigger the dispatch of the last event.</p>
+   last block just fires an event with the data
+   " third event" (with a single leading space character).
+   Note that the last still has to end with a blank line, the end of
+   the stream is not enough to trigger the dispatch of the last
+   event.</p>
 
    <pre>: test stream
 
@@ -80102,12 +80102,13 @@
 data:second event
 id
 
-data:  third event</pre>
+data:  third event
+</pre>
   </div>
 
   <div class=example>
 
-   <p>The following stream fires three events:</p>
+   <p>The following stream fires two events:</p>
 
    <pre>data
 
@@ -80116,9 +80117,11 @@
 
 data:</pre>
 
-   <p>The first and last blocks fire events with the data set to the
-   empty string. The middle block fires an event with the data set to
-   a single newline character.</p>
+   <p>The first block fires events with the data set to the empty
+   string, as would the last block if it was followed by a blank line.
+   The middle block fires an event with the data set to a single
+   newline character. The last block is discarded because it is not
+   followed by a blank line.</p>
 
   </div>
 
@@ -80128,7 +80131,8 @@
 
    <pre>data:test
 
-data: test</pre>
+data: test
+</pre>
 
    <p>This is because the space after the colon is ignored if
    present.</p>
@@ -80267,15 +80271,18 @@
    <dt>Required parameters:</dt>
    <dd>No parameters</dd>
    <dt>Optional parameters:</dt>
-   <dt>
-    </dt><dl><dt><code title="">charset</code></dt>
+   <dd>
+    <dl><dt><code title="">charset</code></dt>
      <dd>
+
       <p>The <code title="">charset</code> parameter may be provided.
       The parameter's value must be "<code title="">utf-8</code>".
       This parameter serves no purpose; it is only allowed for
       compatibility with legacy servers.</p>
+
      </dd>
-    </dl><dt>Encoding considerations:</dt>
+    </dl></dd>
+   <dt>Encoding considerations:</dt>
    <dd>Always UTF-8.</dd>
    <dt>Security considerations:</dt>
    <dd>

Modified: source
===================================================================
--- source	2011-08-04 21:46:02 UTC (rev 6370)
+++ source	2011-08-04 21:54:06 UTC (rev 6371)
@@ -90372,8 +90372,7 @@
 event         = *( comment / field ) end-of-line
 comment       = colon *any-char end-of-line
 field         = 1*name-char [ colon [ space ] *any-char ] end-of-line
-end-of-line   = ( cr lf / cr / lf / eof )
-eof           = < matches repeatedly at the end of the stream >
+end-of-line   = ( cr lf / cr / lf )
 
 ; characters
 lf            = %x000A ; U+000A LINE FEED (LF)
@@ -90473,10 +90472,11 @@
 
   </dl>
 
-  <p>Once the end of the file is reached, the user agent must <a
-  href="#dispatchMessage">dispatch the event</a> one final time, as
-  defined below.</p>
+  <p>Once the end of the file is reached, any pending data must be
+  discarded. (If the file ends in the middle of an event, before the
+  final empty line, the incomplete event is not dispatched.)</p>
 
+  <hr>
 
   <p id="processField">The steps to <dfn title="">process the
   field</dfn> given a field name and a field value depend on the field
@@ -90653,10 +90653,11 @@
    the last event ID to the empty string (meaning no <code
    title="http-last-event-id">Last-Event-ID</code> header will now be
    sent in the event of a reconnection being attempted). Finally, the
-   last block just fires an event with the data " third event"
-   (with a single leading space character). Note that the last block
-   doesn't have to end with a blank line, the end of the stream is
-   enough to trigger the dispatch of the last event.</p>
+   last block just fires an event with the data
+   " third event" (with a single leading space character).
+   Note that the last still has to end with a blank line, the end of
+   the stream is not enough to trigger the dispatch of the last
+   event.</p>
 
    <pre>: test stream
 
@@ -90666,12 +90667,13 @@
 data:second event
 id
 
-data:  third event</pre>
+data:  third event
+</pre>
   </div>
 
   <div class="example">
 
-   <p>The following stream fires three events:</p>
+   <p>The following stream fires two events:</p>
 
    <pre>data
 
@@ -90680,9 +90682,11 @@
 
 data:</pre>
 
-   <p>The first and last blocks fire events with the data set to the
-   empty string. The middle block fires an event with the data set to
-   a single newline character.</p>
+   <p>The first block fires events with the data set to the empty
+   string, as would the last block if it was followed by a blank line.
+   The middle block fires an event with the data set to a single
+   newline character. The last block is discarded because it is not
+   followed by a blank line.</p>
 
   </div>
 
@@ -90692,7 +90696,8 @@
 
    <pre>data:test
 
-data: test</pre>
+data: test
+</pre>
 
    <p>This is because the space after the colon is ignored if
    present.</p>
@@ -90846,14 +90851,16 @@
    <dt>Required parameters:</dt>
    <dd>No parameters</dd>
    <dt>Optional parameters:</dt>
-   <dt>
+   <dd>
     <dl>
      <dt><code title="">charset</code></dt>
      <dd>
+
       <p>The <code title="">charset</code> parameter may be provided.
       The parameter's value must be "<code title="">utf-8</code>".
       This parameter serves no purpose; it is only allowed for
       compatibility with legacy servers.</p>
+
      </dd>
     </dl>
    </dd>




More information about the Commit-Watchers mailing list