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

Side by Side Diff: third_party/WebKit/Source/platform/weborigin/KnownPorts.cpp

Issue 2447293002: Don't call lower() on KURL protocol/host (Closed)
Patch Set: dont call protocol() / host() twice in SecurityOrigin constructor Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2007, 2008, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2007, 2008, 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. 3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 return 990; 62 return 990;
63 63
64 return 0; 64 return 0;
65 } 65 }
66 66
67 bool isPortAllowedForScheme(const KURL& url) { 67 bool isPortAllowedForScheme(const KURL& url) {
68 // Returns true for URLs without a port specified. This is needed to let 68 // Returns true for URLs without a port specified. This is needed to let
69 // through non-network schemes that don't go over the network. 69 // through non-network schemes that don't go over the network.
70 if (!url.hasPort()) 70 if (!url.hasPort())
71 return true; 71 return true;
72 String protocol = url.protocol().isNull() ? "" : url.protocol().lower(); 72 String protocol = url.protocol().isNull() ? "" : url.protocol();
73 unsigned short effectivePort = url.port(); 73 unsigned short effectivePort = url.port();
74 if (!effectivePort) 74 if (!effectivePort)
75 effectivePort = defaultPortForProtocol(protocol); 75 effectivePort = defaultPortForProtocol(protocol);
76 StringUTF8Adaptor utf8(protocol); 76 StringUTF8Adaptor utf8(protocol);
77 return net::IsPortAllowedForScheme(effectivePort, 77 return net::IsPortAllowedForScheme(effectivePort,
78 std::string(utf8.data(), utf8.length())); 78 std::string(utf8.data(), utf8.length()));
79 } 79 }
80 80
81 } // namespace blink 81 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698