From: <jgr...@us...> - 2003-05-22 17:00:23
|
Update of /cvsroot/popfile/engine/UI In directory sc8-pr-cvs1:/tmp/cvs-serv31605/UI Modified Files: HTML.pm HTTP.pm Log Message: Fix http_error_ bug (not being called correctly) and make logging of connection acceptance verbose to help debug connection problems. Index: HTML.pm =================================================================== RCS file: /cvsroot/popfile/engine/UI/HTML.pm,v retrieving revision 1.157 retrieving revision 1.158 diff -C2 -d -r1.157 -r1.158 *** HTML.pm 22 May 2003 05:17:06 -0000 1.157 --- HTML.pm 22 May 2003 17:00:19 -0000 1.158 *************** *** 382,386 **** } ! http_error_($self, $client, 404); return 1; } --- 382,386 ---- } ! $self->http_error_($client, 404); return 1; } Index: HTTP.pm =================================================================== RCS file: /cvsroot/popfile/engine/UI/HTTP.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** HTTP.pm 26 Apr 2003 10:22:23 -0000 1.2 --- HTTP.pm 22 May 2003 17:00:20 -0000 1.3 *************** *** 107,118 **** --- 107,129 ---- # Handle HTTP requests for the UI if ( ( defined( $ready ) ) && ( $ready == $self->{server_} ) ) { + + $self->log_( "Connection pending on HTTP socket" ); + if ( my $client = $self->{server_}->accept() ) { + + $self->log_( "Accepted connection on HTTP socket" ); + # Check that this is a connection from the local machine, if it's not then we drop it immediately # without any further processing. We don't want to allow remote users to admin POPFile + my ( $remote_port, $remote_host ) = sockaddr_in( $client->peername() ); + $self->log_( "Got a connection from " . inet_ntoa( $remote_host ) . " on port $remote_port" ); + if ( ( $self->config_( 'local' ) == 0 ) || ( $remote_host eq inet_aton( "127.0.0.1" ) ) ) { + $self->log_( "Ready to receive HTTP command" ); + # Read the request line (GET or POST) from the client and if we manage to do that # then read the rest of the HTTP headers grabbing the Content-Length and using *************** *** 123,130 **** --- 134,145 ---- my $content; + $self->log_( "Received HTTP command $request" ); + while ( <$client> ) { $content_length = $1 if ( /Content-Length: (\d+)/i ); last if ( !/[A-Z]/i ); } + + $self->log_( "Content length $content_length" ); if ( $content_length > 0 ) { |