Great! I was actually thinking that it would be much easier in this
particular case to avoid strftime, since all of the variability in the
format is removed. It is huge overkill, and obviously broken in
non-english languages. 

tom jackson

On Tue, 2009-05-12 at 20:36 +0400, Alexey Pechnikov wrote:
> Hello!
> 
> I'm sorry but the problem is produced by patch for non-english locale. 
> This patch use wrong format string:
> snprintf(buf, 40, "%s, %d %s %d %02d:%02d:%02d GMT",
> 
> I did fix the bug and I'm think this patch may be added to upstream.
> 
> Patch is here:
> http://mobigroup.ru/files/aol4.5.1/httptime.c.diff
> 
> Thanks for help!
> 
> =====================
> --- httptime.c.orig     2003-01-18 22:24:20.000000000 +0300
> +++ httptime.c  2009-05-12 20:14:24.000000000 +0400
> @@ -27,6 +27,9 @@
>   * version of this file under either the License or the GPL.
>   */
> 
> +static char *weekdays_names[7] =
> +{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
> +
> 
>  /*
>   * time.c --
> @@ -92,11 +95,14 @@
>      }
> 
>      /*
> -     * This will most likely break if the locale is not an english one.
> +     * Using snprintf instead of strftime to always use english names
>       * The format is RFC 1123: "Sun, 06 Nov 1997 09:12:45 GMT"
>       */
> 
> -    strftime(buf, 40, "%a, %d %b %Y %H:%M:%S GMT", tmPtr);
> +    snprintf(buf, 40, "%s, %02d %s %d %02d:%02d:%02d GMT",
> +    weekdays_names[tmPtr->tm_wday], tmPtr->tm_mday,
> +    month_names[tmPtr->tm_mon], tmPtr->tm_year + 1900,
> +    tmPtr->tm_hour, tmPtr->tm_min, tmPtr->tm_sec);
> 
>      Ns_DStringAppend(pds, buf);
>      return pds->string;
> 
> 
> Best regards, Alexey Pechnikov.
> http://pechnikov.tel/
> 
> 
> --
> AOLserver - http://www.aolserver.com/
> 
> To Remove yourself from this list, simply send an email to 
> <[email protected]> with the
> body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
> field of your email blank.
> 


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to 
<[email protected]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to