Re: WWW Library

> Hi, I have written an (public domain) X windows client and server for accessing
> the HP-UX public domain archive at the University of Liverpool, UK. It has
> been in use for a few years now. When the web started up, I began using the
> NCSA HTML widget inside "XBrowser", but due to legal restrictions, etc
> I have now implemented my own (HTML 1.0!) widget.

Sounds interesting!

> I have been looking at the WWW library and would like to use it to retrieve
> data from the network and then pass this on to the HTML widget.
> At the moment I'm still trying to figure out how to use the library -
> so I have quite a few questions :-)
> 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. Of course 
you _can_ write your own event loop, but it might be more complicated.

> 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. 

> 3) When I first linked my application I had a few unresolved symbols related
>    to the HText class. Aren't these for the HTML parser? How do "compile out"
>    the HTML parser, so that I can get rid of the stubs I put in?

Unfortunately, the Library is not separated enough so that HText definitions 
are not needed if not used. I am working on this and it will be fixed in the 
next version.

> 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.

> 5) Where does the SOCKET parameter to HTEvent_Register come from? Do I
>    register a callback for each request?

No, you only have to register it once as you know the socket number the would 
like to be the input for X events. The Line Mode Browser registers STDIN as 
the socket for user input, but the method is exactly the same.

> Apologies if these are stupid questions but it's difficult to learn the
> library and the WIT area looks quiet and the mailing list too (looking
> at the archives). I'd appreciate any pointers you could give...

None of these questions are stupid and this is why I CC the www-lib list, so that maybe we can get a discussion going!


Henrik Frystyk Nielsen, <frystyk@w3.org>
World-Wide Web Consortium, MIT/LCS NE43-356
545 Technology Square, Cambridge MA 02139, USA