Commit 15dc854e by mtdxc Committed by GitHub

修复http multi form上传文件名相关bug(#2293)

parent 44dde7a9
...@@ -289,11 +289,7 @@ Buffer::Ptr HttpMultiFormBody::readData(size_t size) { ...@@ -289,11 +289,7 @@ Buffer::Ptr HttpMultiFormBody::readData(size_t size) {
} }
string HttpMultiFormBody::multiFormBodySuffix(const string &boundary) { string HttpMultiFormBody::multiFormBodySuffix(const string &boundary) {
string MPboundary = string("--") + boundary; return "\r\n--" + boundary + "--";
string endMPboundary = MPboundary + "--";
_StrPrinter body;
body << "\r\n" << endMPboundary;
return std::move(body);
} }
string HttpMultiFormBody::multiFormContentType(const string &boundary) { string HttpMultiFormBody::multiFormContentType(const string &boundary) {
...@@ -311,7 +307,7 @@ string HttpMultiFormBody::multiFormBodyPrefix(const HttpArgs &args, const string ...@@ -311,7 +307,7 @@ string HttpMultiFormBody::multiFormBodyPrefix(const HttpArgs &args, const string
body << MPboundary << "\r\n"; body << MPboundary << "\r\n";
body << "Content-Disposition: form-data; name=\"" body << "Content-Disposition: form-data; name=\""
<< "file" << "file"
<< "\";filename=\"" << fileName << "\"\r\n"; << "\"; filename=\"" << fileName << "\"\r\n";
body << "Content-Type: application/octet-stream\r\n\r\n"; body << "Content-Type: application/octet-stream\r\n\r\n";
return std::move(body); return std::move(body);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论