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

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

Issue 1357953002: Replace the existing SpdyHeaderBlock typedef with a class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add NET_EXPORT to fix compile error on win_chromium_compile_dbg_ng. Created 5 years, 2 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
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_client_stream.h" 5 #include "net/tools/quic/quic_spdy_client_stream.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "net/quic/spdy_utils.h" 10 #include "net/quic/spdy_utils.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 &response_headers_); 86 &response_headers_);
87 DCHECK_LE(len, data_len); 87 DCHECK_LE(len, data_len);
88 if (len == 0 || response_headers_.empty()) { 88 if (len == 0 || response_headers_.empty()) {
89 return false; // Headers were invalid. 89 return false; // Headers were invalid.
90 } 90 }
91 91
92 if (data_len > len) { 92 if (data_len > len) {
93 data_.append(data + len, data_len - len); 93 data_.append(data + len, data_len - len);
94 } 94 }
95 if (ContainsKey(response_headers_, "content-length") && 95 if (ContainsKey(response_headers_, "content-length") &&
96 !StringToInt(response_headers_["content-length"], &content_length_)) { 96 !StringToInt(StringPiece(response_headers_["content-length"]),
97 &content_length_)) {
97 return false; // Invalid content-length. 98 return false; // Invalid content-length.
98 } 99 }
99 string status = response_headers_[":status"]; 100 string status = response_headers_[":status"].as_string();
100 size_t end = status.find(" "); 101 size_t end = status.find(" ");
101 if (end != string::npos) { 102 if (end != string::npos) {
102 status.erase(end); 103 status.erase(end);
103 } 104 }
104 if (!StringToInt(status, &response_code_)) { 105 if (!StringToInt(status, &response_code_)) {
105 return false; // Invalid response code. 106 return false; // Invalid response code.
106 } 107 }
107 return true; 108 return true;
108 } 109 }
109 110
(...skipping 18 matching lines...) Expand all
128 } 129 }
129 130
130 void QuicSpdyClientStream::SendBody( 131 void QuicSpdyClientStream::SendBody(
131 const string& data, bool fin, 132 const string& data, bool fin,
132 QuicAckNotifier::DelegateInterface* delegate) { 133 QuicAckNotifier::DelegateInterface* delegate) {
133 WriteOrBufferData(data, fin, delegate); 134 WriteOrBufferData(data, fin, delegate);
134 } 135 }
135 136
136 } // namespace tools 137 } // namespace tools
137 } // namespace net 138 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_simple_client_bin.cc ('k') | net/tools/quic/quic_spdy_server_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698