From: Maxim Olivier-Adlhoch
...
I was wondering, if its possible to put a hook somewhere (even if deep) within
the port or more specifically the html port handler, so that we can update
something elsewhere, do statistics or print out transfer rate for example...
...


Hi, Max,

Since no one has offered anything any more specific, I can suggest a general way to 
put in your own hooks, but some of the services are at a lower level than you can 
access through the standard service.

First, you'll need a working copy of the scheme.  For example, for http:

echo %/path/to/my-http.txt
probe system/schemes/http
echo off

With this text file, first place:
    system/schemes/http: 
near the top before the make, like:
    system/schemes/http: make object! [
        scheme: 'HTTP
        host: none
        port-id: 80
...

Then go to the end of the file and erase everything after the last "]" and resave the 
file.  This file can be loaded in as a replacement for the http scheme.  If reloaded 
as such, there will be no change.

Now, you have to begin to understand how the schemes work.  As the port for a scheme 
is read, it goes through these stages (or functions):
    init
    open-proto
    open
    close
The lowest level functions, accessed more "invisibly," are read and write.

By playing with probe or print statements and then accessing a web page, one can begin 
to get more information at a stage of the process as needed.  You will find after a 
lot of experimentation that much of the reading is done at a very low level, like 
through 'read-io.  This function stores its data in temporary spaces in this protocol, 
like the port/state object that is used during the access.  If you try to access these 
data, you inadvertently end up botching the operation, so care must be used and there 
are definitely limits to what can be used.  The only way to bypass some of the limits 
would be to extensively modify the scheme, which can be done with some work and care, 
or to create your own, which is reinventing the wheel.

It may be enough to get you going, but I would not be overenthusiastic about thinking 
you will be able the scrounge things like transfer rates!

Hope this gives you some help.

--Scott Jones

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to