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 "net/spdy/spdy_framer.h" | 7 #include "net/spdy/spdy_framer.h" |
8 #include "net/tools/quic/quic_client_session.h" | 8 #include "net/tools/quic/quic_client_session.h" |
9 #include "net/tools/quic/spdy_utils.h" | 9 #include "net/tools/quic/spdy_utils.h" |
10 | 10 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } | 75 } |
76 | 76 |
77 ssize_t QuicSpdyClientStream::SendRequest(const BalsaHeaders& headers, | 77 ssize_t QuicSpdyClientStream::SendRequest(const BalsaHeaders& headers, |
78 StringPiece body, | 78 StringPiece body, |
79 bool fin) { | 79 bool fin) { |
80 SpdyHeaderBlock header_block = | 80 SpdyHeaderBlock header_block = |
81 SpdyUtils::RequestHeadersToSpdyHeaders(headers); | 81 SpdyUtils::RequestHeadersToSpdyHeaders(headers); |
82 | 82 |
83 bool send_fin_with_headers = fin && body.empty(); | 83 bool send_fin_with_headers = fin && body.empty(); |
84 size_t bytes_sent = body.size(); | 84 size_t bytes_sent = body.size(); |
85 header_bytes_written_ = WriteHeaders( | 85 header_bytes_written_ = |
86 header_block, send_fin_with_headers, NULL); | 86 WriteHeaders(header_block, send_fin_with_headers, nullptr); |
87 bytes_sent += header_bytes_written_; | 87 bytes_sent += header_bytes_written_; |
88 | 88 |
89 if (!body.empty()) { | 89 if (!body.empty()) { |
90 WriteOrBufferData(body, fin, NULL); | 90 WriteOrBufferData(body, fin, nullptr); |
91 } | 91 } |
92 | 92 |
93 return bytes_sent; | 93 return bytes_sent; |
94 } | 94 } |
95 | 95 |
96 int QuicSpdyClientStream::ParseResponseHeaders() { | 96 int QuicSpdyClientStream::ParseResponseHeaders() { |
97 size_t read_buf_len = static_cast<size_t>(read_buf_->offset()); | 97 size_t read_buf_len = static_cast<size_t>(read_buf_->offset()); |
98 SpdyFramer framer(SPDY3); | 98 SpdyFramer framer(SPDY3); |
99 SpdyHeaderBlock headers; | 99 SpdyHeaderBlock headers; |
100 char* data = read_buf_->StartOfBuffer(); | 100 char* data = read_buf_->StartOfBuffer(); |
(...skipping 12 matching lines...) Expand all Loading... |
113 size_t delta = read_buf_len - len; | 113 size_t delta = read_buf_len - len; |
114 if (delta > 0) { | 114 if (delta > 0) { |
115 data_.append(data + len, delta); | 115 data_.append(data + len, delta); |
116 } | 116 } |
117 | 117 |
118 return len; | 118 return len; |
119 } | 119 } |
120 | 120 |
121 // Sends body data to the server and returns the number of bytes sent. | 121 // Sends body data to the server and returns the number of bytes sent. |
122 void QuicSpdyClientStream::SendBody(const string& data, bool fin) { | 122 void QuicSpdyClientStream::SendBody(const string& data, bool fin) { |
123 WriteOrBufferData(data, fin, NULL); | 123 WriteOrBufferData(data, fin, nullptr); |
124 } | 124 } |
125 | 125 |
126 } // namespace tools | 126 } // namespace tools |
127 } // namespace net | 127 } // namespace net |
OLD | NEW |