Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: net/base/mime_sniffer.cc

Issue 6804032: Add TLS-SRP (RFC 5054) support Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: use system srp and mpi libs, not local copies Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Detecting mime types is a tricky business because we need to balance 5 // Detecting mime types is a tricky business because we need to balance
6 // compatibility concerns with security issues. Here is a survey of how other 6 // compatibility concerns with security issues. Here is a survey of how other
7 // browsers behave and then a description of how we intend to behave. 7 // browsers behave and then a description of how we intend to behave.
8 // 8 //
9 // HTML payload, no Content-Type header: 9 // HTML payload, no Content-Type header:
10 // * IE 7: Render as HTML 10 // * IE 7: Render as HTML
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 return true; 556 return true;
557 } 557 }
558 558
559 bool ShouldSniffMimeType(const GURL& url, const std::string& mime_type) { 559 bool ShouldSniffMimeType(const GURL& url, const std::string& mime_type) {
560 static scoped_refptr<base::Histogram> should_sniff_counter = 560 static scoped_refptr<base::Histogram> should_sniff_counter =
561 UMASnifferHistogramGet("mime_sniffer.ShouldSniffMimeType2", 3); 561 UMASnifferHistogramGet("mime_sniffer.ShouldSniffMimeType2", 3);
562 // We are willing to sniff the mime type for HTTP, HTTPS, and FTP 562 // We are willing to sniff the mime type for HTTP, HTTPS, and FTP
563 bool sniffable_scheme = url.is_empty() || 563 bool sniffable_scheme = url.is_empty() ||
564 url.SchemeIs("http") || 564 url.SchemeIs("http") ||
565 url.SchemeIs("https") || 565 url.SchemeIs("https") ||
566 url.SchemeIs("httpsv") ||
566 url.SchemeIs("ftp") || 567 url.SchemeIs("ftp") ||
567 url.SchemeIsFile(); 568 url.SchemeIsFile();
568 if (!sniffable_scheme) { 569 if (!sniffable_scheme) {
569 should_sniff_counter->Add(1); 570 should_sniff_counter->Add(1);
570 return false; 571 return false;
571 } 572 }
572 573
573 static const char* kSniffableTypes[] = { 574 static const char* kSniffableTypes[] = {
574 // Many web servers are misconfigured to send text/plain for many 575 // Many web servers are misconfigured to send text/plain for many
575 // different types of content. 576 // different types of content.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 // Now we look in our large table of magic numbers to see if we can find 672 // Now we look in our large table of magic numbers to see if we can find
672 // anything that matches the content. 673 // anything that matches the content.
673 if (SniffForMagicNumbers(content, content_size, 674 if (SniffForMagicNumbers(content, content_size,
674 &have_enough_content, result)) 675 &have_enough_content, result))
675 return true; // We've matched a magic number. No more content needed. 676 return true; // We've matched a magic number. No more content needed.
676 677
677 return have_enough_content; 678 return have_enough_content;
678 } 679 }
679 680
680 } // namespace net 681 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698