You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Singly Bertrand de (X1995)" <bs...@frankiz.polytechnique.fr> on 1998/07/20 20:01:18 UTC

mod_autoindex, link to the "parent directory" (fwd)

hello,
when displaying http://www.polytechnique.fr/eleves/htdig/apache/ which is
a directory without any index file mod_autoindex produces a list where the
parent directory is referenced as "/htdig/" (the webserver running apache
is www.polytechnique.fr/eleves) and so it doesn't work (should be a href
to "/eleves/htdig/")

it seems to me that any browser can handle an href to "../" (is it true?)
then mod_autoindex could be simplified :
        if (is_parent(ar[x]->name)) {
            t = ap_make_full_path(scratch, name, "../");
            ap_getparents(t);
            if (t[0] == '\0') {
                t = "/";
            }
            anchor = ap_pstrcat(scratch, "<A HREF=\"",
                                ap_escape_html(scratch,
                                               ap_os_escape_path(scratch,
t,
                                                                 0)),
                                "\">", NULL);

>> anchor = ap_pstrcat(scratch, "<a href=\"../\">", NULL);

            t2 = "Parent Directory</A>       ";
        }

if I'm wrong, Apache makes the assumption (I posted
several months ago without any response in
comp.infosystems.www.servers.unix) in mod_autoindex, mod_speling
(multiple choices) that an href
to "/" is an href to the web server, not true in all cases
the problem is that ServerName checks for a valid DNS entry and
denies a string like "www.polytechnique.fr/eleves" 

any idea?


Bertrand

------------------
Bertrand de Singly
mailto:bertrand.de-singly@cyberdude.com
http://www.polytechnique.fr/eleves/1995/singly/



Re: mod_autoindex, link to the "parent directory" (fwd)

Posted by Marc Slemko <ma...@worldgate.com>.
On Mon, 20 Jul 1998, Rodent of Unusual Size wrote:

> Singly Bertrand de (X1995) wrote:
> > 
> > if I'm wrong, Apache makes the assumption (I posted
> > several months ago without any response in
> > comp.infosystems.www.servers.unix) in mod_autoindex, mod_speling
> > (multiple choices) that an href
> > to "/" is an href to the web server, not true in all cases
> 
> Sorry, it *is* true.  Everything following the hostname, including
> any leading slash, is part of the server's private URI space.

My guess is that he is doing a proxypass type thing on another server.


Re: mod_autoindex, link to the "parent directory" (fwd)

Posted by "Singly Bertrand de (X1995)" <bs...@frankiz.polytechnique.fr>.
> > if I'm wrong, Apache makes the assumption (I posted
> > several months ago without any response in
> > comp.infosystems.www.servers.unix) in mod_autoindex, mod_speling
> > (multiple choices) that an href
> > to "/" is an href to the web server, not true in all cases
> 
> Sorry, it *is* true.  Everything following the hostname, including
> any leading slash, is part of the server's private URI space.
in a proxypassed server (see below) the root URL of the web server is not
given by the hostname:port
that's why I ask to replace the href="/" produced by mod_autoindex with a
ref="../"

I ask to put relative links too in the multiple choices (an example 
if you want http://www.polytechnique.fr/eleves/joindre_eleve.htm
mod_speling returns a single (sic!) multiple choice to
http://www.polytechnique.fr/joindre_eleve.shtml 
because it produces a href="/joindre_eleve.shtml" and not a href to
"joindre_eleve.shtml")

the way to solve it would be to count how many slashes are given in the
URI and to make an href beginning with the string "../" repeated as many
times as necessary instead of using "/", shall I propose a patch ?


> > the problem is that ServerName checks for a valid DNS entry and
> > denies a string like "www.polytechnique.fr/eleves"
> 
> For a very good reason - server names follow the same rules as
> hostnames, and '/' is not a legal character in a DNS name.  If
> you've got something like
yes ... I didn't read it anywhere and Marc's interpretation is the good
one : my server is "proxypassed" by the machine www.polytechnique.fr
however the ProxyPassReverse handles Redirect but does not change web
pages produced by mod_autoindex, mod_speling or others to reflect this
problem; even ServerSignature gives a wrong information (with
UseCanonicalName On or Off)

Bertrand


---
Bertrand de Singly, ingenieur-eleve des ponts (IPC2000)
http://www.enpc.fr/
mailto:bertrand.de-singly@cyberdude.com
http://wwwusers.imaginet.fr/~singly/bertrand/


Re: mod_autoindex, link to the "parent directory" (fwd)

Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
Singly Bertrand de (X1995) wrote:
> 
> if I'm wrong, Apache makes the assumption (I posted
> several months ago without any response in
> comp.infosystems.www.servers.unix) in mod_autoindex, mod_speling
> (multiple choices) that an href
> to "/" is an href to the web server, not true in all cases

Sorry, it *is* true.  Everything following the hostname, including
any leading slash, is part of the server's private URI space.

> the problem is that ServerName checks for a valid DNS entry and
> denies a string like "www.polytechnique.fr/eleves"

For a very good reason - server names follow the same rules as
hostnames, and '/' is not a legal character in a DNS name.  If
you've got something like

	ServerName www.polytechnique.fr/eleves

in your configuration files, it's broken.  From the directive
description:

:ServerName directive
:
:Syntax: ServerName fully-qualified domain name 
:Context: server config, virtual host
:Status: core
:
:The ServerName directive sets the hostname of the server; this is
:only used when creating redirection URLs. If it is not specified,
:then the server attempts to deduce it from its own IP address;
:however this may not work reliably, or may not return the preferred
:hostname.

This behaviour isn't a problem, it's how things are supposed to
work.

Out of curiousity, where did you read that '/' was allowed in
DNS names, or that ServerName was allowed to be anything *but*
a valid DNS name?  Do we have some bogus documentation somewhere?

#ken	P-)}

Ken Coar                    <http://Web.Golux.Com/coar/>
Apache Group member         <http://www.apache.org/>
"Apache Server for Dummies" <http://Web.Golux.Com/coar/ASFD/>