http client crashes when sending large chunk data via PUT method
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canonical System Image |
Fix Committed
|
High
|
Unassigned | ||
net-cpp |
In Progress
|
High
|
Gary.Wang |
Bug Description
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_
{
auto client = http::make_
auto url = std::string(
// 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.
ofs.write("", 1);
ofs.close();
std::ifstream payload("tmp.dat");
auto request = client-
json::Value root;
json::Reader reader;
auto response = request-
EXPECT_
EXPECT_
EXPECT_
}
......
[----------] 1 test from HttpClient
[ RUN ] HttpClient.
Segmentation fault (core dumped)
Related branches
- Thomas Voß (community): Approve
-
Diff: 804 lines (+407/-9)14 files modifiedCMakeLists.txt (+2/-2)
include/core/net/http/client.h (+19/-0)
include/core/net/http/method.h (+3/-1)
include/core/net/http/request.h (+21/-0)
include/core/net/http/streaming_client.h (+21/-1)
include/core/net/http/streaming_request.h (+13/-0)
src/core/net/http/impl/curl/client.cpp (+82/-2)
src/core/net/http/impl/curl/client.h (+7/-0)
src/core/net/http/impl/curl/easy.cpp (+23/-0)
src/core/net/http/impl/curl/easy.h (+14/-1)
src/core/net/http/impl/curl/request.h (+33/-0)
tests/http_client_test.cpp (+73/-0)
tests/http_streaming_client_test.cpp (+90/-2)
tests/httpbin.h.in (+6/-0)
- Gary.Wang (community): Approve
- Ubuntu Phablet Team: Pending requested
-
Diff: 431 lines (+163/-59)11 files modifieddebian/changelog (+8/-0)
debian/control (+2/-2)
debian/libnet-cpp2.symbols (+1/-1)
include/core/net/http/request.h (+9/-9)
include/core/net/http/streaming_request.h (+0/-12)
src/core/net/http/impl/curl/client.cpp (+17/-0)
src/core/net/http/impl/curl/easy.cpp (+1/-1)
src/core/net/http/impl/curl/multi.cpp (+5/-0)
src/core/net/http/impl/curl/multi.h (+3/-0)
src/core/net/http/impl/curl/request.h (+23/-27)
tests/http_streaming_client_test.cpp (+94/-7)
Changed in net-cpp: | |
assignee: | nobody → Gary.Wang (gary-wzl77) |
Changed in net-cpp: | |
status: | New → In Progress |
Changed in net-cpp: | |
importance: | Undecided → High |
Changed in canonical-devices-system-image: | |
milestone: | none → 14 |
importance: | Undecided → High |
status: | New → Confirmed |
status: | Confirmed → In Progress |
Changed in canonical-devices-system-image: | |
status: | In Progress → Fix Committed |
Changed in canonical-devices-system-image: | |
milestone: | 14 → backlog |