Opened 7 years ago
Closed 4 years ago
#13340 closed Bug Report - General (Trac EOL)
Locale dependent dates in HTTP response
| Reported by: | pmhahn | Owned by: | cpinkham |
|---|---|---|---|
| Priority: | minor | Milestone: | needs_triage |
| Component: | MythTV - HTTP Streaming | Version: | v29-fixes |
| Severity: | medium | Keywords: | locale, http |
| Cc: | Ticket locked: | no |
Description
I downloaded a recording and wget complained about a wrong date format:
$ wget --content-disposition http://barrel.fritz.box:6544/Content/GetRecording?RecordedId=3756 ... »Last-modified«-Kopfzeile ungültig -- Zeitstempel übergangen.
Using curl the dates indeed use my German locale:
$ curl -I http://barrel.fritz.box:6544/Content/GetRecording?RecordedId=3756 ... Date: Sa., 27 Okt. 2018 08:33:56 GMT Last-Modified: Mo., 15 Okt. 2018 16:46:24 GMT Server: MythTV/29.1-9-gd9d702526b-dirty Linux/4.9.0-8-amd64 UPnP/1.0
mythtv/mythtv/libs/libmythupnp/httprequest.cpp uses MythDate::kRFC822, which uses my current locale instead of always using en_US.
Change History (2)
Note:
See TracTickets
for help on using tickets.

Trac reports an error when trying to attach the patch as a file, so here it is inline:
From aeda77dbd522caebab2715706f08b00ef1d0b312 Mon Sep 17 00:00:00 2001 From: Philipp Matthias Hahn <pmhahn+mythtv@pmhahn.de> Date: Sun, 28 Oct 2018 20:45:59 +0100 Subject: [PATCH] mythbase: Fix RFC 822 Date Formatting To: mythtv-dev@mythtv.org The RFC 822 date format should always use en_US locale for month and day names instead of whatever the system locale is. --- mythtv/libs/libmythbase/mythdate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mythtv/libs/libmythbase/mythdate.cpp b/mythtv/libs/libmythbase/mythdate.cpp index 2e0f59de28..87cf899c91 100644 --- a/mythtv/libs/libmythbase/mythdate.cpp +++ b/mythtv/libs/libmythbase/mythdate.cpp @@ -93,7 +93,7 @@ QString toString(const QDateTime &raw_dt, uint format) return datetime.toString(Qt::ISODate); if (format & MythDate::kRFC822) // RFC 822 - RFC 7231 Sect 7.1.1.1 - HTTP Date - return datetime.toUTC().toString("ddd, dd MMM yyyy hh:mm:ss").append(" GMT"); + return QLocale::c().toString(datetime.toUTC(), QStringLiteral("ddd, dd MMM yyyy hh:mm:ss")).append(" GMT"); if (format & kFilename) return datetime.toString("yyyyMMddhhmmss"); -- 2.19.1