You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Dedeco Balaco <de...@yahoo.com.INVALID> on 2018/05/17 19:46:00 UTC

[users@httpd] (rewritten) In directory pages, how to show file dates in a specific timezone?

Hello,

I could not find a way to show file listing pages (generated by Apache) 
with times in the correct timezone. The timezone is defined in the 
environment, but Apache refuses to take it into account (assuming that 
what I set it what should be set).

To detail the situation a bit more: a Debian 9 server with Apache 2.4; a 
normal user account; a working ~/public_html folder for public web content.

Dates and times are correctly shown in SSH accesses to the server, made 
by me. Although the server is in a different timezone, the command ls 
(and others) use the TZ variable where timezone is needed, showing times 
as if here. This is not related to Apache, but seem important (to 
compare). If the server uses Bios times or anything, it does not matter 
(my guess), since we can choose our timezone as needed, with the TZ 
environment variable.

For the system I shortly defined, imagine these steps:

1. Access the server with SSH

2. Create a new folder in ~/public_html with the command:

     mkdir ~/public_html/nf

3. Create one file in that folder with the command

     echo "arquivo" > ~/public_html/nf/arquivo.txt

4. Show that folder content (one file) to someone, with the public URL:

     http://user.server.fi/nf

     This page will be created by Apache 2.4. But it shows time in 
server's clock (or timezone, I am not sure, and it should not matter, I 
think, as long as it consider the timezone I want, somehow).

My user environment has the variable TZ set to my timezone, as said. We 
can confirm that exists in the web environment for each user, using 
phpinfo() function in any served PHP script.

Since Apache does not seem to consider the TZ variable to choose the 
timezone to show file metadata, how should I do it?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] (rewritten) In directory pages, how to show file dates in a specific timezone?

Posted by Herb Burnswell <he...@gmail.com>.
Sorry - My mistake, please disregard.

On Thu, Jun 14, 2018 at 11:39 AM, Eric Covener <co...@gmail.com> wrote:

> On Thu, Jun 14, 2018 at 2:03 PM Herb Burnswell
> <he...@gmail.com> wrote:
> >
> > Community,
> >
> > Is this issue that I'm struggling with really that large of a
> challenge?  If it is, that's fine, I'm trying to judge if it's something
> that I should abandon or if it can be done at all..
>
> Looks like you replied to a thread about someone elses issue entirely.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] (rewritten) In directory pages, how to show file dates in a specific timezone?

Posted by Eric Covener <co...@gmail.com>.
On Thu, Jun 14, 2018 at 2:03 PM Herb Burnswell
<he...@gmail.com> wrote:
>
> Community,
>
> Is this issue that I'm struggling with really that large of a challenge?  If it is, that's fine, I'm trying to judge if it's something that I should abandon or if it can be done at all..

Looks like you replied to a thread about someone elses issue entirely.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] (rewritten) In directory pages, how to show file dates in a specific timezone?

Posted by Herb Burnswell <he...@gmail.com>.
Community,

Is this issue that I'm struggling with really that large of a challenge?
If it is, that's fine, I'm trying to judge if it's something that I should
abandon or if it can be done at all..

Thanks,

HB

On Thu, Jun 14, 2018 at 10:25 AM, Yann Ylavic <yl...@gmail.com> wrote:

> On Thu, Jun 14, 2018 at 12:08 AM, Dedeco Balaco
> <de...@yahoo.com.invalid> wrote:
> >
> > Em 13-06-2018 17:29, Yann Ylavic escreveu:
> >>
> >> The date format used by mod_autoindex is hardcoded, and does not
> >> include the timezone (%z or %Z in strftime format).
> >> I think a patch is needed to eventually configure it (e.g. another
> >> IndexOptions keyword).
> >>
> >
> > Being hardcoded is bad.
>
> Not so until someone notices ;)
>
> > Should I consider this as a bug and report it?
>
> I'd call it an improvement request, bugzilla can be used for that yes.
>
> >
> > The thread in LinuxQuestions.org I pointed has a basic code that I can
> use
> > to make some PHP code to list what I need. If that is not the better
> > solution, at least for something temporary, please point.
>
> Possibly the easiest/fastest solution, because (see below)...
>
> >
> > Taking the code from Apache's mod_autoindex, fixing and running the new
> code
> > for my user is something easy to do? Will it need to be installed by
> root?
> > Making it available for other users in the server is not needed, not
> > necessary.
>
> This needs mod_autoindex to be recompiled and installed in the httpd
> directory (with whatever rights that may require).
> If you can't do this, the PHP solution might be what you need for now.
>
> Regards,
> Yann.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] Re: (rewritten) In directory pages, how to show file dates in a specific timezone?

