【实习记】2014-08-18使用curl排错http头的content-length
总结一,用curl排错
Content-Length设置错误,误导了客户端。
访问/cgi-bin/txproj_list时,firebug显示总是不多不少15秒,调试其他问题时郁闷。 firebug没有具体延时15秒的提示,一直百思不得其解。 直到我使用curl
wilson@ubun:~$ curl http://192.168.56.101:8080/cgi-bin/txproj_list -b "name=rich; token=1333500450rich; id=1000003; type=2"
{"error":0,"type":2, "len":0, "data":[{"id":1000000002, "seller":"rich", "amount":13300, "refund":300, "create_time":"2014-07-28 09:00:00", "status":3},{"id":1000000005, "seller":"rich", "amount":3500, "refund":1000, "create_time":"2014-08-08 19:01:00", "status":3},{"id":1000000010, "seller":"rich", "amount":3700, "refund":0, "create_time":"2014-08-12 09:20:00", "status":2}]}
curl: (18) transfer closed with 30 bytes remaining to read
最后一行直接告诉我原因,会多一个工具是好的。
设置回复真实长度后成功debug,测试去掉其实也是可以的。
排错后代码:
// 有没有长度都行的
// 有但不对会误导浏览器,使执行时间长达15秒!!!!
// cout << "Content-Length:" << strlen(buf_recv)+2 << "\r\n";
cout << "Content-Type:application/json" << "\r\n\r\n";
// 格式必须json正确,不如$.get[JSON]回调函数不执行,大坑!!!
cout << buf_recv << "\r\n";
小项目整个写代码过程有8-12天。
【实习记】2014-08-18使用curl排错http头的content-length的更多相关文章
- 在MyEclipse配置自己安装的Tomcat(2014.08.18)
今天因为要在tomcat下运行一个java项目,第一次嘛,遇到了不少问题,总结分享一下: 第一次,我直接将 MyEclipse 生成的项目放到 tomcat 安装目录的 webapps 目录下,运行出 ...
- Sysinternals Suite 2014.08.18
Windows Sysinternals Suite 是一套由微软官方免费提供的系统工具集,其中包含了大量超级实的优秀绿色小软件,譬如 Desktops (虚拟桌面).Process Explorer ...
- 2016年12月23日 星期五 --出埃及记 Exodus 21:18
2016年12月23日 星期五 --出埃及记 Exodus 21:18 "If men quarrel and one hits the other with a stone or with ...
- 2016年11月27日 星期日 --出埃及记 Exodus 20:18
2016年11月27日 星期日 --出埃及记 Exodus 20:18 When the people saw the thunder and lightning and heard the trum ...
- 2016年11月2日 星期三 --出埃及记 Exodus 19:18
2016年11月2日 星期三 --出埃及记 Exodus 19:18 Mount Sinai was covered with smoke, because the LORD descended on ...
- 【实习记】2014-09-26恢复linux下误删的ntfs盘中的文件
情景,ubuntu下把NTFS格式的盘中的“实习记”文件夹彻底删除了,追毁莫及,粗心觉不是一件好的事情. linux下回复ntfs盘下的文件不能用ext3grep,而使用debugfs命令实在 ...
- 学生党如何拿到阿里技术offer:《阿里面试经历-2014.4.18研发实习生面试经历(失败)》
我们分享的上一篇文章是一位学长在大三的时候面试阿里实习生成功的经历的分享,其实就像学长在上一篇文章最后说的那样“面试并没有想的那么难,运气也会占一部分.”,其实我个人觉得,对于我们而言,自己越努力就会 ...
- js 时间 Fri Dec 12 2014 08:00:00 GMT+0800
第一种var d = new Date('Fri Dec 12 2014 08:00:00 GMT+0800'); ) + '-' + d.getDate() + ' ' + d.getHours() ...
- Image Processing and Computer Vision_Review:A survey of recent advances in visual feature detection(Author's Accepted Manuscript)——2014.08
翻译 一项关于视觉特征检测的最新进展概述(作者已被接受的手稿) 和A survey of recent advances in visual feature detection——2014.08内容相 ...
随机推荐
- uva 3523 Knights of the Round Table
题意:给你n,m n为有多少人,m为有多少组关系,每组关系代表两人相互憎恨,问有多少个骑士不能参加任何一个会议. 白书算法指南 对于每个双联通分量,若不是二分图,就把里面的节点标记 #include ...
- (DT系列一)DTS结构及其编译方法
DTS结构及其编译方法 一:主要问题 1,需要了解dtsi与dts的关系 2,dts的结构模型 3,dts是如何被编译的,以及编译后会生成一个什么文件. 二:参考文字 1,DTS(device tre ...
- [LeetCode] 3. Longest Substring Without Repeating Characters 解题思路
Given a string, find the length of the longest substring without repeating characters. For example, ...
- iOS按钮长按
UILongPressGestureRecognizer *longPressGR = [[UILongPressGestureRecognizer alloc] initWithTarget:sel ...
- HTML5 UTF-8 中文乱码
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- cocos 事件转发
CCDirector在函数setOpenGLView中设置pobOpenGLView,同时会掉用 m_pobOpenGLView->setTouchDelegate(m_pTouchDispat ...
- 超强vim配置文件
简易安装方法: https://github.com/ma6174/vim 打开终端,执行下面的命令就自动安装好了: wget -qO- https://raw.github.com/ma6174/v ...
- 全文索引(三)lucene 分词 Analyzer
分词: 将reader通过阅读对象Analyzer字处理,得到TokenStream处理流程被称为分割. 该解释可能是太晦涩.查看示例,这个东西是什么感性的认识. 样品:一段文本"this ...
- Oracle 根据业务创建新的用户
新的需求,创建一个用户,可以查询基表的数据,但是不能修改,同时自己也可以创建对象 1.创建用户第一种方式 详细常见,前提 表空间和临时表空间必须存在 格式: create user 用户名 ident ...
- Android(java)学习笔记190:Eclipse中的控制台不停报错Can't bind to local 8700 for debugger
[DDMS] Can't bind to local 8600 for debugger 改成 Under Window -> Preferences -> Android -> D ...