| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "net/base/escape.h" | 5 #include "net/base/escape.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } | 60 } |
| 61 | 61 |
| 62 // Contains nonzero when the corresponding character is unescapable for normal | 62 // Contains nonzero when the corresponding character is unescapable for normal |
| 63 // URLs. These characters are the ones that may change the parsing of a URL, so | 63 // URLs. These characters are the ones that may change the parsing of a URL, so |
| 64 // we don't want to unescape them sometimes. In many case we won't want to | 64 // we don't want to unescape them sometimes. In many case we won't want to |
| 65 // unescape spaces, but that is controlled by parameters to Unescape*. | 65 // unescape spaces, but that is controlled by parameters to Unescape*. |
| 66 // | 66 // |
| 67 // The basic rule is that we can't unescape anything that would changing parsing | 67 // The basic rule is that we can't unescape anything that would changing parsing |
| 68 // like # or ?. We also can't unescape &, =, or + since that could be part of a | 68 // like # or ?. We also can't unescape &, =, or + since that could be part of a |
| 69 // query and that could change the server's parsing of the query. Nor can we | 69 // query and that could change the server's parsing of the query. Nor can we |
| 70 // unescape \ since googleurl will convert it to a /. | 70 // unescape \ since src/url/ will convert it to a /. |
| 71 // | 71 // |
| 72 // Lastly, we can't unescape anything that doesn't have a canonical | 72 // Lastly, we can't unescape anything that doesn't have a canonical |
| 73 // representation in a URL. This means that unescaping will change the URL, and | 73 // representation in a URL. This means that unescaping will change the URL, and |
| 74 // you could get different behavior if you copy and paste the URL, or press | 74 // you could get different behavior if you copy and paste the URL, or press |
| 75 // enter in the URL bar. The list of characters that fall into this category | 75 // enter in the URL bar. The list of characters that fall into this category |
| 76 // are the ones labeled PASS (allow either escaped or unescaped) in the big | 76 // are the ones labeled PASS (allow either escaped or unescaped) in the big |
| 77 // lookup table at the top of url/url_canon_path.cc. Also, characters | 77 // lookup table at the top of url/url_canon_path.cc. Also, characters |
| 78 // that have CHAR_QUERY set in url/url_canon_internal.cc but are not | 78 // that have CHAR_QUERY set in url/url_canon_internal.cc but are not |
| 79 // allowed in query strings according to http://www.ietf.org/rfc/rfc3261.txt are | 79 // allowed in query strings according to http://www.ietf.org/rfc/rfc3261.txt are |
| 80 // not unescaped, to avoid turning a valid url according to spec into an | 80 // not unescaped, to avoid turning a valid url according to spec into an |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 return; | 383 return; |
| 384 } | 384 } |
| 385 adjusted_offset -= 2; | 385 adjusted_offset -= 2; |
| 386 } | 386 } |
| 387 offset = adjusted_offset; | 387 offset = adjusted_offset; |
| 388 } | 388 } |
| 389 | 389 |
| 390 } // namespace internal | 390 } // namespace internal |
| 391 | 391 |
| 392 } // namespace net | 392 } // namespace net |
| OLD | NEW |