| 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_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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 const BalsaHeaders& response_headers, | 125 const BalsaHeaders& response_headers, |
| 126 StringPiece body) { | 126 StringPiece body) { |
| 127 // We only support SPDY and HTTP, and neither handles bidirectional streaming. | 127 // We only support SPDY and HTTP, and neither handles bidirectional streaming. |
| 128 if (!read_side_closed()) { | 128 if (!read_side_closed()) { |
| 129 CloseReadSide(); | 129 CloseReadSide(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 SpdyHeaderBlock header_block = | 132 SpdyHeaderBlock header_block = |
| 133 SpdyUtils::ResponseHeadersToSpdyHeaders(response_headers); | 133 SpdyUtils::ResponseHeadersToSpdyHeaders(response_headers); |
| 134 | 134 |
| 135 if (version() > QUIC_VERSION_12) { | 135 WriteHeaders(header_block, body.empty()); |
| 136 WriteHeaders(header_block, body.empty()); | |
| 137 } else { | |
| 138 string headers_string = | |
| 139 session()->compressor()->CompressHeaders(header_block); | |
| 140 WriteOrBufferData(headers_string, body.empty()); | |
| 141 } | |
| 142 | 136 |
| 143 if (!body.empty()) { | 137 if (!body.empty()) { |
| 144 WriteOrBufferData(body, true); | 138 WriteOrBufferData(body, true); |
| 145 } | 139 } |
| 146 } | 140 } |
| 147 | 141 |
| 148 } // namespace tools | 142 } // namespace tools |
| 149 } // namespace net | 143 } // namespace net |
| OLD | NEW |