OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // URL filename encoder goals: | 5 // URL filename encoder goals: |
6 // | 6 // |
7 // 1. Allow URLs with arbitrary path-segment length, generating filenames | 7 // 1. Allow URLs with arbitrary path-segment length, generating filenames |
8 // with a maximum of 128 characters. | 8 // with a maximum of 128 characters. |
9 // 2. Provide a somewhat human readable filenames, for easy debugging flow. | 9 // 2. Provide a somewhat human readable filenames, for easy debugging flow. |
10 // 3. Provide reverse-mapping from filenames back to URLs. | 10 // 3. Provide reverse-mapping from filenames back to URLs. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // /, /,2C, | 72 // /, /,2C, |
73 // /,./ /,2C./, | 73 // /,./ /,2C./, |
74 // /very...longname/ /very...long,-/name If very...long is about 126 long. | 74 // /very...longname/ /very...long,-/name If very...long is about 126 long. |
75 | 75 |
76 // NOTE: we avoid using some classes here (like FilePath and GURL) because we | 76 // NOTE: we avoid using some classes here (like FilePath and GURL) because we |
77 // share this code with other projects externally. | 77 // share this code with other projects externally. |
78 | 78 |
79 #ifndef NET_TOOLS_FLIP_SERVER_URL_TO_FILENAME_ENCODER_H_ | 79 #ifndef NET_TOOLS_FLIP_SERVER_URL_TO_FILENAME_ENCODER_H_ |
80 #define NET_TOOLS_FLIP_SERVER_URL_TO_FILENAME_ENCODER_H_ | 80 #define NET_TOOLS_FLIP_SERVER_URL_TO_FILENAME_ENCODER_H_ |
81 | 81 |
| 82 #include <stddef.h> |
| 83 |
82 #include <string> | 84 #include <string> |
83 | 85 |
84 #include "base/strings/string_util.h" | 86 #include "base/strings/string_util.h" |
85 #include "net/tools/flip_server/url_utilities.h" | 87 #include "net/tools/flip_server/url_utilities.h" |
86 | 88 |
87 namespace net { | 89 namespace net { |
88 | 90 |
89 // Helper class for converting a URL into a filename. | 91 // Helper class for converting a URL into a filename. |
90 class UrlToFilenameEncoder { | 92 class UrlToFilenameEncoder { |
91 public: | 93 public: |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 static void StripDoubleSlashes(std::string* path) { | 205 static void StripDoubleSlashes(std::string* path) { |
204 const std::string doubleslash("\\\\"); | 206 const std::string doubleslash("\\\\"); |
205 const std::string escaped_doubleslash("%5C%5C"); | 207 const std::string escaped_doubleslash("%5C%5C"); |
206 ReplaceAll(path, doubleslash, escaped_doubleslash); | 208 ReplaceAll(path, doubleslash, escaped_doubleslash); |
207 } | 209 } |
208 }; | 210 }; |
209 | 211 |
210 } // namespace net | 212 } // namespace net |
211 | 213 |
212 #endif // NET_TOOLS_FLIP_SERVER_URL_TO_FILENAME_ENCODER_H_ | 214 #endif // NET_TOOLS_FLIP_SERVER_URL_TO_FILENAME_ENCODER_H_ |
OLD | NEW |