Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#107 New symbol support in template for GNU date(1) like output

closed-accepted
Fabian Keil
5
2008-08-31
2008-07-24
Endre Szabo
No

I have made a new function into cgi.c that can be used to generate a GNU date(1) like locale dependant time string for inclusion in errorpage templates with the @time@ symbol.
I use it to emulate an other proxy solution's error pages i've changed from to privoxy, so user's can't see the diference.

Discussion

1 2 > >> (Page 1 of 2)
  • Endre Szabo
    Endre Szabo
    2008-07-24

    Logged In: YES
    user_id=2156896
    Originator: YES

    File Added: cgi-c-get_locale_time.patch

     
  • Endre Szabo
    Endre Szabo
    2008-07-24

    the new function in cgi.c and also some changes in default_exports

     
  • Fabian Keil
    Fabian Keil
    2008-07-25

    • assigned_to: nobody --> fabiankeil
    • status: open --> pending
     
  • Fabian Keil
    Fabian Keil
    2008-07-25

    Logged In: YES
    user_id=875547
    Originator: NO

    Thanks for the patch, I'll have a closer look at it
    once the next stable release is out. I already have
    a few comments though:

    1) Why do you specifically mention GNU date(1)?
    While it has some non-standard extensions,
    it's not clear to me why they would be relevant here.

    2) Currently you are passing get_locale_time() a buf[30],
    but then go ahead and call strftime(buf, 32, ...).

    I would really prefer it, if get_locale_time() would
    get a second parameter for the buffer size, that is then
    simply forwarded to strftime().

    3) What is the point of the unconditional block
    in get_locale_time()? It seems to cause unnecessary
    indentation without providing any benefit.

    4) The comment in get_locale_time() talks about
    snprintf(). Do you mean strftime()?

    5) I think get_locale_time() should be static.

     
  • Endre Szabo
    Endre Szabo
    2008-07-25

    • status: pending --> open
     
  • Endre Szabo
    Endre Szabo
    2008-07-25

    Logged In: YES
    user_id=2156896
    Originator: YES

    You are right, I've forgot to mention that I don't know C but only a little bit. I mean, I can do a helloworld on my own but nothing really more, that's why I did a lot of mistakes. The function in question is basically a copy of the function above (get_http_time) where snprintf was in use.
    I mentioned the GNU date because I did not find any ISO of RFC standard for this specific "Sat Jul 26 00:46:18 CEST 2008" format.

     
  • Endre Szabo
    Endre Szabo
    2008-07-25

    Logged In: YES
    user_id=2156896
    Originator: YES

    Uhoh, did I just reopen this ticket accidentally?

     
  • Fabian Keil
    Fabian Keil
    2008-07-26

    Logged In: YES
    user_id=875547
    Originator: NO

    According to my man page, date(1) is standardized
    in IEEE Std 1003.2 (POSIX.2).

    The few issues in your patch aren't a problem,
    I'll take care of them before committing it.

    The status change to open is done automatically.

     
  • Fabian Keil
    Fabian Keil
    2008-07-26

    • status: open --> open-accepted
     
  • Fabian Keil
    Fabian Keil
    2008-08-31

    • status: open-accepted --> closed-accepted
     
1 2 > >> (Page 1 of 2)