| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <iterator> | 6 #include <iterator> |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "net/base/mime_util.h" | 10 #include "net/base/mime_util.h" |
| (...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 } | 980 } |
| 981 return CERTIFICATE_MIME_TYPE_UNKNOWN; | 981 return CERTIFICATE_MIME_TYPE_UNKNOWN; |
| 982 } | 982 } |
| 983 | 983 |
| 984 bool IsSupportedCertificateMimeType(const std::string& mime_type) { | 984 bool IsSupportedCertificateMimeType(const std::string& mime_type) { |
| 985 CertificateMimeType file_type = | 985 CertificateMimeType file_type = |
| 986 GetCertificateMimeTypeForMimeType(mime_type); | 986 GetCertificateMimeTypeForMimeType(mime_type); |
| 987 return file_type != CERTIFICATE_MIME_TYPE_UNKNOWN; | 987 return file_type != CERTIFICATE_MIME_TYPE_UNKNOWN; |
| 988 } | 988 } |
| 989 | 989 |
| 990 void AddMultipartValueForUpload(const std::string& value_name, |
| 991 const std::string& value, |
| 992 const std::string& mime_boundary, |
| 993 const std::string& content_type, |
| 994 std::string* post_data) { |
| 995 DCHECK(post_data); |
| 996 // First line is the boundary. |
| 997 post_data->append("--" + mime_boundary + "\r\n"); |
| 998 // Next line is the Content-disposition. |
| 999 post_data->append("Content-Disposition: form-data; name=\"" + |
| 1000 value_name + "\"\r\n"); |
| 1001 if (!content_type.empty()) { |
| 1002 // If Content-type is specified, the next line is that. |
| 1003 post_data->append("Content-Type: " + content_type + "\r\n"); |
| 1004 } |
| 1005 // Leave an empty line and append the value. |
| 1006 post_data->append("\r\n" + value + "\r\n"); |
| 1007 } |
| 1008 |
| 1009 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary, |
| 1010 std::string* post_data) { |
| 1011 DCHECK(post_data); |
| 1012 post_data->append("--" + mime_boundary + "--\r\n"); |
| 1013 } |
| 1014 |
| 990 } // namespace net | 1015 } // namespace net |
| OLD | NEW |