[Internship] Use curl to troubleshoot the Content-Length of the HTTP Header

Source: Internet
Author: User


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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.