Conclusion 1: troubleshooting with curl
The Content-Length setting error misled the client.
When accessing/cgi-bin/txproj_list, firebug shows that it is always less than 15 seconds, and other debugging problems are depressing. Firebug does not have a prompt for a specific delay of 15 seconds. Until I use curl
[Email protected]: ~ $ Curl http: // 192.168.56.101: 8080/cgi-bin/txproj_list-B "name = rich; token = 1333500450 rich; id = 1000003; type = 2" {"error ": 0, "type": 2, "len": 0, "data": [{"ID": 1000000002, "seller": "rich", "amount": 13300, "refund": 300, "create_time": "09:00:00", "status": 3 },{ "ID": 1000000005, "seller": "rich ", "amount": 3500, "refund": 1000, "create_time": "19:01:00", "status": 3 },{ "ID": 1000000010, "seller ": "rich", "amount": 3700, "refund": 0, "create_time": "09:20:00", "status": 2}]} curl: (18) transfer closed with 30 bytes remaining to read
The last line tells me the reason. It would be nice to have another tool.
After setting the true length of the reply, debug is successful. It is also possible to remove the test.
Code after troubleshooting:
// Do you have any length? // If yes, but not, the browser will be misled, so that the execution time can be up to 15 seconds !!!! // Cout <"Content-Length:" <strlen (buf_recv) + 2 <"\ r \ n"; cout <"Content-Type: application/JSON "<" \ r \ n "; // The JSON format must be correct, not as good as $. get [JSON] callback function is not executed !!! Cout <buf_recv <"\ r \ n ";
The entire code writing process for a small project is 8-12 days.