[REBOL] Re: hook while downloading from html port
From: antonr:lexicon at: 15-Apr-2004 17:51
Scott, I think you are a bit negative about transfer rates. :)
Surely there is a way.
Here also, is an easier way to save the scheme:
write clipboard:// join {rebol [] system/schemes/http:} mold
system/schemes/http
Now open your favourite editor, paste into a new file and save.
Uh oh, now I'm into it...
Search for "read:". You have found the read function.
Now add a line after the "net-utils/net-log" line:
print join "bytes: " [port/state/num " at " now/time/precise]
Save the file and do it. Then test the change:
>> read http://www.rebol.com/
connecting to: www.rebol.com
bytes: 2048 at 17:39:47.731
bytes: 2048 at 17:39:47.741
bytes: 2048 at 17:39:47.741
bytes: 2048 at 17:39:48.332
bytes: 2048 at 17:39:48.332
bytes: 2048 at 17:39:48.332
bytes: 2048 at 17:39:48.552
== {<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
<META NAME="keywords" CONTENT="REBOL, pro...
With that info it's possible to make up some progress callback so you
can make a display showing transfer rate.
You would need to add a couple of variables to the http object, eg:
total-bytes
last-transfer-time
and reset these at the appropriate time.
Mmm.. while I'm here I can see the /custom refinement.
If I ever forget the custom refinement dialect I can
look here in the source.
Anton.