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

Side by Side Diff: src/url_canon_stdurl.cc

Issue 564011: Remove the rule that "://" means a standard URL. This fixes a number of bugs... (Closed) Base URL: http://google-url.googlecode.com/svn/trunk/
Patch Set: '' Created 10 years, 10 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
« no previous file with comments | « src/gurl_unittest.cc ('k') | src/url_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007, Google Inc. 1 // Copyright 2007, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * 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 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 int spec_len, 163 int spec_len,
164 const url_parse::Parsed& parsed, 164 const url_parse::Parsed& parsed,
165 CharsetConverter* query_converter, 165 CharsetConverter* query_converter,
166 CanonOutput* output, 166 CanonOutput* output,
167 url_parse::Parsed* new_parsed) { 167 url_parse::Parsed* new_parsed) {
168 return DoCanonicalizeStandardURL<char16, char16>( 168 return DoCanonicalizeStandardURL<char16, char16>(
169 URLComponentSource<char16>(spec), parsed, query_converter, 169 URLComponentSource<char16>(spec), parsed, query_converter,
170 output, new_parsed); 170 output, new_parsed);
171 } 171 }
172 172
173 // It might be nice in the future to optimize this so unchanged components don't
174 // need to be recanonicalized. This is especially true since the common case for
175 // ReplaceComponents is removing things we don't want, like reference fragments
176 // and usernames. These cases can become more efficient if we can assume the
177 // rest of the URL is OK with these removed (or only the modified parts
178 // recanonicalized). This would be much more complex to implement, however.
179 //
180 // You would also need to update DoReplaceComponents in url_util.cc which
181 // relies on this re-checking everything (see the comment there for why).
173 bool ReplaceStandardURL(const char* base, 182 bool ReplaceStandardURL(const char* base,
174 const url_parse::Parsed& base_parsed, 183 const url_parse::Parsed& base_parsed,
175 const Replacements<char>& replacements, 184 const Replacements<char>& replacements,
176 CharsetConverter* query_converter, 185 CharsetConverter* query_converter,
177 CanonOutput* output, 186 CanonOutput* output,
178 url_parse::Parsed* new_parsed) { 187 url_parse::Parsed* new_parsed) {
179 URLComponentSource<char> source(base); 188 URLComponentSource<char> source(base);
180 url_parse::Parsed parsed(base_parsed); 189 url_parse::Parsed parsed(base_parsed);
181 SetupOverrideComponents(base, replacements, &source, &parsed); 190 SetupOverrideComponents(base, replacements, &source, &parsed);
182 return DoCanonicalizeStandardURL<char, unsigned char>( 191 return DoCanonicalizeStandardURL<char, unsigned char>(
(...skipping 10 matching lines...) Expand all
193 url_parse::Parsed* new_parsed) { 202 url_parse::Parsed* new_parsed) {
194 RawCanonOutput<1024> utf8; 203 RawCanonOutput<1024> utf8;
195 URLComponentSource<char> source(base); 204 URLComponentSource<char> source(base);
196 url_parse::Parsed parsed(base_parsed); 205 url_parse::Parsed parsed(base_parsed);
197 SetupUTF16OverrideComponents(base, replacements, &utf8, &source, &parsed); 206 SetupUTF16OverrideComponents(base, replacements, &utf8, &source, &parsed);
198 return DoCanonicalizeStandardURL<char, unsigned char>( 207 return DoCanonicalizeStandardURL<char, unsigned char>(
199 source, parsed, query_converter, output, new_parsed); 208 source, parsed, query_converter, output, new_parsed);
200 } 209 }
201 210
202 } // namespace url_canon 211 } // namespace url_canon
OLDNEW
« no previous file with comments | « src/gurl_unittest.cc ('k') | src/url_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698