OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/quic/quic_spdy_server_stream.h" | 5 #include "net/quic/quic_spdy_server_stream.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "net/quic/quic_in_memory_cache.h" | 9 #include "net/quic/quic_in_memory_cache.h" |
10 #include "net/quic/quic_session.h" | 10 #include "net/quic/quic_session.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 body_.append(data + len, delta); | 105 body_.append(data + len, delta); |
106 } | 106 } |
107 | 107 |
108 request_headers_received_ = true; | 108 request_headers_received_ = true; |
109 } | 109 } |
110 | 110 |
111 void QuicSpdyServerStream::SendResponse() { | 111 void QuicSpdyServerStream::SendResponse() { |
112 // Find response in cache. If not found, send error response. | 112 // Find response in cache. If not found, send error response. |
113 const QuicInMemoryCache::Response* response = | 113 const QuicInMemoryCache::Response* response = |
114 QuicInMemoryCache::GetInstance()->GetResponse(request_url_); | 114 QuicInMemoryCache::GetInstance()->GetResponse(request_url_); |
115 if (response == NULL) { | 115 if (response == nullptr) { |
116 SendErrorResponse(); | 116 SendErrorResponse(); |
117 return; | 117 return; |
118 } | 118 } |
119 | 119 |
120 if (response->response_type() == QuicInMemoryCache::CLOSE_CONNECTION) { | 120 if (response->response_type() == QuicInMemoryCache::CLOSE_CONNECTION) { |
121 DVLOG(1) << "Special response: closing connection."; | 121 DVLOG(1) << "Special response: closing connection."; |
122 CloseConnection(QUIC_NO_ERROR); | 122 CloseConnection(QUIC_NO_ERROR); |
123 return; | 123 return; |
124 } | 124 } |
125 | 125 |
(...skipping 20 matching lines...) Expand all Loading... |
146 // We only support SPDY and HTTP, and neither handles bidirectional streaming. | 146 // We only support SPDY and HTTP, and neither handles bidirectional streaming. |
147 if (!read_side_closed()) { | 147 if (!read_side_closed()) { |
148 CloseReadSide(); | 148 CloseReadSide(); |
149 } | 149 } |
150 | 150 |
151 SpdyHeaderBlock header_block; | 151 SpdyHeaderBlock header_block; |
152 CreateSpdyHeadersFromHttpResponse(response_headers, | 152 CreateSpdyHeadersFromHttpResponse(response_headers, |
153 kDefaultSpdyMajorVersion, | 153 kDefaultSpdyMajorVersion, |
154 &header_block); | 154 &header_block); |
155 | 155 |
156 WriteHeaders(header_block, body.empty(), NULL); | 156 WriteHeaders(header_block, body.empty(), nullptr); |
157 | 157 |
158 if (!body.empty()) { | 158 if (!body.empty()) { |
159 WriteOrBufferData(body, true, NULL); | 159 WriteOrBufferData(body, true, nullptr); |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 } // namespace net | 163 } // namespace net |
OLD | NEW |