| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 body_.append(data + len, delta); | 85 body_.append(data + len, delta); |
| 86 } | 86 } |
| 87 | 87 |
| 88 request_headers_received_ = true; | 88 request_headers_received_ = true; |
| 89 } | 89 } |
| 90 | 90 |
| 91 void QuicSpdyServerStream::SendResponse() { | 91 void QuicSpdyServerStream::SendResponse() { |
| 92 // Find response in cache. If not found, send error response. | 92 // Find response in cache. If not found, send error response. |
| 93 const QuicInMemoryCache::Response* response = | 93 const QuicInMemoryCache::Response* response = |
| 94 QuicInMemoryCache::GetInstance()->GetResponse(headers_); | 94 QuicInMemoryCache::GetInstance()->GetResponse(headers_); |
| 95 if (response == NULL) { | 95 if (response == nullptr) { |
| 96 SendErrorResponse(); | 96 SendErrorResponse(); |
| 97 return; | 97 return; |
| 98 } | 98 } |
| 99 | 99 |
| 100 if (response->response_type() == QuicInMemoryCache::CLOSE_CONNECTION) { | 100 if (response->response_type() == QuicInMemoryCache::CLOSE_CONNECTION) { |
| 101 DVLOG(1) << "Special response: closing connection."; | 101 DVLOG(1) << "Special response: closing connection."; |
| 102 CloseConnection(QUIC_NO_ERROR); | 102 CloseConnection(QUIC_NO_ERROR); |
| 103 return; | 103 return; |
| 104 } | 104 } |
| 105 | 105 |
| (...skipping 19 matching lines...) Expand all 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 WriteHeaders(header_block, body.empty(), NULL); | 135 WriteHeaders(header_block, body.empty(), nullptr); |
| 136 | 136 |
| 137 if (!body.empty()) { | 137 if (!body.empty()) { |
| 138 WriteOrBufferData(body, true, NULL); | 138 WriteOrBufferData(body, true, nullptr); |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace tools | 142 } // namespace tools |
| 143 } // namespace net | 143 } // namespace net |
| OLD | NEW |