Problems with keep-alive connections

From: Vincent van Scherpenseel (reply_at_newsgroup.invalid)
Date: 05/30/04


Date: Sun, 30 May 2004 16:37:49 +0200

Hello group,

I'm writing a simple script which should connect to a HTTP proxy server,
then send a GET request and display the output of the GET request. After
that it should continue with other tasks.

It's all going well, until I use HTTP/1.1. Most HTTP/1.1 requests are
Keep-Alive connections and thus perl keeps the connection (IO::Socket)
alive.

Here's a (much) simplified version of my code:
> while (<$remote>) {
> print $client $_;
> }
> close $remote;

Now my problem is that because of the Keep-Alive connection, my script
'hangs' within the while-loop, and thus doesn't continue its operations. Is
there a way to support Keep-Alive connections but still let my script
continue like it should?

Please help me how to work around this.

Yours Sincerely
Vincent van Scherpenseel