Skip Menu |

This queue is for tickets about the CPAN-Mini-Webserver CPAN distribution.

Report information
The Basics
Id: 61435
Status: resolved
Priority: 0/
Queue: CPAN-Mini-Webserver

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

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



Subject: Use of port in URL is unnecessary
It is unnecessary to include the port in HTML link URLs displayed by CPAN::Mini::Webserver. Relative URLs beginning with / are sufficient. Including the port complicates situations in which one might want to place a reverse proxy in from of CPAN::Mini::Webserver. A patch is attached. Thanks, Darian
Subject: port_unnecessary.patch
--- Webserver.pm.orig 2010-09-17 12:45:39.202897380 -0700 +++ Webserver.pm 2010-09-17 12:20:31.038931929 -0700 @@ -463,9 +463,7 @@ my $contents = $self->get_file_from_tarball( $distribution, $filename ); my $parser = Pod::Simple::HTML->new; - my $port = $self->port; - my $host = $self->hostname; - $parser->perldoc_url_prefix("http://$host:$port/perldoc?"); + $parser->perldoc_url_prefix('/perldoc?'); $parser->index(0); $parser->no_whining(1); $parser->no_errata_section(1); @@ -554,11 +552,9 @@ $_ =~ s{<br>}{}g foreach @lines; # link module names to ourselves - my $port = $self->port; - my $host = $self->hostname; @lines = map { $_ - =~ s{<span class="word">([^<]+?::[^<]+?)</span>}{<span class="word"><a href="http://$host:$port/perldoc?$1">$1</a></span>}; + =~ s{<span class="word">([^<]+?::[^<]+?)</span>}{<span class="word"><a href="/perldoc?$1">$1</a></span>}g; $_; } @lines; $html = join '', @lines; @@ -607,9 +603,7 @@ $postfix .= '.pm'; my ($filename) = grep { $_ =~ /$postfix$/ } sort { length($a) <=> length($b) } @filenames; - my $port = $self->port; - my $host = $self->hostname; - my $url = "http://$host:$port/~$pauseid/$distvname/$filename"; + my $url = "/~$pauseid/$distvname/$filename"; $self->redirect($url); }
Léon, I've applied this patch and sent you a pull request via GitHub. Darian
Thanks Darian, i've pulled in your changes and they'll be up with v0.46 as soon as PAUSE is done processing. :)