Include Content-Transfer-Encoding in uploads.

We should specify it's binary, otherwise proxies might munge the data.
This commit is contained in:
Unknown W. Brackets 2016-06-12 09:07:04 -07:00
parent da0a79f695
commit 347158ecc6

View File

@ -4,6 +4,7 @@
#include <string.h>
#include <stdio.h>
#include <cstdarg>
#include <vector>
#include "base/basictypes.h"
@ -145,12 +146,18 @@ struct MultipartFormDataEncoder : UrlEncoder
char temp[64];
snprintf(temp, sizeof(temp), "Content-Length: %d\r\n", (int)value.size());
data += temp;
data += "Content-Transfer-Encoding: binary\r\n";
data += "\r\n";
data += value;
data += "\r\n";
}
void Add(const std::string &key, const std::vector<uint8_t> &value, const std::string &filename, const std::string &mimeType)
{
Add(key, std::string((const char *)&value[0], value.size()), filename, mimeType);
}
virtual void Finish()
{
data += "--" + boundary + "--";