W3C home > Mailing lists > Public > www-lib@w3.org > January to March 2000

building a proxy server with libwww

From: or <or@gammasite.com>
Date: Tue, 28 Mar 2000 20:03:05 +0200
Message-ID: <DB0BAA5DA7F9D31184CC0050DA7871602F44@GAMMAMAIL>
To: "'www-lib@w3.org'" <www-lib@w3.org>
Hello list,

(I must admit that I'm newbie to libwww but I've spent some time looking at
the docs+code+looking in the archives, you have to start from somewhere :)

I want to use libwww for the "backend" of an application similar to proxy
server, meaning the
part that will fetch the pages from the net and pass them to the "front end"
which will return them to the clients.

So the lib is not thread safe, and i can't just init the lib and then open a
thread on each request
for fetching a url. After looking in the docs and the examples (the "tiny"
etc.), I understand the following: 
"pseudo threads" can be implemented by having:
   - one SOCKET where requests will arrive from, and
  - many socket connections open simultaneously to serve these requests. 
All the code must be executed in the context of a SINGLE thread, and managed
by an eventloop, 
where "event" is either a new request in the "input" socket, or data arrived
in one of the connections.

Please tell me if i understood correct and this is the only way to server
multiple requests, or I've missed it.

But, what if the requests arrive not from a socket, let's say they arrive
from some priority queue, or one of the 
constraints of the application is that the socket where the requests come
from is managed by a another thread 
and not by the tread who "executes" libwww. Is there any way around.

BTW - is there any way to make the "tiny" example work on windows/NT (maybe
with the Cygnus env?),
I think this code is the problem(since the library core expects the INPUT to
come from a socket and on Unix
select() can get sockets and other file-descriptors (pipes, stdin etc.) but
not on windows):
PRIVATE App * App_new (void)
    if (isatty(STDIN_FILENO)) HTEventList_register(STDIN_FILENO,
HTEvent_READ, me->console_event);

  Or Gerlitz.

Received on Tuesday, 28 March 2000 13:02:47 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:52 UTC