Crashpad
|
This class is used to build a MIME multipart message, conforming to RFC 2046, for use as a HTTP request body. More...
#include "util/net/http_multipart_builder.h"
Public Member Functions | |
void | SetGzipEnabled (bool gzip_enabled) |
Enables or disables gzip compression. More... | |
void | SetFormData (const std::string &key, const std::string &value) |
Sets a Content-Disposition: form-data key-value pair. More... | |
void | SetFileAttachment (const std::string &key, const std::string &upload_file_name, FileReaderInterface *reader, const std::string &content_type) |
Specifies the contents read from reader to be uploaded as multipart data, available at name of upload_file_name. More... | |
std::unique_ptr< HTTPBodyStream > | GetBodyStream () |
Generates the HTTPBodyStream for the data currently supplied to the builder. More... | |
void | PopulateContentHeaders (HTTPHeaders *http_headers) const |
Adds the appropriate content headers to http_headers. More... | |
This class is used to build a MIME multipart message, conforming to RFC 2046, for use as a HTTP request body.
std::unique_ptr< HTTPBodyStream > crashpad::HTTPMultipartBuilder::GetBodyStream | ( | ) |
Generates the HTTPBodyStream for the data currently supplied to the builder.
void crashpad::HTTPMultipartBuilder::PopulateContentHeaders | ( | HTTPHeaders * | http_headers | ) | const |
Adds the appropriate content headers to http_headers.
Any headers that this method adds will replace existing headers by the same name in http_headers.
void crashpad::HTTPMultipartBuilder::SetFileAttachment | ( | const std::string & | key, |
const std::string & | upload_file_name, | ||
FileReaderInterface * | reader, | ||
const std::string & | content_type | ||
) |
Specifies the contents read from reader to be uploaded as multipart data, available at name
of upload_file_name.
[in] | key | The key of the form data, specified as the name in the multipart message. Any data previously set on this class with this key will be overwritten. |
[in] | upload_file_name | The filename to specify for this multipart data attachment. |
[in] | reader | A FileReaderInterface from which to read the content to upload. |
[in] | content_type | The Content-Type to specify for the attachment. If this is empty, "application/octet-stream" will be used. |
void crashpad::HTTPMultipartBuilder::SetFormData | ( | const std::string & | key, |
const std::string & | value | ||
) |
Sets a Content-Disposition: form-data
key-value pair.
[in] | key | The key of the form data, specified as the name in the multipart message. Any data previously set on this class with this key will be overwritten. |
[in] | value | The value to set at the key. |
void crashpad::HTTPMultipartBuilder::SetGzipEnabled | ( | bool | gzip_enabled | ) |
Enables or disables gzip
compression.
[in] | gzip_enabled | Whether to enable or disable gzip compression. |
When gzip
compression is enabled, the body stream returned by GetBodyStream() will be gzip
-compressed, and the content headers set by PopulateContentHeaders() will contain Content-Encoding: gzip
.