OLD | NEW |
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 size_t end = status.find(" "); | 93 size_t end = status.find(" "); |
94 if (end != string::npos) { | 94 if (end != string::npos) { |
95 status.erase(end); | 95 status.erase(end); |
96 } | 96 } |
97 if (!StringToInt(status, &response_code_)) { | 97 if (!StringToInt(status, &response_code_)) { |
98 return false; // Invalid response code. | 98 return false; // Invalid response code. |
99 } | 99 } |
100 return true; | 100 return true; |
101 } | 101 } |
102 | 102 |
103 ssize_t QuicSpdyClientStream::SendRequest(const SpdyHeaderBlock& headers, | 103 size_t QuicSpdyClientStream::SendRequest(const SpdyHeaderBlock& headers, |
104 StringPiece body, | 104 StringPiece body, |
105 bool fin) { | 105 bool fin) { |
106 bool send_fin_with_headers = fin && body.empty(); | 106 bool send_fin_with_headers = fin && body.empty(); |
107 size_t bytes_sent = body.size(); | 107 size_t bytes_sent = body.size(); |
108 header_bytes_written_ = | 108 header_bytes_written_ = |
109 WriteHeaders(headers, send_fin_with_headers, nullptr); | 109 WriteHeaders(headers, send_fin_with_headers, nullptr); |
110 bytes_sent += header_bytes_written_; | 110 bytes_sent += header_bytes_written_; |
111 | 111 |
112 if (!body.empty()) { | 112 if (!body.empty()) { |
113 WriteOrBufferData(body, fin, nullptr); | 113 WriteOrBufferData(body, fin, nullptr); |
114 } | 114 } |
115 | 115 |
116 return bytes_sent; | 116 return bytes_sent; |
117 } | 117 } |
118 | 118 |
119 void QuicSpdyClientStream::SendBody(const string& data, bool fin) { | 119 void QuicSpdyClientStream::SendBody(const string& data, bool fin) { |
120 SendBody(data, fin, nullptr); | 120 SendBody(data, fin, nullptr); |
121 } | 121 } |
122 | 122 |
123 void QuicSpdyClientStream::SendBody( | 123 void QuicSpdyClientStream::SendBody( |
124 const string& data, bool fin, | 124 const string& data, bool fin, |
125 QuicAckNotifier::DelegateInterface* delegate) { | 125 QuicAckNotifier::DelegateInterface* delegate) { |
126 WriteOrBufferData(data, fin, delegate); | 126 WriteOrBufferData(data, fin, delegate); |
127 } | 127 } |
128 | 128 |
129 } // namespace tools | 129 } // namespace tools |
130 } // namespace net | 130 } // namespace net |
OLD | NEW |