dashdemux: accept 2 or 4 digit year when using HTTP HEAD for calculating clock compensation

Convert year from 2 digits to 4 digits in gst_dash_demux_parse_http_head

https://bugzilla.gnome.org/show_bug.cgi?id=759743

Also updated references to Rfc822 to Rfc5322
This commit is contained in:
Florin Apostol 2015-12-21 14:50:15 +00:00 committed by Sebastian Dröge
parent 15a28c8024
commit 09b21eacae

View file

@ -1748,16 +1748,16 @@ gst_dash_demux_poll_ntp_server (GstDashDemuxClockDrift * clock_drift,
return gst_date_time_new_from_g_date_time (dt2); return gst_date_time_new_from_g_date_time (dt2);
} }
struct Rfc822TimeZone struct Rfc5322TimeZone
{ {
const gchar *name; const gchar *name;
gfloat tzoffset; gfloat tzoffset;
}; };
/* /*
Parse an RFC822 (section 5) date-time from the Date: field in the Parse an RFC5322 (section 3.3) date-time from the Date: field in the
HTTP response. HTTP response.
See https://tools.ietf.org/html/rfc822#section-5 See https://tools.ietf.org/html/rfc5322#section-3.3
*/ */
static GstDateTime * static GstDateTime *
gst_dash_demux_parse_http_head (GstDashDemuxClockDrift * clock_drift, gst_dash_demux_parse_http_head (GstDashDemuxClockDrift * clock_drift,
@ -1767,7 +1767,7 @@ gst_dash_demux_parse_http_head (GstDashDemuxClockDrift * clock_drift,
"May", "Jun", "Jul", "Aug", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec", NULL "Sep", "Oct", "Nov", "Dec", NULL
}; };
static const struct Rfc822TimeZone timezones[] = { static const struct Rfc5322TimeZone timezones[] = {
{"Z", 0}, {"Z", 0},
{"UT", 0}, {"UT", 0},
{"GMT", 0}, {"GMT", 0},
@ -1855,6 +1855,9 @@ gst_dash_demux_parse_http_head (GstDashDemuxClockDrift * clock_drift,
} }
} }
} }
/* Accept year in both 2 digit or 4 digit format */
if (year < 100)
year += 2000;
} }
if (month > 0 && parsed_tz) { if (month > 0 && parsed_tz) {
value = gst_date_time_new (tzoffset, value = gst_date_time_new (tzoffset,