POE-Component-Server-Bayeux
    
    
  
  
  
view release on metacpan or search on metacpan
lib/POE/Component/Server/Bayeux.pm view on Meta::CPAN
        }
        my $content;
        {
            local $/ = undef;
            $content = <$in>;
        }
        close $in;
        $response->content($content);
        my $ip = $request->header('X-Forwarded-For') || $request->{connection}{remote_ip};
        $heap->{logger}->info(sprintf 'Serving %s %s %s', $ip, $uri->path, $response->content_type);
    }
    else {
        $response->code(RC_NOT_FOUND);
        $response->content("Path '".$uri->path."' not found");
    }
    if ($heap->{args}{PostHandle}) {
        $heap->{args}{PostHandle}($request, $response);
    }
    
  
  
  lib/POE/Component/Server/Bayeux.pm view on Meta::CPAN
    return RC_OK;
}
## Remote clients, long-polling ###
sub handle_cometd {
    my ($kernel, $heap, $request, $response) = @_[KERNEL, HEAP, ARG0, ARG1];
    # Deny based upon ClientMaxConnections restrictions
    my $ip = $request->header('X-Forwarded-For') || $request->{connection}{remote_ip};
    if (! $ip) {
        $ip = '0.0.0.0';
        $heap->{logger}->error("No IP found for cometd request");
    }
    $heap->{requests_by_ip}{$ip} ||= {};
    my @request_ids = keys %{ $heap->{requests_by_ip}{$ip} };
    if (int @request_ids > $heap->{args}{ClientMaxConnections}) {
        $heap->{logger}->info("Denying $ip; too many connections (".int(@request_ids).")");
    
  
  
  
( run in 0.773 second using v1.01-cache-2.11-cpan-a1d94b6210f )