Small cleanups to ported QuicServer and dependencies

Based on review comments from https://codereview.chromium.org/337093003/

BUG=

Review URL: https://codereview.chromium.org/361083002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282275 0039d316-1c4b-4281-b951-d872f2087c98
parent fa9eac88
...@@ -549,7 +549,7 @@ ...@@ -549,7 +549,7 @@
'net', 'net',
'net_derived_sources', 'net_derived_sources',
'net_test_support', 'net_test_support',
'quic_ported_server', 'quic_tools',
], ],
'sources': [ 'sources': [
'<@(net_test_sources)', '<@(net_test_sources)',
...@@ -1121,7 +1121,7 @@ ...@@ -1121,7 +1121,7 @@
{ {
# This is a temporary target which will be merged into 'net' once the # This is a temporary target which will be merged into 'net' once the
# dependency on balsa is eliminated and the classes are actually used. # dependency on balsa is eliminated and the classes are actually used.
'target_name': 'quic_ported_server', 'target_name': 'quic_tools',
'type': 'static_library', 'type': 'static_library',
'dependencies': [ 'dependencies': [
'../base/base.gyp:base', '../base/base.gyp:base',
...@@ -1509,7 +1509,7 @@ ...@@ -1509,7 +1509,7 @@
'dependencies': [ 'dependencies': [
'../base/base.gyp:base', '../base/base.gyp:base',
'net', 'net',
'quic_ported_server', 'quic_tools',
], ],
'sources': [ 'sources': [
'quic/quic_server_bin.cc', 'quic/quic_server_bin.cc',
......
...@@ -32,10 +32,14 @@ QuicSpdyServerStream::~QuicSpdyServerStream() { ...@@ -32,10 +32,14 @@ QuicSpdyServerStream::~QuicSpdyServerStream() {
} }
uint32 QuicSpdyServerStream::ProcessData(const char* data, uint32 data_len) { uint32 QuicSpdyServerStream::ProcessData(const char* data, uint32 data_len) {
if (data_len > INT_MAX) {
LOG(DFATAL) << "Data length too long: " << data_len;
return 0;
}
// Are we still reading the request headers. // Are we still reading the request headers.
if (!request_headers_received_) { if (!request_headers_received_) {
// Grow the read buffer if necessary. // Grow the read buffer if necessary.
while (read_buf_->RemainingCapacity() < (int)data_len) { while (read_buf_->RemainingCapacity() < static_cast<int>(data_len)) {
read_buf_->SetCapacity(read_buf_->capacity() * 2); read_buf_->SetCapacity(read_buf_->capacity() * 2);
} }
memcpy(read_buf_->data(), data, data_len); memcpy(read_buf_->data(), data, data_len);
...@@ -76,13 +80,13 @@ void QuicSpdyServerStream::OnFinRead() { ...@@ -76,13 +80,13 @@ void QuicSpdyServerStream::OnFinRead() {
// request_headers_received_. If not successful, it can just be tried again once // request_headers_received_. If not successful, it can just be tried again once
// there's more data. // there's more data.
void QuicSpdyServerStream::ParseRequestHeaders() { void QuicSpdyServerStream::ParseRequestHeaders() {
SpdyFramer framer(kDefaultSpdyMajorVersion); SpdyFramer framer((kDefaultSpdyMajorVersion));
char* data = read_buf_->StartOfBuffer(); const char* data = read_buf_->StartOfBuffer();
size_t read_buf_len = static_cast<size_t>(read_buf_->offset()); size_t read_buf_len = static_cast<size_t>(read_buf_->offset());
size_t len = framer.ParseHeaderBlockInBuffer(data, read_buf_len, &headers_); size_t len = framer.ParseHeaderBlockInBuffer(data, read_buf_len, &headers_);
if (len == 0) { if (len == 0) {
// Not enough data yet, presumably. (If we still don't succeed by the end of // Not enough data yet, presumably. (If we still don't succeed by the end of
// the stream, then we'll error above.) // the stream, then we'll error in OnFinRead().)
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment