seems to work fine for me, but i tested it on a simple web page. Try removing the line $socket->autoflush(1);
> -----Original Message----- > From: Octavian Rasnita [mailto:[EMAIL PROTECTED]] > Sent: Monday, September 30, 2002 11:08 AM > To: [EMAIL PROTECTED] > Subject: What am I missing or doing wrong? > > > Hi all, > > I've taken the following example from a Perl book but it > doesn't work well. > It should print the content of a web page, but it prints only > the first 4 > kb, then the page continues opening... and even if I press > the stop button > after more time, it doesn't print more than 4 kb. > > After waiting for more time for the page to finish loading, I > can see the > following error in the log file, even though the page > continues loading... > [Mon Sep 30 17:03:56 2002] [error] [client 127.0.0.1] Premature end of > script headers: test.pl > [Mon Sep 30 17:04:13 2002] [error] [client 127.0.0.1] > (20507)The timeout > specified has expired: ap_content_length_filter: > apr_bucket_read() failed > > Here is the script file I tried: > > #!/perl/bin/perl -w > > print "Content-type: text/html\n\n"; > > use strict; > use IO::Socket; > use URI; > > my $location = 'http://localhost'; > > my $url = new URI($location); > > my $host = $url->host; > my $port = $url->port || 80; > my $path = $url->path || "/"; > > my $socket = new IO::Socket::INET (PeerAddr => $host, > PeerPort => $port, > Proto => 'tcp') > or die "Cannot connect to the server.\n"; > > $socket->autoflush(1); > > print $socket "GET $path HTTP/1.1\n", > "Host: $host\n\n"; > > print while (<$socket>); > > $socket->close; > > > Teddy's Center: http://teddy.fcc.ro/ > Mail: [EMAIL PROTECTED] > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]