| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef NET_BASE_ESCAPE_H_ | 5 #ifndef NET_BASE_ESCAPE_H_ |
| 6 #define NET_BASE_ESCAPE_H_ | 6 #define NET_BASE_ESCAPE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 #include "net/base/net_api.h" | 14 #include "net/base/net_api.h" |
| 15 | 15 |
| 16 // Escaping -------------------------------------------------------------------- | 16 // Escaping -------------------------------------------------------------------- |
| 17 | 17 |
| 18 // Escape a file. This includes: | 18 // Escape a file. This includes: |
| 19 // non-printable, non-7bit, and (including space) "#%:<>?[\]^`{|} | 19 // non-printable, non-7bit, and (including space) "#%:<>?[\]^`{|} |
| 20 NET_API std::string EscapePath(const std::string& path); | 20 NET_API std::string EscapePath(const std::string& path); |
| 21 | 21 |
| 22 // Escape application/x-www-form-urlencoded content. This includes: | 22 // Escape application/x-www-form-urlencoded content. This includes: |
| 23 // non-printable, non-7bit, and (including space) ?>=<;+'&%$#"![\]^`{|} | 23 // non-printable, non-7bit, and (including space) ?>=<;+'&%$#"![\]^`{|} |
| 24 // Space is escaped as + (if use_plus is true) and other special characters | 24 // Space is escaped as + and other special characters as %XX (hex). |
| 25 // as %XX (hex). | 25 NET_API std::string EscapeUrlEncodedData(const std::string& path); |
| 26 NET_API std::string EscapeUrlEncodedData(const std::string& path, | |
| 27 bool use_plus); | |
| 28 | 26 |
| 29 // Escape all non-ASCII input. | 27 // Escape all non-ASCII input. |
| 30 NET_API std::string EscapeNonASCII(const std::string& input); | 28 NET_API std::string EscapeNonASCII(const std::string& input); |
| 31 | 29 |
| 32 // Escapes characters in text suitable for use as an external protocol handler | 30 // Escapes characters in text suitable for use as an external protocol handler |
| 33 // command. | 31 // command. |
| 34 // We %XX everything except alphanumerics and %-_.!~*'() and the restricted | 32 // We %XX everything except alphanumerics and %-_.!~*'() and the restricted |
| 35 // chracters (;/?:@&=+$,). | 33 // chracters (;/?:@&=+$,). |
| 36 NET_API std::string EscapeExternalHandlerValue(const std::string& text); | 34 NET_API std::string EscapeExternalHandlerValue(const std::string& text); |
| 37 | 35 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 struct NET_TEST AdjustEncodingOffset { | 144 struct NET_TEST AdjustEncodingOffset { |
| 147 typedef std::vector<size_t> Adjustments; | 145 typedef std::vector<size_t> Adjustments; |
| 148 | 146 |
| 149 explicit AdjustEncodingOffset(const Adjustments& adjustments); | 147 explicit AdjustEncodingOffset(const Adjustments& adjustments); |
| 150 void operator()(size_t& offset); | 148 void operator()(size_t& offset); |
| 151 | 149 |
| 152 const Adjustments& adjustments; | 150 const Adjustments& adjustments; |
| 153 }; | 151 }; |
| 154 | 152 |
| 155 #endif // NET_BASE_ESCAPE_H_ | 153 #endif // NET_BASE_ESCAPE_H_ |
| OLD | NEW |