HTTP-Server-Multiplex
view release on metacpan or search on metacpan
lib/HTTP/Server/Connection.pm view on Meta::CPAN
$req->{HSC_id}
= $self->{HSC_conn_id} . sprintf('-%02d', $self->{HSC_reqcount}++);
my $proto = $req->protocol;
$req->protocol($proto = HTTP_0_9)
unless $proto;
$headers = $req->headers;
$self->{HSC_no_more}++
if $req->protocol lt HTTP_1_1
|| lc($headers->header('Connection') || '') ne 'keep-alive';
if($proto lt HTTP_1_0)
{ $self->{take_all}++;
return;
}
if(my $expect = $headers->header('Expect'))
{ if(lc $expect ne '100-continue')
{ my $resp = $self->sendStatus($req, RC_EXPECTATION_FAILED);
trace "Unsupported Expect value '$expect'";
lib/HTTP/Server/Connection.pm view on Meta::CPAN
sub sendResponse($$$;$)
{ my ($self, $req, $status, $header, $content) = @_;
my $protocol = $req->protocol;
defined $content or $content = '';
if($protocol ge HTTP_1_0)
{ push @$header
, Date => time2str(time)
, Connection => ($self->{HSC_no_more} ? 'close' : 'keep-alive')
, @default_headers;
push @$header
, ref $content eq 'CODE'
? ('Transfer-Encoding' => 'chunked')
: ('Content-Length' => length $content);
}
else
{ undef $header;
}
lib/HTTP/Server/Connection.pm view on Meta::CPAN
$callback = sub
{ $user_callback->(@_);
close $from_fh; # read errors are ignored
$self->handleRequests;
};
my ($ct, $ce) = guess_media_type $file;
push @headers
, Date => time2str(time)
, Connection => ($self->{HSC_no_more} ? 'close' : 'keep-alive')
, @default_headers
, 'Content-Type' => $ct;
push @headers, 'Content-Encoding' => $ce if $ce;
}
my ($size, $mtime) = (stat $from_fh)[7,9];
push @headers, 'Content-Length' => $size if $size;
my $status = RC_OK;
if($mtime)
( run in 0.590 second using v1.01-cache-2.11-cpan-71847e10f99 )