Browse Source

Fixed build errors

yhirose 6 years ago
parent
commit
b9539b8921
2 changed files with 3 additions and 6 deletions
  1. 1 4
      example/simplesvr.cc
  2. 2 2
      example/upload.cc

+ 1 - 4
example/simplesvr.cc

@@ -46,10 +46,7 @@ string dump_multipart_files(const MultipartFiles &files) {
     snprintf(buf, sizeof(buf), "content type: %s\n", file.content_type.c_str());
     snprintf(buf, sizeof(buf), "content type: %s\n", file.content_type.c_str());
     s += buf;
     s += buf;
 
 
-    snprintf(buf, sizeof(buf), "text offset: %lu\n", file.offset);
-    s += buf;
-
-    snprintf(buf, sizeof(buf), "text length: %lu\n", file.length);
+    snprintf(buf, sizeof(buf), "text length: %lu\n", file.content.size());
     s += buf;
     s += buf;
 
 
     s += "----------------\n";
     s += "----------------\n";

+ 2 - 2
example/upload.cc

@@ -37,10 +37,10 @@ int main(void) {
 
 
   svr.Post("/post", [](const Request & req, Response &res) {
   svr.Post("/post", [](const Request & req, Response &res) {
     auto file = req.get_file_value("file");
     auto file = req.get_file_value("file");
-    cout << "file: " << file.offset << ":" << file.length << ":" << file.filename << endl;
+    cout << "file length: " << file.content.length() << ":" << file.filename << endl;
 
 
     ofstream ofs(file.filename, ios::binary);
     ofstream ofs(file.filename, ios::binary);
-    ofs << req.body.substr(file.offset, file.length);
+    ofs << file.content;
 
 
     res.set_content("done", "text/plain");
     res.set_content("done", "text/plain");
   });
   });