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 if (version() > QUIC_VERSION_12) { | 85 header_bytes_written_ = WriteHeaders(header_block, send_fin_with_headers); |
86 header_bytes_written_ = WriteHeaders(header_block, send_fin_with_headers); | 86 bytes_sent += header_bytes_written_; |
87 bytes_sent += header_bytes_written_; | |
88 } else { | |
89 string headers_string = | |
90 session()->compressor()->CompressHeadersWithPriority( | |
91 priority(), header_block); | |
92 WriteOrBufferData(headers_string, send_fin_with_headers); | |
93 bytes_sent += headers_string.length(); | |
94 } | |
95 | 87 |
96 if (!body.empty()) { | 88 if (!body.empty()) { |
97 WriteOrBufferData(body, fin); | 89 WriteOrBufferData(body, fin); |
98 } | 90 } |
99 | 91 |
100 return bytes_sent; | 92 return bytes_sent; |
101 } | 93 } |
102 | 94 |
103 int QuicSpdyClientStream::ParseResponseHeaders() { | 95 int QuicSpdyClientStream::ParseResponseHeaders() { |
104 size_t read_buf_len = static_cast<size_t>(read_buf_->offset()); | 96 size_t read_buf_len = static_cast<size_t>(read_buf_->offset()); |
(...skipping 20 matching lines...) Expand all Loading... |
125 return len; | 117 return len; |
126 } | 118 } |
127 | 119 |
128 // Sends body data to the server and returns the number of bytes sent. | 120 // Sends body data to the server and returns the number of bytes sent. |
129 void QuicSpdyClientStream::SendBody(const string& data, bool fin) { | 121 void QuicSpdyClientStream::SendBody(const string& data, bool fin) { |
130 WriteOrBufferData(data, fin); | 122 WriteOrBufferData(data, fin); |
131 } | 123 } |
132 | 124 |
133 } // namespace tools | 125 } // namespace tools |
134 } // namespace net | 126 } // namespace net |
OLD | NEW |