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 + and other special characters as %XX (hex). | 24 // Space is escaped as + (if use_plus is true) and other special characters |
25 NET_API std::string EscapeUrlEncodedData(const std::string& path); | 25 // as %XX (hex). |
| 26 NET_API std::string EscapeUrlEncodedData(const std::string& path, |
| 27 bool use_plus); |
26 | 28 |
27 // Escape all non-ASCII input. | 29 // Escape all non-ASCII input. |
28 NET_API std::string EscapeNonASCII(const std::string& input); | 30 NET_API std::string EscapeNonASCII(const std::string& input); |
29 | 31 |
30 // Escapes characters in text suitable for use as an external protocol handler | 32 // Escapes characters in text suitable for use as an external protocol handler |
31 // command. | 33 // command. |
32 // We %XX everything except alphanumerics and %-_.!~*'() and the restricted | 34 // We %XX everything except alphanumerics and %-_.!~*'() and the restricted |
33 // chracters (;/?:@&=+$,). | 35 // chracters (;/?:@&=+$,). |
34 NET_API std::string EscapeExternalHandlerValue(const std::string& text); | 36 NET_API std::string EscapeExternalHandlerValue(const std::string& text); |
35 | 37 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 struct NET_TEST AdjustEncodingOffset { | 146 struct NET_TEST AdjustEncodingOffset { |
145 typedef std::vector<size_t> Adjustments; | 147 typedef std::vector<size_t> Adjustments; |
146 | 148 |
147 explicit AdjustEncodingOffset(const Adjustments& adjustments); | 149 explicit AdjustEncodingOffset(const Adjustments& adjustments); |
148 void operator()(size_t& offset); | 150 void operator()(size_t& offset); |
149 | 151 |
150 const Adjustments& adjustments; | 152 const Adjustments& adjustments; |
151 }; | 153 }; |
152 | 154 |
153 #endif // NET_BASE_ESCAPE_H_ | 155 #endif // NET_BASE_ESCAPE_H_ |
OLD | NEW |