Closed ZhangTaiwen closed 2 years ago
client code:
http_client client(U("http://192.168.17.70:8080"));
json::value Request;
Request = json::value("test12345678");
method mtd = methods::PUT;//methods::POST;
http_request msg(mtd);
msg.set_body(Request);
http::http_response response;
try
{
printf("sent request\n");
response = client.request(msg).get();
}
catch (std::exception& ex)
{
printf("exception\n");
return -1;
}
printf("get response\n");
http::status_code ret = response.status_code();
server code:
void HttpHandler(http_request request) { json::value jReqData; json::value jRespData;
try
{
jReqData = request.extract_json().get();// hung htere on linux if request send by windows client
request.reply(status_codes::OK).wait();
not an issue, problem solved
build the http client with windows execute program, and run rest server on linux (centos 8) when client send a request with json value in the http body, the rest server will be hung when call request.extract_json().get(), it is hung in get() call,
both the http client and server run on linux(cent os8) with execute program, the rest server on linux won't hung both the http client and server run on windows(win7) with execute program, the rest server on windows won't hung if the rest server run on linux, and the http request sent by postman, the rest server won't hung
Thanks