Changeset 52891 in webkit
- Timestamp:
- Jan 6, 2010 6:20:02 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r52889 r52891 1 2010-01-06 Adam Bergkvist <adam.bergkvist@ericsson.com> 2 3 Reviewed by Darin Adler. 4 5 Modified EventSource event-stream parser to support a single CR as line ending. 6 Updated test accordingly. 7 https://bugs.webkit.org/show_bug.cgi?id=33207 8 9 * http/tests/eventsource/eventsource-parse-event-stream-expected.txt: 10 * http/tests/eventsource/eventsource-parse-event-stream.html: 11 * http/tests/eventsource/resources/event-stream.php: 12 1 13 2010-01-06 Dan Bernstein <mitz@apple.com> 2 14 -
trunk/LayoutTests/http/tests/eventsource/eventsource-parse-event-stream-expected.txt
r47323 r52891 9 9 PASS: got open event from server 10 10 PASS: received event and the event name has been reset 11 PASS: received event with data that contains a colon and a carriage return11 PASS: received event with data that contains a colon 12 12 DONE 13 13 -
trunk/LayoutTests/http/tests/eventsource/eventsource-parse-event-stream.html
r47323 r52891 50 50 break; 51 51 case 6: 52 if (evt.data == "a line ending with crlf\na line with a : (colon)\na line with a \r (carriage return)")53 log("PASS: received event with data that contains a colon and a carriage return");52 if (evt.data == "a line ending with crlf\na line with a : (colon)\na line ending with cr"); 53 log("PASS: received event with data that contains a colon"); 54 54 break; 55 55 default: -
trunk/LayoutTests/http/tests/eventsource/resources/event-stream.php
r47323 r52891 39 39 <?php echo "data: a line ending with crlf\r\n"; ?> 40 40 data: a line with a : (colon) 41 <?php echo "data: a line with a \r (carriage return)\n"; ?>41 <?php echo "data: a line ending with cr\r"; ?> 42 42 43 43 retry: 10000 -
trunk/WebCore/ChangeLog
r52890 r52891 1 2010-01-06 Adam Bergkvist <adam.bergkvist@ericsson.com> 2 3 Reviewed by Darin Adler. 4 5 Modified EventSource event-stream parser to support a single CR as line ending. 6 https://bugs.webkit.org/show_bug.cgi?id=33207 7 8 * page/EventSource.cpp: 9 (WebCore::EventSource::EventSource): 10 (WebCore::EventSource::parseEventStream): 11 * page/EventSource.h: 12 1 13 2010-01-06 Joanmarie Diggs <joanmarie.diggs@gmail.com> 2 14 -
trunk/WebCore/page/EventSource.cpp
r49214 r52891 58 58 , m_state(CONNECTING) 59 59 , m_reconnectTimer(this, &EventSource::reconnectTimerFired) 60 , m_discardTrailingNewline(false) 60 61 , m_failSilently(false) 61 62 , m_requestInFlight(false) … … 211 212 unsigned int bufPos = 0; 212 213 unsigned int bufSize = m_receiveBuf.size(); 213 for (;;) { 214 while (bufPos < bufSize) { 215 if (m_discardTrailingNewline) { 216 if (m_receiveBuf[bufPos] == '\n') 217 bufPos++; 218 m_discardTrailingNewline = false; 219 } 220 214 221 int lineLength = -1; 215 222 int fieldLength = -1; 216 int carriageReturn = 0;217 223 for (unsigned int i = bufPos; lineLength < 0 && i < bufSize; i++) { 218 224 switch (m_receiveBuf[i]) { … … 221 227 fieldLength = i - bufPos; 222 228 break; 229 case '\r': 230 m_discardTrailingNewline = true; 223 231 case '\n': 224 if (i > bufPos && m_receiveBuf[i - 1] == '\r') {225 carriageReturn++;226 i--;227 }228 232 lineLength = i - bufPos; 229 233 break; … … 235 239 236 240 parseEventStreamLine(bufPos, fieldLength, lineLength); 237 bufPos += lineLength + carriageReturn +1;241 bufPos += lineLength + 1; 238 242 } 239 243 -
trunk/WebCore/page/EventSource.h
r51473 r52891 115 115 Timer<EventSource> m_reconnectTimer; 116 116 Vector<UChar> m_receiveBuf; 117 bool m_discardTrailingNewline; 117 118 bool m_failSilently; 118 119 bool m_requestInFlight;
Note: See TracChangeset
for help on using the changeset viewer.