Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(854)

Side by Side Diff: net/base/mime_util.h

Issue 1547593002: Introducing a net::GenerateMimeMultipartBoundary helper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing... Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef NET_BASE_MIME_UTIL_H__ 5 #ifndef NET_BASE_MIME_UTIL_H__
6 #define NET_BASE_MIME_UTIL_H__ 6 #define NET_BASE_MIME_UTIL_H__
7 7
8 // This file defines MIME utility functions. All of them assume the MIME type 8 // This file defines MIME utility functions. All of them assume the MIME type
9 // to be of the format specified by rfc2045. According to it, MIME types are 9 // to be of the format specified by rfc2045. According to it, MIME types are
10 // case strongly insensitive except parameter values, which may or may not be 10 // case strongly insensitive except parameter values, which may or may not be
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // 93 //
94 // A Java counterpart will be generated for this enum. 94 // A Java counterpart will be generated for this enum.
95 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.net 95 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.net
96 enum CertificateMimeType { 96 enum CertificateMimeType {
97 CERTIFICATE_MIME_TYPE_UNKNOWN, 97 CERTIFICATE_MIME_TYPE_UNKNOWN,
98 CERTIFICATE_MIME_TYPE_X509_USER_CERT, 98 CERTIFICATE_MIME_TYPE_X509_USER_CERT,
99 CERTIFICATE_MIME_TYPE_X509_CA_CERT, 99 CERTIFICATE_MIME_TYPE_X509_CA_CERT,
100 CERTIFICATE_MIME_TYPE_PKCS12_ARCHIVE, 100 CERTIFICATE_MIME_TYPE_PKCS12_ARCHIVE,
101 }; 101 };
102 102
103 // Generates a random MIME multipart boundary.
104 // The returned string is guaranteed to be at most 70 characters long.
105 NET_EXPORT std::string GenerateMimeMultipartBoundary();
106
103 // Prepares one value as part of a multi-part upload request. 107 // Prepares one value as part of a multi-part upload request.
104 NET_EXPORT void AddMultipartValueForUpload(const std::string& value_name, 108 NET_EXPORT void AddMultipartValueForUpload(const std::string& value_name,
105 const std::string& value, 109 const std::string& value,
106 const std::string& mime_boundary, 110 const std::string& mime_boundary,
107 const std::string& content_type, 111 const std::string& content_type,
108 std::string* post_data); 112 std::string* post_data);
109 113
110 // Adds the final delimiter to a multi-part upload request. 114 // Adds the final delimiter to a multi-part upload request.
111 NET_EXPORT void AddMultipartFinalDelimiterForUpload( 115 NET_EXPORT void AddMultipartFinalDelimiterForUpload(
112 const std::string& mime_boundary, 116 const std::string& mime_boundary,
113 std::string* post_data); 117 std::string* post_data);
114 118
115 struct MimeInfo { 119 struct MimeInfo {
116 const char* const mime_type; 120 const char* const mime_type;
117 const char* const extensions; // comma separated list 121 const char* const extensions; // comma separated list
118 }; 122 };
119 123
120 // Finds mime type of |ext| from |mappings|. 124 // Finds mime type of |ext| from |mappings|.
121 const char* FindMimeType(const MimeInfo* mappings, 125 const char* FindMimeType(const MimeInfo* mappings,
122 size_t mappings_len, 126 size_t mappings_len,
123 const std::string& ext); 127 const std::string& ext);
124 128
125 } // namespace net 129 } // namespace net
126 130
127 #endif // NET_BASE_MIME_UTIL_H__ 131 #endif // NET_BASE_MIME_UTIL_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698