Показать сообщение отдельно

  #2  
Старый 05.02.2010, 03:47
IIAHbI4
Banned
Регистрация: 24.08.2006
Сообщений: 483
Провел на форуме:
3895065

Репутация: 1112
Отправить сообщение для IIAHbI4 с помощью ICQ
По умолчанию

по моему код нужно править начиная здесь

PHP код:
#!/usr/bin/perl

use HTTP::Daemon;
use 
LWP::UserAgent;
use 
Compress::Zlib;
use 
CGI::Carp qw(fatalsToBrowser);

my @ext qw(x-gtar x-gzip x-tar zip image zip z gz tz taz tgz lzh arj arc tar cab wmz yfs wsz exe uu xxe bhx b64 hqx mim);

my $port 8080;

$SIG{PIPE} = 'IGNORE';

my $server HTTP::Daemon->newLocalPort => $port ) or
die 
"Can't start server ($@)" unless defined $server;

while (
my $conn $server->accept) {
    
my $ua LWP::UserAgent->new;
    
my $str = do {my $fh open "<filename.txt"local $/ = undef; <$fh>};
    
chomp $str;
    
$ua->default_header('My header' => $str);}
while (
my $conn $server->accept) {
    while (
my $request $conn->get_request) {
           
$conn->autoflush;
                
$request -> remove_header('Proxy-Connection');
        
$request -> remove_header('Keep-Alive');
        
$request -> header(Connection=>'close');
           
my $resp $ua->simple_request($request);
           
my $c_cont $resp->content;
        if ( 
$resp->content_encoding || (grep $_ =~ /$resp->content_type/} @ext) || length($c_cont) < 3000 ) {
        
$conn->send_response($resp);
        }
        else {
             
$c_cont_zip Compress::Zlib::memGzip($c_cont);
             
$resp->content($c_cont_zip);
             
$resp->content_encoding('gzip');
             
$conn->send_response($resp);
             }
     }
    print 
STDERR "Close: "$conn->reason"\n";
    
$conn->close;
    
undef $conn;

но это не точно
 
Ответить с цитированием