Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Unified Diff: third_party/WebKit/Source/core/page/EventSource.cpp

Issue 1601553004: [EventSource] retry field including non-digit chars should be ignored (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@event-source
Patch Set: rebase Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/page/EventSourceTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/page/EventSource.cpp
diff --git a/third_party/WebKit/Source/core/page/EventSource.cpp b/third_party/WebKit/Source/core/page/EventSource.cpp
index ca424e3fb96a7440526b0889d0adf6e768bbb9e4..8b2231cb80c159fc92eafd520e9dc7df15411340 100644
--- a/third_party/WebKit/Source/core/page/EventSource.cpp
+++ b/third_party/WebKit/Source/core/page/EventSource.cpp
@@ -55,6 +55,7 @@
#include "platform/network/ResourceResponse.h"
#include "platform/weborigin/SecurityOrigin.h"
#include "public/platform/WebURLRequest.h"
+#include "wtf/ASCIICType.h"
#include "wtf/text/StringBuilder.h"
namespace blink {
@@ -408,9 +409,13 @@ void EventSource::parseEventStreamLine(unsigned bufPos, int fieldLength, int lin
} else if (field == "id") {
m_currentlyParsedEventId = valueLength ? AtomicString(&m_receiveBuf[bufPos], valueLength) : "";
} else if (field == "retry") {
+ bool hasOnlyDigits = true;
+ for (int i = 0; i < valueLength && hasOnlyDigits; ++i) {
+ hasOnlyDigits = isASCIIDigit(m_receiveBuf[bufPos + i]);
+ }
tyoshino (SeeGerritForStatus) 2016/01/25 05:08:44 run this code only when valueLength is not 0? you
yhirano 2016/01/25 11:22:34 I want to do it, but I'm not planning it. It's jus
if (!valueLength) {
m_reconnectDelay = defaultReconnectDelay;
- } else {
+ } else if (hasOnlyDigits) {
String value(&m_receiveBuf[bufPos], valueLength);
bool ok;
unsigned long long retry = value.toUInt64(&ok);
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/page/EventSourceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698