Re: Patch for using libwww to accept incoming connect

Mikhail Grouchinski wrote:

> In fact, in my case, I always have only one non-HTTP connection and I need not to listen. The file descriptor for this connection comes from outside (via environment).

That's fine - I needed the servier side of libwww for HTTP-NG related
work. 
 
> I've looked at mget.c
> 
> I have more questions to you.
> How can I send HTTP request(s), install callback for replies and within this callback
> get a pointer to the buffer with the reply body.

You can see an example for how to use AFTER filters at

	http://www.w3.org/Library/Examples/range.c

I just use a global variable (cheating) but you can as well use contexts
which can be associated with any request object:

	http://www.w3.org/Library/src/HTReq.html#context

(you don't have to use the request callback mechanism).

> Also within the same callback I have to reply
> via my custom socket to the rest of the my system.

In the range request above, when the terminate filter is called, this is
the last step in handling that request and you are free to start any
other new request you want (you can always start new libwww requests any
time you want).
 
> How can I implement this with LibWWW?
> In mget.c there are no callbacks on replies.

The terminate handler is in fact an AFTER filter - only the request
contexts are not used.
 
> As far as I understand LoadToChunk only sends request and all reading happens in EventLoop.
> When does the chunk get filled?
> How can I detect that?

It starts getting filled up as soon as there is data on the socket. You
can't really peak inside the chunk before the request is done. If you
want to have streamed data at you then you need to use plain libwww
streams instead.

Henrik

Received on Tuesday, 15 December 1998 21:00:17 UTC