Posted by Yann Ylavic <yl...@gmail.com>.
On Thu, Jun 21, 2018 at 10:39 PM, Christophe Jaillet
<ch...@wanadoo.fr> wrote:
>
> If IndexDateFormat is not defined, the date format will still be "%Y-%m-%d
> %H:%M" or "%d-%b-%Y %H:%M" depending on the use or not of IndexOptions
> UseOldDateFormat.

Side note, the expected format conforms to:
http://man7.org/linux/man-pages/man3/strftime.3.html

Regards,
Yann.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: (rewritten) In directory pages, how to show file dates in a specific timezone?

Posted by Christophe Jaillet <ch...@wanadoo.fr>.
Le 21/06/2018 à 20:31, Dedeco Balaco a écrit :
> 
> 
> Em 14-06-2018 14:25, Yann Ylavic escreveu:
>> On Thu, Jun 14, 2018 at 12:08 AM, Dedeco Balaco
>> <de...@yahoo.com.invalid> wrote:
>>>
>>> Em 13-06-2018 17:29, Yann Ylavic escreveu:
>>>>
>>>> The date format used by mod_autoindex is hardcoded, and does not
>>>> include the timezone (%z or %Z in strftime format).
>>>> I think a patch is needed to eventually configure it (e.g. another
>>>> IndexOptions keyword).
>>>>
>>>
>>> Being hardcoded is bad.
>>
>> Not so until someone notices ;)
>>
>>> Should I consider this as a bug and report it?
>>
>> I'd call it an improvement request, bugzilla can be used for that yes.
>>
>>>
>>> The thread in LinuxQuestions.org I pointed has a basic code that I 
>>> can use
>>> to make some PHP code to list what I need. If that is not the better
>>> solution, at least for something temporary, please point.
>>
>> Possibly the easiest/fastest solution, because (see below)...
>>
>>>
>>> Taking the code from Apache's mod_autoindex, fixing and running the 
>>> new code
>>> for my user is something easy to do? Will it need to be installed by 
>>> root?
>>> Making it available for other users in the server is not needed, not
>>> necessary.
>>
>> This needs mod_autoindex to be recompiled and installed in the httpd
>> directory (with whatever rights that may require).
>> If you can't do this, the PHP solution might be what you need for now.
>>
> 
> I will check that now.
> 
> I imagined if a "to my user only" solution was possible. Compiling 
> should not be a problem, or hard at all; installing it in my user folder 
> is natural; to test it should be a matter of Apache config of any 
> directory I create for that, possibly with a different (possibly 
> uncommon) setting. The last part is exactly where I would need some help.
> 
> Thank you for all details you commented, Yann. Each of them have added 
> information for me. Thanks to others who also replied.

If you can try, I think that applying the following patch should work 
for you:

Index: modules/generators/mod_autoindex.c
===================================================================
--- modules/generators/mod_autoindex.c	(révision 1833939)
+++ modules/generators/mod_autoindex.c	(copie de travail)
@@ -608,6 +608,9 @@
      AP_INIT_TAKE1("IndexHeadInsert", ap_set_string_slot,
                    (void *)APR_OFFSETOF(autoindex_config_rec, head_insert),
                    DIR_CMD_PERMS, "String to insert in HTML HEAD section"),
+    AP_INIT_TAKE1("IndexDateFormat", ap_set_string_slot,
+                  (void *)APR_OFFSETOF(autoindex_config_rec, 
datetime_format),
+                  DIR_CMD_PERMS, "Format sting to be used "),
      {NULL}
  };



