Skip Menu |

This queue is for tickets about the POE-Component-Server-SimpleHTTP CPAN distribution.

Report information
The Basics
Id: 31278
Status: new
Priority: 0/
Queue: POE-Component-Server-SimpleHTTP

People
Owner: Nobody in particular
Requestors: sharifulin [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Some bugs, add UDS support
Hello! Please, fix it: 1. Remove default content-type (i've got some examples and default content-type is bad) 2. If response is bad, Filter::HTTPD will return HTTP::Response and server will die :( I use this code: # Check if we have already sent the response if ( $_[HEAP]->{'REQUESTS'}->{ $id }->[1] == 1) { # Tried to send twice! warn 'Tried to send a response to the same connection twice!'; } 3. Add Unix Domain Socket support into SimpleHTTP. (SimpleHTTP.pm) ... 10: our $VERSION = '1.23'; ... 31: use Socket 'PF_UNIX'; # add ... 59: # Our own options 60: my ( $ALIAS, $ADDRESS, $PORT, $UDS, $HOSTNAME, $HEADERS, $HANDLERS, $SSLKEYCERT, $LOGHANDLER ); # add: $UDS ... 114: if (exists $opt{'UDS'} and defined $opt{'UDS'} and length( $opt{'UDS'} ) ) { # add: UDS-support $UDS = $opt{'UDS'}; delete $opt{'UDS'}; unlink $UDS if -e $UDS; } else { # Get the PORT ... } ... 208: my $data = { 'ALIAS' => $ALIAS, 'ADDRESS' => $ADDRESS, 'PORT' => $PORT, 'UDS' => $UDS, # add: UDS ... }; ... 282: sub FindRequestLeaks { # Loop through all of the requests foreach my $req ( keys %{ $_[HEAP]->{'REQUESTS'} } ) { # Bite the programmer! warn 'Did not get DONE/CLOSE event for Wheel ID ' . $req . ' from IP ' . ($_[HEAP]->{'UDS'}? $_[HEAP]->{'REQUESTS'}->{ $req }->[2]->connection->pathname : $_[HEAP]->{'REQUESTS'}->{ $req }->[2]->connection->remote_ip); # add: uds pathname } ... 388: # Create our own SocketFactory Wheel :) $_[HEAP]->{'SOCKETFACTORY'} = POE::Wheel::SocketFactory->new( # add UDS-server support do {( $_[HEAP]->{'UDS'} ) ? ( 'SocketDomain' => PF_UNIX, 'BindAddress' => $_[HEAP]->{'UDS'}, ) : ( 'BindPort' => $_[HEAP]->{'PORT'}, 'BindAddress' => $_[HEAP]->{'ADDRESS'}, )}, 'Reuse' => 'yes', 'SuccessEvent' => 'Got_Connection', 'FailureEvent' => 'ListenerError', ); 702: # If they have a log handler registered, send out the needed information # TODO if we received a malformed request, we will not have a request object # We need to figure out what we're doing because they can't always expect to have # a request object, or should we keep it from being ?undef'd? $_[KERNEL]->post( $_[HEAP]->{'LOGHANDLER'}->{'SESSION'}, $_[HEAP]->{'LOGHANDLER'}->{'EVENT'}, $request, $_[HEAP]->{'UDS'} ? $response->connection->pathname : $response->connection->remote_ip(), # add: uds pathname ) if $_[HEAP]->{'LOGHANDLER'}; ... === (SimpleHTTP/Connection.pm) 12: # Get some things we need 13: use Socket qw( inet_ntoa unpack_sockaddr_in unpack_sockaddr_un ); # add uds-support ... 44: # Check for errors! if ( $@ ) { # add: uds support eval { $self->{'pathname'} = unpack_sockaddr_un(getsockname( $socket )); }; # Just ignore this socket and return nothing! return undef if $@; } === My Script: use lib '.'; use POE::Component::Server::SimpleHTTP; ... POE::Component::Server::SimpleHTTP->new( 'ALIAS' => 'SAY_SERVER', 'UDS' => $SAY->{'socket' }, 'HOSTNAME' => $SAY->{'hostname'}, ... ); Thanks. Anatoly Sharifulin. http://sharifulin.livejournal.com/