Re: [問題] 關於作業的幾個問題
※ 引述《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)
討論串 (同標題文章)