Everything looks already in place to override the date format. I think 
that only defining a new IndexDateFormat directive in order to 
initialize the already available 'datetime_format' variable is enough.

If IndexDateFormat is not defined, the date format will still be 
"%Y-%m-%d %H:%M" or "%d-%b-%Y %H:%M" depending on the use or not of 
IndexOptions UseOldDateFormat.


If you can try and give a feedback, this could be added in a future release.

CJ


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] (rewritten) In directory pages, how to show file dates in a specific timezone?

Posted by Dedeco Balaco <de...@yahoo.com.INVALID>.

Em 14-06-2018 14:25, Yann Ylavic escreveu:
> On Thu, Jun 14, 2018 at 12:08 AM, Dedeco Balaco
> <de...@yahoo.com.invalid> wrote:
>>
>> Em 13-06-2018 17:29, Yann Ylavic escreveu:
>>>
>>> The date format used by mod_autoindex is hardcoded, and does not
>>> include the timezone (%z or %Z in strftime format).
>>> I think a patch is needed to eventually configure it (e.g. another
>>> IndexOptions keyword).
>>>
>>
>> Being hardcoded is bad.
>
> Not so until someone notices ;)
>
>> Should I consider this as a bug and report it?
>
> I'd call it an improvement request, bugzilla can be used for that yes.
>
>>
>> The thread in LinuxQuestions.org I pointed has a basic code that I can use
>> to make some PHP code to list what I need. If that is not the better
>> solution, at least for something temporary, please point.
>
> Possibly the easiest/fastest solution, because (see below)...
>
>>
>> Taking the code from Apache's mod_autoindex, fixing and running the new code
>> for my user is something easy to do? Will it need to be installed by root?
>> Making it available for other users in the server is not needed, not
>> necessary.
>
> This needs mod_autoindex to be recompiled and installed in the httpd
> directory (with whatever rights that may require).
> If you can't do this, the PHP solution might be what you need for now.
>

I will check that now.

I imagined if a "to my user only" solution was possible. Compiling 
should not be a problem, or hard at all; installing it in my user folder 
is natural; to test it should be a matter of Apache config of any 
directory I create for that, possibly with a different (possibly 
uncommon) setting. The last part is exactly where I would need some help.

Thank you for all details you commented, Yann. Each of them have added 
information for me. Thanks to others who also replied.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] (rewritten) In directory pages, how to show file dates in a specific timezone?

Posted by Yann Ylavic <yl...@gmail.com>.
On Thu, Jun 14, 2018 at 12:08 AM, Dedeco Balaco
<de...@yahoo.com.invalid> wrote:
>
> Em 13-06-2018 17:29, Yann Ylavic escreveu:
>>
>> The date format used by mod_autoindex is hardcoded, and does not
>> include the timezone (%z or %Z in strftime format).
>> I think a patch is needed to eventually configure it (e.g. another
>> IndexOptions keyword).
>>
>
> Being hardcoded is bad.

Not so until someone notices ;)

> Should I consider this as a bug and report it?

I'd call it an improvement request, bugzilla can be used for that yes.

>
> The thread in LinuxQuestions.org I pointed has a basic code that I can use
> to make some PHP code to list what I need. If that is not the better
> solution, at least for something temporary, please point.

Possibly the easiest/fastest solution, because (see below)...

>
> Taking the code from Apache's mod_autoindex, fixing and running the new code
> for my user is something easy to do? Will it need to be installed by root?
> Making it available for other users in the server is not needed, not
> necessary.

This needs mod_autoindex to be recompiled and installed in the httpd
directory (with whatever rights that may require).
If you can't do this, the PHP solution might be what you need for now.

Regards,
Yann.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] (rewritten) In directory pages, how to show file dates in a specific timezone?

Posted by Dedeco Balaco <de...@yahoo.com.INVALID>.
Em 13-06-2018 17:29, Yann Ylavic escreveu:
> On Wed, Jun 13, 2018 at 9:26 PM, Dedeco Balaco
> <de...@yahoo.com.invalid> wrote:
>> Is my question outside the scope of this list?
>
> Not really, though after a quick look at the code it seems that there
> is no "configurable" solution, maybe that's an explanation (not an
> excuse) :/
>

