Closed GoogleCodeExporter closed 8 years ago
I can't reproduce this problem, please provide a full example.
Original comment by bob.ippo...@gmail.com
on 2 Jan 2010 at 9:28
What steps will reproduce the problem?
1. Generate test project by: escript scripts/new_mochiweb.erl test
2. In test_web.erl, add new Req Handler /timer.
3. Access http://testserver:8000/timer. Close browser and try again.
Original comment by gary.x...@gmail.com
on 3 Jan 2010 at 8:00
Attachments:
(server)
$ ./scripts/new_mochiweb.erl ice
$ cp ~/Downloads/ice_web.erl ice/src/ice_web.erl
$ cd ice/
$ ./start-dev.sh
(curl client)
$ curl http://127.0.0.1:8000/timer
The time is: {{2010,1,3},{0,6,33}}
The time is: {{2010,1,3},{0,6,34}}
The time is: {{2010,1,3},{0,6,35}}
The time is: {{2010,1,3},{0,6,36}}
...
Also tested with Safari, Firefox and Chrome. All work as expected, no errors.
Still can't reproduce, even with
your code.
Original comment by bob.ippo...@gmail.com
on 3 Jan 2010 at 8:09
Just tested it both in Firefox and Chrome. Running in Firefoxy is fine, but
failed test
in Chrome. My chrome version is v4.0.249.43
Test the timer handler by refreshing page.
Original comment by gary.x...@gmail.com
on 3 Jan 2010 at 8:32
Ok. Let me capture the packets by different browsers.
First time access by Chrome:
GET /timer HTTP/1.1
Host: vbox:8000
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5
(KHTML,
like Gecko) Chrome/4.0.249.43 Safari/532.5
Accept:
application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png
,*/*;
q=0.5
Accept-Encoding: gzip,deflate
Accept-Language: en-US,en;q=0.8,zh-CN;q=0.6
Accept-Charset: GBK,utf-8;q=0.7,*;q=0.3
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Sun, 03 Jan 2010 08:53:23 GMT
Content-Type: text/plain
25
The time is: {{2010,1,3},{16,53,23}}
25
The time is: {{2010,1,3},{16,53,24}}
25
The time is: {{2010,1,3},{16,53,25}}
25
The time is: {{2010,1,3},{16,53,26}}
25
The time is: {{2010,1,3},{16,53,27}}
25
The time is: {{2010,1,3},{16,53,28}}
25
The time is: {{2010,1,3},{16,53,29}}
===================================================
Let me reload the page by click the refresh button:
GET /timer HTTP/1.1
Host: vbox:8000
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5
(KHTML,
like Gecko) Chrome/4.0.249.43 Safari/532.5
Cache-Control: max-age=0
Accept:
application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png
,*/*;
q=0.5
Accept-Encoding: gzip,deflate
Accept-Language: en-US,en;q=0.8,zh-CN;q=0.6
Accept-Charset: GBK,utf-8;q=0.7,*;q=0.3
Range: bytes=0-221
==================================================================
Yes, Got it. The new request sent by Chrome has a Range field. Range:
bytes=0-221. It
cause the case of:
ok({ContentType, ResponseHeaders, Body}) ->
...
Ranges ->
{PartList, Size} = range_parts(Body, Ranges),
and calling of range_parts(chunked, Ranges) failed by:
range_parts(Body0, Ranges) ->
Body = iolist_to_binary(Body0),
========================================================
exception error: bad argument
in function iolist_to_binary/1
called as iolist_to_binary(chunked)
in call from mochiweb_request:range_parts/3
in call from mochiweb_request:ok/2
Original comment by gary.x...@gmail.com
on 3 Jan 2010 at 9:03
r124
Original comment by bob.ippo...@gmail.com
on 3 Jan 2010 at 11:06
Original issue reported on code.google.com by
gary.x...@gmail.com
on 29 Dec 2009 at 8:53