[Bug 1570686] [NEW] http client crashes when sending large chunk data via PUT method

Gary.Wang Gary.Wang at canonical.com
Fri Apr 15 03:30:22 UTC 2016


Public bug reported:

When sending large chuck of data via PUT method, http client crashes.
The requested buffer size doesn't match the one  internal buffer(accumulating data) allocated. 

Test case as following:

TEST(HttpClient, put_request_for_file_with_large_chunk_succeeds)
  {
      auto client = http::make_client();
      auto url = std::string(httpbin::host) + httpbin::resources::put();
  
      // create temp file with large chunk
      const std::size_t size = 1024*1024;
      std::ofstream ofs("tmp.dat", std::ios::binary | std::ios::out);
      ofs.seekp(size);
      ofs.write("", 1); 
      ofs.close();
  
      std::ifstream payload("tmp.dat");
      auto request = client->put(http::Request::Configuration::from_uri_as_string(url),
                                 payload,
                                 size);
  
      json::Value root;
      json::Reader reader;
  
      auto response = request->execute(default_progress_reporter);
  
      EXPECT_EQ(core::net::http::Status::ok, response.status);
      EXPECT_TRUE(reader.parse(response.body, root));
      EXPECT_EQ(url, root["url"].asString());
  }

......
[----------] 1 test from HttpClient
[ RUN      ] HttpClient.put_request_for_file_with_large_chunk_succeeds
Segmentation fault (core dumped)

** Affects: net-cpp
     Importance: Undecided
     Assignee: Gary.Wang (gary-wzl77)
         Status: New

** Changed in: net-cpp
     Assignee: (unassigned) => Gary.Wang (gary-wzl77)

-- 
You received this bug notification because you are a member of Ubuntu
Phablet Team, which is subscribed to net-cpp.
Matching subscriptions: net-cpp-bugs
https://bugs.launchpad.net/bugs/1570686

Title:
  http client crashes when sending large chunk data via PUT method

To manage notifications about this bug go to:
https://bugs.launchpad.net/net-cpp/+bug/1570686/+subscriptions



More information about the Ubuntu-reviews mailing list