That is an explanation indeed, Yann. But what was said before was not 
this. So I was assuming there was a way to fix it, and waited for 
answers from the list.

I can give more information about the hardware and OS. But before I said 
everything I thought could be needed: normal user, Debian 9, Apache 2.4, 
environment accessed by SSH shows every date in the correct timezone, 
set with TZ variable.


>>> I could not find a way to show file listing pages (generated by Apache)
>>> with times in the correct timezone. The timezone is defined in the
>>> environment, but Apache refuses to take it into account (assuming that
>>> what I set it what should be set).
>
> The date format used by mod_autoindex is hardcoded, and does not
> include the timezone (%z or %Z in strftime format).
> I think a patch is needed to eventually configure it (e.g. another
> IndexOptions keyword).
>

Being hardcoded is bad. Should I consider this as a bug and report it?

The thread in LinuxQuestions.org I pointed has a basic code that I can 
use to make some PHP code to list what I need. If that is not the better 
solution, at least for something temporary, please point.

Taking the code from Apache's mod_autoindex, fixing and running the new 
code for my user is something easy to do? Will it need to be installed 
by root? Making it available for other users in the server is not 
needed, not necessary.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] (rewritten) In directory pages, how to show file dates in a specific timezone?

Posted by Yann Ylavic <yl...@gmail.com>.
On Wed, Jun 13, 2018 at 9:26 PM, Dedeco Balaco
<de...@yahoo.com.invalid> wrote:
> Is my question outside the scope of this list?

Not really, though after a quick look at the code it seems that there
is no "configurable" solution, maybe that's an explanation (not an
excuse) :/

>>
>> I could not find a way to show file listing pages (generated by Apache)
>> with times in the correct timezone. The timezone is defined in the
>> environment, but Apache refuses to take it into account (assuming that
>> what I set it what should be set).

The date format used by mod_autoindex is hardcoded, and does not
include the timezone (%z or %Z in strftime format).
I think a patch is needed to eventually configure it (e.g. another
IndexOptions keyword).

Regards,
Yann.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] (rewritten) In directory pages, how to show file dates in a specific timezone?

Posted by Dedeco Balaco <de...@yahoo.com.INVALID>.
Is my question outside the scope of this list?

Does my question needs to explain more details about my problem?

It has been waiting some help for almost 30 days, which seem to be 
unusual in this list. In this time, I have seen several questions being 
immediately or very quickly answered, which make me wonder what is wrong 
with mine.


Em 17-05-2018 16:46, Dedeco Balaco escreveu:
> Hello,
>
> I could not find a way to show file listing pages (generated by Apache)
> with times in the correct timezone. The timezone is defined in the
> environment, but Apache refuses to take it into account (assuming that
> what I set it what should be set).
>
> To detail the situation a bit more: a Debian 9 server with Apache 2.4; a
> normal user account; a working ~/public_html folder for public web content.
>
> Dates and times are correctly shown in SSH accesses to the server, made
> by me. Although the server is in a different timezone, the command ls
> (and others) use the TZ variable where timezone is needed, showing times
> as if here. This is not related to Apache, but seem important (to
> compare). If the server uses Bios times or anything, it does not matter
> (my guess), since we can choose our timezone as needed, with the TZ
> environment variable.
>
> For the system I shortly defined, imagine these steps:
>
> 1. Access the server with SSH
>
> 2. Create a new folder in ~/public_html with the command:
>
>     mkdir ~/public_html/nf
>
> 3. Create one file in that folder with the command
>
>     echo "arquivo" > ~/public_html/nf/arquivo.txt
>
> 4. Show that folder content (one file) to someone, with the public URL:
>
>     http://user.server.fi/nf
>
>     This page will be created by Apache 2.4. But it shows time in
> server's clock (or timezone, I am not sure, and it should not matter, I
> think, as long as it consider the timezone I want, somehow).
>
> My user environment has the variable TZ set to my timezone, as said. We
> can confirm that exists in the web environment for each user, using
> phpinfo() function in any served PHP script.
>
> Since Apache does not seem to consider the TZ variable to choose the
> timezone to show file metadata, how should I do it?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org