Writing modern C++ servers using Wangle.
James Perry
13112

I’m follow an example from EchoServer.cpp class in Proxygen project, but found problems are GET method requst to EchoServer. EchoServer not print output on onBody(…) member funciton. Figure below is member function of EchoHandler.cpp

void EchoHandler::onBody(std::unique_ptr<folly::IOBuf> body) noexcept {

body_->prependChain(std::move(body));

const char * p = reinterpret_cast<const char*>(body->data());

std::cout<<”Body http : “<< std::string(p,body->length())<<std::endl;

}

Link : https://github.com/facebook/proxygen/blob/master/proxygen/httpserver/samples/echo/EchoHandler.cpp#L28

Web browser send message edited through out to EchoServer.cpp as figure below. Body message is “1234”.

Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
1234

Why EchoServer cannot read body message in EchoHandler::onBod(…) member function?

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.