I have managed to pin-point the source of the problem but don't quite know how to explain it:
If the first line is used instead of the second and an HTTP server sends back a response with status 302 found, I don't get any subsequent HTTP requests. (The 302 status informs the HTTP browser to search for the requested page at a different location: this location is specified in the header after "Location: "). If the second line is used, then the page specified after Location, is then requested...and the whole page is then downloaded. Whereas if the first line is used, after the 302 status is sent back to the browser, there are no more requests that arrive from the client.
##$client_sock = $sock->accept() || die "accept $!";
accept ($client_sock, $sock)) || die "accept $!";
What's the difference between these 2 lines? One is blocking, the other isn't?
The rest of the code for the proxy is in my previous message.