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

Side by Side Diff: net/tools/quic/quic_spdy_server_stream.cc

Issue 374033002: Fixes for re-enabling more MSVC level 4 warnings: net/ edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comment Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/tools/quic/quic_spdy_server_stream.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/tools/quic/quic_spdy_server_stream.h" 5 #include "net/tools/quic/quic_spdy_server_stream.h"
6 6
7 #include "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "net/quic/quic_session.h" 8 #include "net/quic/quic_session.h"
9 #include "net/spdy/spdy_framer.h" 9 #include "net/spdy/spdy_framer.h"
10 #include "net/tools/quic/quic_in_memory_cache.h" 10 #include "net/tools/quic/quic_in_memory_cache.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 SendErrorResponse(); // We're not done reading headers. 57 SendErrorResponse(); // We're not done reading headers.
58 } else if ((headers_.content_length_status() == 58 } else if ((headers_.content_length_status() ==
59 BalsaHeadersEnums::VALID_CONTENT_LENGTH) && 59 BalsaHeadersEnums::VALID_CONTENT_LENGTH) &&
60 body_.size() != headers_.content_length()) { 60 body_.size() != headers_.content_length()) {
61 SendErrorResponse(); // Invalid content length 61 SendErrorResponse(); // Invalid content length
62 } else { 62 } else {
63 SendResponse(); 63 SendResponse();
64 } 64 }
65 } 65 }
66 66
67 int QuicSpdyServerStream::ParseRequestHeaders() { 67 void QuicSpdyServerStream::ParseRequestHeaders() {
68 size_t read_buf_len = static_cast<size_t>(read_buf_->offset()); 68 size_t read_buf_len = static_cast<size_t>(read_buf_->offset());
69 SpdyFramer framer(SPDY3); 69 SpdyFramer framer(SPDY3);
70 SpdyHeaderBlock headers; 70 SpdyHeaderBlock headers;
71 char* data = read_buf_->StartOfBuffer(); 71 char* data = read_buf_->StartOfBuffer();
72 size_t len = framer.ParseHeaderBlockInBuffer(data, read_buf_->offset(), 72 size_t len = framer.ParseHeaderBlockInBuffer(data, read_buf_->offset(),
73 &headers); 73 &headers);
74 if (len == 0) { 74 if (len == 0) {
75 return -1; 75 return;
76 } 76 }
77 77
78 if (!SpdyUtils::FillBalsaRequestHeaders(headers, &headers_)) { 78 if (!SpdyUtils::FillBalsaRequestHeaders(headers, &headers_)) {
79 SendErrorResponse(); 79 SendErrorResponse();
80 return -1; 80 return;
81 } 81 }
82 82
83 size_t delta = read_buf_len - len; 83 size_t delta = read_buf_len - len;
84 if (delta > 0) { 84 if (delta > 0) {
85 body_.append(data + len, delta); 85 body_.append(data + len, delta);
86 } 86 }
87 87
88 request_headers_received_ = true; 88 request_headers_received_ = true;
89 return len;
90 } 89 }
91 90
92 void QuicSpdyServerStream::SendResponse() { 91 void QuicSpdyServerStream::SendResponse() {
93 // Find response in cache. If not found, send error response. 92 // Find response in cache. If not found, send error response.
94 const QuicInMemoryCache::Response* response = 93 const QuicInMemoryCache::Response* response =
95 QuicInMemoryCache::GetInstance()->GetResponse(headers_); 94 QuicInMemoryCache::GetInstance()->GetResponse(headers_);
96 if (response == NULL) { 95 if (response == NULL) {
97 SendErrorResponse(); 96 SendErrorResponse();
98 return; 97 return;
99 } 98 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 134
136 WriteHeaders(header_block, body.empty(), NULL); 135 WriteHeaders(header_block, body.empty(), NULL);
137 136
138 if (!body.empty()) { 137 if (!body.empty()) {
139 WriteOrBufferData(body, true, NULL); 138 WriteOrBufferData(body, true, NULL);
140 } 139 }
141 } 140 }
142 141
143 } // namespace tools 142 } // namespace tools
144 } // namespace net 143 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_spdy_server_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698