rtsp: weekday and month names in RTSP date string should be in C locale

Create date string using C locale weekday and month names.

Fixes #617636.
This commit is contained in:
Tim-Philipp Müller 2010-05-04 15:32:59 +01:00
parent f99cb8b9bd
commit 7fee2c0fe7

View file

@ -1022,20 +1022,26 @@ add_auth_header (GstRTSPConnection * conn, GstRTSPMessage * message)
static void static void
gen_date_string (gchar * date_string, guint len) gen_date_string (gchar * date_string, guint len)
{ {
GTimeVal tv; static const char wkdays[7][4] =
{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
static const char months[12][4] =
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
"Nov", "Dec"
};
struct tm tm;
time_t t; time_t t;
#ifdef HAVE_GMTIME_R
struct tm tm_;
#endif
g_get_current_time (&tv); time (&t);
t = (time_t) tv.tv_sec;
#ifdef HAVE_GMTIME_R #ifdef HAVE_GMTIME_R
strftime (date_string, len, "%a, %d %b %Y %H:%M:%S GMT", gmtime_r (&t, &tm_)); gmtime_r (&t, &tm);
#else #else
strftime (date_string, len, "%a, %d %b %Y %H:%M:%S GMT", gmtime (&t)); tm = *gmtime (&t);
#endif #endif
g_snprintf (date_string, len, "%s, %02d %s %04d %02d:%02d:%02d GMT",
wkdays[tm.tm_wday], tm.tm_mday, months[tm.tm_mon], tm.tm_year + 1900,
tm.tm_hour, tm.tm_min, tm.tm_sec);
} }
static GstRTSPResult static GstRTSPResult