Bill Moseley <[EMAIL PROTECTED]> writes:

> I'm using keep alives and the form of $ua->get() that uses a callback
> function to read the data as it arrives.
> 
> If the callback function dies will the connection always be broken?

Yes, unless it dies after the last part of the response has actually
been read.

> That is, will the next request to that server be a new connection, not
> an existing open connection from a previous keep alive request?
> 
> I assume if I've only read the first chunk out of a very large
> response then the connection will be broken.  But, I'm not clear what
> happens if the fetched document is very small (like the first chunk is
> the entire document).
> 
> Does size matter?  Or would LWP drop the connection regardless?

If LWP has provided you with the complete content when your callback
dies, then the connection is kept up.

> Also, is there a way to ask LWP if a request would be to an open
> connection before making the actual connection?

You could roam around in the $ua->conn_cache object, but it is not
really documented how the connections are indexed, or what the
connection objects actually are.

If you want to make sure LWP has no more connections open, you can
call $au->conn_cache->drop;

Regards,
Gisle

Reply via email to