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 // The basic usage of the Filter interface is described in the comment at | 5 // The basic usage of the Filter interface is described in the comment at |
6 // the beginning of filter.h. If Filter::Factory is passed a vector of | 6 // the beginning of filter.h. If Filter::Factory is passed a vector of |
7 // size greater than 1, that interface is implemented by a series of filters | 7 // size greater than 1, that interface is implemented by a series of filters |
8 // connected in a chain. In such a case the first filter | 8 // connected in a chain. In such a case the first filter |
9 // in the chain proxies calls to ReadData() so that its return values | 9 // in the chain proxies calls to ReadData() so that its return values |
10 // apply to the entire chain. | 10 // apply to the entire chain. |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 // no change in actual content). The last observed corruption it to actually | 260 // no change in actual content). The last observed corruption it to actually |
261 // change the content, such as by re-gzipping it, and that may happen along | 261 // change the content, such as by re-gzipping it, and that may happen along |
262 // with corruption of the stated content encoding (wow!). | 262 // with corruption of the stated content encoding (wow!). |
263 | 263 |
264 // The one unresolved failure mode comes when we advertise a dictionary, and | 264 // The one unresolved failure mode comes when we advertise a dictionary, and |
265 // the server tries to *send* a gzipped file (not gzip encode content), and | 265 // the server tries to *send* a gzipped file (not gzip encode content), and |
266 // then we could do a gzip decode :-(. Since SDCH is only (currently) | 266 // then we could do a gzip decode :-(. Since SDCH is only (currently) |
267 // supported server side on paths that only send HTML content, this mode has | 267 // supported server side on paths that only send HTML content, this mode has |
268 // never surfaced in the wild (and is unlikely to). | 268 // never surfaced in the wild (and is unlikely to). |
269 // We will gather a lot of stats as we perform the fixups | 269 // We will gather a lot of stats as we perform the fixups |
270 if (base::StartsWithASCII(mime_type, kTextHtml, false)) { | 270 if (base::StartsWith(mime_type, kTextHtml, |
| 271 base::CompareCase::INSENSITIVE_ASCII)) { |
271 // Suspicious case: Advertised dictionary, but server didn't use sdch, and | 272 // Suspicious case: Advertised dictionary, but server didn't use sdch, and |
272 // we're HTML tagged. | 273 // we're HTML tagged. |
273 if (encoding_types->empty()) { | 274 if (encoding_types->empty()) { |
274 LogSdchProblem(filter_context, SDCH_ADDED_CONTENT_ENCODING); | 275 LogSdchProblem(filter_context, SDCH_ADDED_CONTENT_ENCODING); |
275 } else if (1 == encoding_types->size()) { | 276 } else if (1 == encoding_types->size()) { |
276 LogSdchProblem(filter_context, SDCH_FIXED_CONTENT_ENCODING); | 277 LogSdchProblem(filter_context, SDCH_FIXED_CONTENT_ENCODING); |
277 } else { | 278 } else { |
278 LogSdchProblem(filter_context, SDCH_FIXED_CONTENT_ENCODINGS); | 279 LogSdchProblem(filter_context, SDCH_FIXED_CONTENT_ENCODINGS); |
279 } | 280 } |
280 } else { | 281 } else { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 | 405 |
405 void Filter::PushDataIntoNextFilter() { | 406 void Filter::PushDataIntoNextFilter() { |
406 IOBuffer* next_buffer = next_filter_->stream_buffer(); | 407 IOBuffer* next_buffer = next_filter_->stream_buffer(); |
407 int next_size = next_filter_->stream_buffer_size(); | 408 int next_size = next_filter_->stream_buffer_size(); |
408 last_status_ = ReadFilteredData(next_buffer->data(), &next_size); | 409 last_status_ = ReadFilteredData(next_buffer->data(), &next_size); |
409 if (FILTER_ERROR != last_status_) | 410 if (FILTER_ERROR != last_status_) |
410 next_filter_->FlushStreamBuffer(next_size); | 411 next_filter_->FlushStreamBuffer(next_size); |
411 } | 412 } |
412 | 413 |
413 } // namespace net | 414 } // namespace net |
OLD | NEW |