[MKDoc-dev] self_uri stripping port number

Chris Croome chris at webarchitects.co.uk
Tue Sep 28 19:48:35 BST 2004


Hi

Charlie wrote:
>
> I found that self_uri in MKDoc::Core::Request is a bit too agressive
> with stripping out port numbers. The regex was (from what I can
> read) stripping any port numbers starting with 80, not just port 80.
> I modified it back to the v1.6 behaviour so that port 8080 remains
> in the url.
> 
> sub self_uri
> {
>     my $self = shift;
>     my %opt  = map { "-" . $_ => 1 } ( @_, qw /path_info query/ );
>     $opt{relative}  ||= 0;
> 
>     my $url  = $self->url (\%opt);
> #     $url =~ s/(.*?\:\/\/(?:.*?\@)?)(.*):80\d?\d?(?!\d)(.*)/$1$2$3/
> #         if ($url =~
> #         /(.*?\:\/\/(?:.*?\@)?)(.*):80\d?\d?(?!\d)(.*)/);
>     $url =~ s/(.*?\:\/\/(?:.*?\@)?)(.*):80(?!\d)(.*)/$1$2$3/
>         if ($url =~ /(.*?\:\/\/(?:.*?\@)?)(.*):80(?!\d)(.*)/);
> 
>     return $url;
> }

Hmm, I a bit confused, I just updated 1.6 on my laptop which is
running on 8080 and I have the same problem, the code in this case
being in MKDoc/CGI.pm:

sub self_url
{
    my $self = shift;
    my $url = $self->url ( -relative  => 0,
                           -path_info => 1,
                           -query     => 1 );

    # remove the blah:80 like URIs
    $url =~ s/(.*?\:\/\/(?:.*?\@)?)(.*):80\d*(?!\d)(.*)/$1$2$3/
        if ($url =~ /(.*?\:\/\/(?:.*?\@)?)(.*):80\d*(?!\d)(.*)/);
    
    return $url;
}

So the 1.6 code doesn't seem to work with 8080 and also needs a fix?

I have just commented out these two line for the moment locally, and
it works fine.

So to get this properly fixed it appears that we need to:

1. Fix MKDoc/CGI.pm in 1.6 in CVS and then do a release.

2. Fix this in MKDoc::Core in CVS and then do a release of this
   module and upload it to CPAN.

For 2. -- how does this work, Bruno can you upload a new version of
this module to CPAN or can that only be done from Jean-Michel's
CPAN account?

Chris

-- 
Chris Croome                               <chris at webarchitects.co.uk>
web design                             http://www.webarchitects.co.uk/ 
web content management                               http://mkdoc.com/   


More information about the MKDoc-dev mailing list