I wrote this program described in the document(FastCGI Quickstart 10 minute intro): http://cgi.sourceforge.net/docs/fastcgi___cgi/tutorial/fastcgi.html
When I enter 50+1 in the Expression input box,
Std::string str(req.form["expression"]);
Std::cerr << "osx ["<<str<<"] len="<<str.length()<<std::endl;
The length of str is 11. The hexadecimal values are: 35 30 2b 31 0 0 0 0 0 0.
After phrase_parse(iter, end, calc, space, result), the iter is not equal to end.
This extra 0x0 is even written back to the browser, showing garbled characters.
I used tcpdump to capture packet, The extra 0x0 is come from nginx(35 30 25 32 42 31 0 0 0 0 0 0), not browser(35 30 25 32 42 31).
Can the cgi library handle this situation?