| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 reinterpret_cast<unsigned char*>(&source))) { | 151 reinterpret_cast<unsigned char*>(&source))) { |
| 152 // Invalid escaped character. There is nothing that can make this | 152 // Invalid escaped character. There is nothing that can make this |
| 153 // host valid. We append an escaped percent so the URL looks reasonable | 153 // host valid. We append an escaped percent so the URL looks reasonable |
| 154 // and mark as failed. | 154 // and mark as failed. |
| 155 AppendEscapedChar('%', output); | 155 AppendEscapedChar('%', output); |
| 156 success = false; | 156 success = false; |
| 157 continue; | 157 continue; |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 | 160 |
| 161 if (source <= 0x80) { | 161 if (source < 0x80) { |
| 162 // We have ASCII input, we can use our lookup table. | 162 // We have ASCII input, we can use our lookup table. |
| 163 unsigned char replacement = kHostCharLookup[source]; | 163 unsigned char replacement = kHostCharLookup[source]; |
| 164 if (!replacement) { | 164 if (!replacement) { |
| 165 // Invalid character, add it as percent-escaped and mark as failed. | 165 // Invalid character, add it as percent-escaped and mark as failed. |
| 166 AppendEscapedChar(source, output); | 166 AppendEscapedChar(source, output); |
| 167 success = false; | 167 success = false; |
| 168 } else if (replacement == kEsc) { | 168 } else if (replacement == kEsc) { |
| 169 // This character is valid but should be escaped. | 169 // This character is valid but should be escaped. |
| 170 AppendEscapedChar(source, output); | 170 AppendEscapedChar(source, output); |
| 171 } else { | 171 } else { |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 } | 392 } |
| 393 | 393 |
| 394 void CanonicalizeHostVerbose(const char16* spec, | 394 void CanonicalizeHostVerbose(const char16* spec, |
| 395 const url_parse::Component& host, | 395 const url_parse::Component& host, |
| 396 CanonOutput* output, | 396 CanonOutput* output, |
| 397 CanonHostInfo *host_info) { | 397 CanonHostInfo *host_info) { |
| 398 DoHost<char16, char16>(spec, host, output, host_info); | 398 DoHost<char16, char16>(spec, host, output, host_info); |
| 399 } | 399 } |
| 400 | 400 |
| 401 } // namespace url_canon | 401 } // namespace url_canon |
| OLD | NEW |