mirror of
https://github.com/yhirose/cpp-httplib
synced 2024-11-21 14:29:10 -07:00
Fix #47
This commit is contained in:
parent
5536d4c1ff
commit
0e239a0014
2 changed files with 4 additions and 3 deletions
|
@ -1026,10 +1026,11 @@ inline bool parse_multipart_formdata(
|
|||
static std::string crlf = "\r\n";
|
||||
|
||||
static std::regex re_content_type(
|
||||
"Content-Type: (.*?)");
|
||||
"Content-Type: (.*?)", std::regex_constants::icase);
|
||||
|
||||
static std::regex re_content_disposition(
|
||||
"Content-Disposition: form-data; name=\"(.*?)\"(?:; filename=\"(.*?)\")?");
|
||||
"Content-Disposition: form-data; name=\"(.*?)\"(?:; filename=\"(.*?)\")?",
|
||||
std::regex_constants::icase);
|
||||
|
||||
auto dash_boundary = dash + boundary;
|
||||
|
||||
|
|
|
@ -614,7 +614,7 @@ TEST_F(ServerTest, MultipartFormData)
|
|||
req.headers.emplace("User-Agent", "cpp-httplib/0.1");
|
||||
req.headers.emplace("Content-Type", "multipart/form-data; boundary=----WebKitFormBoundarysBREP3G013oUrLB4");
|
||||
|
||||
req.body = "------WebKitFormBoundarysBREP3G013oUrLB4\r\nContent-Disposition: form-data; name=\"text1\"\r\n\r\ntext default\r\n------WebKitFormBoundarysBREP3G013oUrLB4\r\nContent-Disposition: form-data; name=\"text2\"\r\n\r\naωb\r\n------WebKitFormBoundarysBREP3G013oUrLB4\r\nContent-Disposition: form-data; name=\"file1\"; filename=\"hello.txt\"\r\nContent-Type: text/plain\r\n\r\nh\ne\n\nl\nl\no\n\r\n------WebKitFormBoundarysBREP3G013oUrLB4\r\nContent-Disposition: form-data; name=\"file2\"; filename=\"world.json\"\r\nContent-Type: application/json\r\n\r\n{\n \"world\", true\n}\n\r\n------WebKitFormBoundarysBREP3G013oUrLB4\r\nContent-Disposition: form-data; name=\"file3\"; filename=\"\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n------WebKitFormBoundarysBREP3G013oUrLB4--\r\n";
|
||||
req.body = "------WebKitFormBoundarysBREP3G013oUrLB4\r\nContent-Disposition: form-data; name=\"text1\"\r\n\r\ntext default\r\n------WebKitFormBoundarysBREP3G013oUrLB4\r\nContent-Disposition: form-data; name=\"text2\"\r\n\r\naωb\r\n------WebKitFormBoundarysBREP3G013oUrLB4\r\nContent-Disposition: form-data; name=\"file1\"; filename=\"hello.txt\"\r\nContent-Type: text/plain\r\n\r\nh\ne\n\nl\nl\no\n\r\n------WebKitFormBoundarysBREP3G013oUrLB4\r\nContent-Disposition: form-data; name=\"file2\"; filename=\"world.json\"\r\nContent-Type: application/json\r\n\r\n{\n \"world\", true\n}\n\r\n------WebKitFormBoundarysBREP3G013oUrLB4\r\ncontent-disposition: form-data; name=\"file3\"; filename=\"\"\r\ncontent-type: application/octet-stream\r\n\r\n\r\n------WebKitFormBoundarysBREP3G013oUrLB4--\r\n";
|
||||
|
||||
auto res = std::make_shared<Response>();
|
||||
auto ret = cli_.send(req, *res);
|
||||
|
|
Loading…
Reference in a new issue