OLD | NEW |
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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 if (url_parse::DoesBeginUNCPath(spec, 0, spec_len, false) || | 171 if (url_parse::DoesBeginUNCPath(spec, 0, spec_len, false) || |
172 url_parse::DoesBeginWindowsDriveSpec(spec, 0, spec_len)) { | 172 url_parse::DoesBeginWindowsDriveSpec(spec, 0, spec_len)) { |
173 url_parse::ParseFileURL(spec, spec_len, &parsed_input); | 173 url_parse::ParseFileURL(spec, spec_len, &parsed_input); |
174 return url_canon::CanonicalizeFileURL(spec, spec_len, parsed_input, | 174 return url_canon::CanonicalizeFileURL(spec, spec_len, parsed_input, |
175 charset_converter, | 175 charset_converter, |
176 output, output_parsed); | 176 output, output_parsed); |
177 } | 177 } |
178 #endif | 178 #endif |
179 | 179 |
180 url_parse::Component scheme; | 180 url_parse::Component scheme; |
181 if (!url_parse::ExtractScheme(spec, spec_len, &scheme)) | 181 if (!url_parse::ExtractScheme(spec, spec_len, &scheme)) { |
| 182 AppendInvalidNarrowString(spec, 0, spec_len, output); |
182 return false; | 183 return false; |
| 184 } |
183 | 185 |
184 // This is the parsed version of the input URL, we have to canonicalize it | 186 // This is the parsed version of the input URL, we have to canonicalize it |
185 // before storing it in our object. | 187 // before storing it in our object. |
186 bool success; | 188 bool success; |
187 if (DoCompareSchemeComponent(spec, scheme, kFileScheme)) { | 189 if (DoCompareSchemeComponent(spec, scheme, kFileScheme)) { |
188 // File URLs are special. | 190 // File URLs are special. |
189 url_parse::ParseFileURL(spec, spec_len, &parsed_input); | 191 url_parse::ParseFileURL(spec, spec_len, &parsed_input); |
190 success = url_canon::CanonicalizeFileURL(spec, spec_len, parsed_input, | 192 success = url_canon::CanonicalizeFileURL(spec, spec_len, parsed_input, |
191 charset_converter, output, | 193 charset_converter, output, |
192 output_parsed); | 194 output_parsed); |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 return DoCompareSchemeComponent(spec, component, compare_to); | 584 return DoCompareSchemeComponent(spec, component, compare_to); |
583 } | 585 } |
584 | 586 |
585 bool CompareSchemeComponent(const char16* spec, | 587 bool CompareSchemeComponent(const char16* spec, |
586 const url_parse::Component& component, | 588 const url_parse::Component& component, |
587 const char* compare_to) { | 589 const char* compare_to) { |
588 return DoCompareSchemeComponent(spec, component, compare_to); | 590 return DoCompareSchemeComponent(spec, component, compare_to); |
589 } | 591 } |
590 | 592 |
591 } // namespace url_util | 593 } // namespace url_util |
OLD | NEW |