作者JY (喷火龙)
看板PangSir
标题Re: [问题] 关於作业的几个问题
时间Wed Mar 29 21:52:03 2006
※ 引述《Favonia (xDDDDDDDDDDDDDDDDDDDDDD)》之铭言:
: 不会有
: 决定长度是一个学问
我想请教如何决定长度,RFC中如此写道
When an Entity-Body is included with a message, the length of that
body may be determined in one of two ways. If a Content-Length header
field is present, its value in bytes represents the length of the
Entity-Body. Otherwise, the body length is determined by the closing
of the connection by the server.
我的问题是,如果没有Content-Length资料的话
要如何侦测 connection close 呢?
目前很笨的方法就是一个字元一个字元read,直到read回传error@@
谢谢^^"
<文章更新>
刚刚突然想到可以用read回传值作为length参考
就把这部份大致写出来了
不过有一个测试网站上的gif档居然还不能完全读出来
已经确定 IE 有向我的 proxy 做 request 了
後来把 IE 暂存清掉以後竟然可以正常读取...真怪
希望不是我的程式的问题@@
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.247.24
※ 编辑: JY 来自: 140.112.247.24 (03/29 21:53)
※ 编辑: JY 来自: 140.112.247.24 (03/29 22:39)