[Xitami] Emulating Apache directories
Francis Turner
xitami@lists.xitami.org
Wed, 12 Dec 2001 14:05:29 +0100
Ewen McNeill wrote:
>You are right that smthttpl.c:http_list_directory() is what is creating
>the directory (as an XML tree). One of the things that it should also
>add to the XML is the path to the actual directory on disk, since it
>obviously needs to know this while it is preparing the list of files,
>and it would be useful to the GSL script outputting the directory. The
>directory path is, I think, in p_http-> file_name, so adding an
>attribute with that value into the top level of the XML would be useful,
>called perhaps "path_on_disk".
>
>Ewen
>
OK so I inserted 2 lines at line 2113.
Old code
/* Create root XML
item */
root_item = xml_new (NULL, "directory", "");
/* Now transform directory listing into an XML
tree */
total_files = 0;
total_size = 0;
New code
/* Create root XML
item */
root_item = xml_new (NULL, "directory", "");
/* Output path to directory for GSL scripts */
xml_put_attr (root_item, "physical_path", p_http-> file_name);
/* Now transform directory listing into an XML
tree */
total_files = 0;
total_size = 0;
This works fine and allows GSL directory scripts to search for README or
similar.
It doesn't matter but it is important to note that you will not get the
absoluet path of non-aliased directories, just the directory relative to
the xitami base directory. I.e. you get webpage/images/ for the images
directory in a default config. Since GSL doesn't seem to have a command
to list the current working directory (e.g. /usr/local/xitami or
/opt/xitami) you cannot infer from this variable where the xitami server
is located on the file system. This seems to me to be excellent security
as I can't see why you would need it but it should be noted for future
reference.
However in testing this it seems that you cannot have an alias like
relative = ../relative/ whereas rel = ./rel does work and the directory
given for GSL is rel/
This could possibly be another bug?
Francis
--
"Education is when you read the fine print;
experience is what you get when you don't." Pete Seeger