[MKDoc-dev] self_uri stripping port number
Chris Croome
chris at webarchitects.co.uk
Sat Sep 25 19:56:51 BST 2004
Hi
On Sun 26-Sep-2004 at 03:02:23AM +1000, Charlie Garrison 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;
> }
OK, cool, I'll add this patch in.
> But that brings up another issue, and that is a more flexible way of
> configuring which port number(s) should be stripped from the url. Right now I
> want :8080 as part of the url because I haven't configured my frontend apache
> to proxy requests for my mkdoc test server. But after I've made that config,
> then I will want :8080 stripped from the url. And when I setup mkdoc on the
> production server, the port number will be something else again. Of course
> changing the sub for each server is not satisfactory.
>
> %ENV is used for many other config options. Is this another one to be
> configured that way? What about multiple port numbers? Should the variable (eg
> $ENV{MKD__PORT_TO_STRIP}) be something like:
>
> MKD__PORT_TO_STRIP "80,8080,8081"
>
> or assign the actual regex snippet:
>
> MKD__PORT_TO_STRIP ":80\d?\d?"
>
> The first is less prone to user error (in the config file) but is not as
> efficient. I prefer the second option. Maybe both are appropriate using
> MKD__PORT_TO_STRIP and MKD__PORT_TO_STRIP_REGEX.
That sounds like a good plan to me :-)
> Will the MKDoc::Core modules become part of the cvs repository? Or should
> submissions for those modules always be sent via the mailing list?
They are in CVS, for example:
cvs -d:pserver:anoncvs at cvs.mkdoc.com:/var/spool/cvs login
cvs -z3 -d:pserver:anoncvs at cvs.mkdoc.com:/var/spool/cvs co MKDoc-Core
I have added this example to this page:
http://mkdoc.com/docs/howtos/anon-cvs/
Just shout if you have a problem guessing any of the names, I'll
sort out a full list on Monday.
There was a MKDoc-modules list set up when there were just some
modules that were Free software:
http://lists.webarch.co.uk/mailman/listinfo/mkdoc-modules
And we could use that list or we could do it here if we want to wind
down that list.
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