[Prev][Next][Index][Thread]

Re: WWW Library



> > 1) I take it I need to use PASSIVE mode because X windows has its own event
> >    loop? This means writing my own HTEventLoop() or HTEvent_Loop() function.
> >    Do I have to explicitly set something to PASSIVE mode or is it implied?
> 
> No, as you can redirect X events to a socket, you can actually use the 
> internal event loop in the Library (thus using ACTIVE mode). Arena is doing 
> this and it seems to work without slowing user interactions down.

I wasn't aware you could redirect X events this way. I've had some success
using:

    fd = ConnectionNumber(XtDisplay(toplevel));
    HTEvent_Register(fd, request,(SockOps)(FD_WRITE|FD_READ), event_handler, 1);

and then fetching and dispatching the next event inside event_handler().
However, as soon as I start the library event loop with:

    HTEventLoop(request, HTHomeAnchor(), NULL);

the home document doesn't load. I think a HT_WOULD_BLOCK is occurring - the
documentation states:

   HT_WOULD_BLOCK
   An I/O operation would block and the request must pause. As the
   request is not yet terminated, the operation will continue at a later
   time when the blocking situation has ceased  to exist.

Does this mean the library will continue the operation later or the user
has to retry the request? As far as I can tell the thread just disappears.
However, if I do not register my X event handler then the document loads OK.

> > 2) Do I need to write my own StreamClass to load data into memory (and then
> >    set it using HTRequest->output_stream).
> 
> What you probably want is to get the data sent from the network and then short
> circuiting the Library SGML tokenizer and HTML parser. This can be done by 
> changing the initialization in HTInit.c Arena also does this - it has it's own
> stream that it uses for parsing HTML. 

I've got this working now by setting my own conversion for
"text/html"->"www/present". I suppose this could also be done by writing
my own HTConverterInit() routine and ignoring the library one - so I don't
have to rebuild the library.

> > 4) Is it possible to get feedback on the transfer - to do progress bars for
> >    example?
> 
> This is on the working list as well :-) The problem is that it had to be 
> relative to a single request and as you now can have multiple requests - you 
> need some kind of context. The library does support this but I had to modify 
> the HTAlert module in order to pass thge information on.

Where is the progress information going to be called from? The obvious
one is when loading from the network, but it might also be useful to call
it from within a stream.

What's the latest on Arena - is the source code likely to be available soon?

Getting there....

Rik.

=============================================================================
 Richard Turnbull                     |       HP-UX Porting & Archive Centre 
                                      |
 E-Mail: rik@csc.liv.ac.uk            |                 [hpux.csc.liv.ac.uk]
 FAX: (0151) 794 3715                 |               Dept. Computer Science
 Office Phone: (0151) 794 3704        |              University of Liverpool 
 Dept   Phone: (0151) 794 6923        |                    Liverpool L69 3BX 
 http://www.csc.liv.ac.uk/users/rik/  |                              England
=============================================================================


References: