Skip Menu |

This queue is for tickets about the SVN-Web CPAN distribution.

Report information
The Basics
Id: 17347
Status: resolved
Priority: 0/
Queue: SVN-Web

People
Owner: Nobody in particular
Requestors: MIYAGAWA [...] cpan.org
Cc:
AdminCc:

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



Subject: svnweb-server doesn't run out of the box
svnweb-server has a couple of bugs: 1) %options doesn't have a sane default value 2) $self->host() doesn't get set correctly 3) default cgi_class CGI::Fast doesn't work well with svnweb-server Attached patch fixes 1) and 2). I manually added "cgi_class: CGI" to config.yaml and worked around it, but there should be a way to avoid this in svnweb-server.
Subject: svn-web.patch
=== bin/svnweb-server ================================================================== --- bin/svnweb-server (revision 24586) +++ bin/svnweb-server (local) @@ -8,6 +8,7 @@ use base qw(HTTP::Server::Simple::CGI); use Getopt::Long; +use Sys::Hostname; =head1 NAME @@ -52,9 +53,9 @@ =cut -my %options = ('root=s' => '.', - 'port=i' => '8080', - 'net-server=s' => undef); +my %options = ('root' => '.', + 'port' => '8080', + 'net-server' => undef); GetOptions('root=s' => \$options{root}, 'port=i' => \$options{port}, @@ -72,12 +73,19 @@ print <FILE>; close FILE; } else { - $ENV{SCRIPT_NAME} = 'http://' . $self->host() . ':' . $self->port(); + $ENV{SCRIPT_NAME} = 'http://' . $self->get_host() . ':' . $self->port(); print "HTTP/1.1 200 OK\n"; SVN::Web::run_cgi(); } } +sub get_host { + my $self = shift; + my $host = $ENV{HTTP_HOST} || Sys::Hostname::hostname() || 'localhost'; + $host =~ s/:(\d+)$//; # remove port from Host: header + $host; +} + use CGI::Carp qw(fatalsToBrowser); my $server = __PACKAGE__->new($options{port});
Subject: Re: [rt.cpan.org #17347] svnweb-server doesn't run out of the box
Date: Mon, 30 Jan 2006 15:09:46 +0000
To: bug-SVN-Web [...] rt.cpan.org
From: Nik Clayton <nik [...] ngo.org.uk>
Hi, Show quoted text
> svnweb-server has a couple of bugs: > > 1) %options doesn't have a sane default value
Thanks, fixed with your patch. Show quoted text
> 2) $self->host() doesn't get set correctly
Which version of HTTP::Server::Simple are you using? The existing code seems to work in 0.16 and 0.17, where host() is documented as: Returns this server's bound address. Instead of that part of your patch, could you modify handle_request() and add a call to lookup_localhost() sub handle_request { ... if(...) { # css check ... } else { $self->lookup_localhost(); # Make sure $self->host() works ... } } That should ensure that the $self->host() call later in the sub works. Show quoted text
> 3) default cgi_class CGI::Fast doesn't work well with svnweb-server
What are the symptoms? I've got CGI::Fast installed (as well as FCGI for the backend) and svnweb-server seems to work OK. Since I can't reproduce the problem you're seeing I don't know whether or not I've fixed it... Thanks for your help in tracking these down and helping make the software better. N
Subject: Re: [rt.cpan.org #17347] svnweb-server doesn't run out of the box
Date: Mon, 30 Jan 2006 16:09:37 -0800
To: bug-SVN-Web [...] rt.cpan.org
From: Tatsuhiko Miyagawa <miyagawa [...] gmail.com>
On 1/30/06, nik@ngo.org.uk via RT <bug-SVN-Web@rt.cpan.org> wrote: Show quoted text
> > 2) $self->host() doesn't get set correctly
> > Which version of HTTP::Server::Simple are you using? The existing code > seems to work in 0.16 and 0.17, where host() is documented as:
Bingo. The version I used was very old on my svn box. Show quoted text
> > 3) default cgi_class CGI::Fast doesn't work well with svnweb-server
> > What are the symptoms?
Getting an empty page. I don't have much time to track this down though. Changing cgi_class to "CGI" worked like a charm. Show quoted text
> I've got CGI::Fast installed (as well as FCGI for > the backend) and svnweb-server seems to work OK. Since I can't reproduce > the problem you're seeing I don't know whether or not I've fixed it...
-- Tatsuhiko Miyagawa
On Mon Jan 30 19:10:30 2006, miyagawa@gmail.com wrote: Show quoted text
> > > 3) default cgi_class CGI::Fast doesn't work well with
svnweb-server Show quoted text
> > > > What are the symptoms?
> > Getting an empty page. I don't have much time to track this down > though. Changing cgi_class to "CGI" worked like a charm.
Please could you try the diff at http://jc.ngo.org.uk/svnweb/jc/revision/?rev=805 and let me know if that resolves the problem for you. Many thanks. N
I'm closing this due to lack of feedback. I believe I've tracked down and fixed all the problems of this nature. Thanks for the bug report.