Opened 16 years ago
Closed 15 years ago
#5435 closed patch (invalid)
Incorrect Escaping of '&' in UPNP Requests
Reported by: | Owned by: | Nigel | |
---|---|---|---|
Priority: | minor | Milestone: | unknown |
Component: | upnp | Version: | head |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
I was seeing this quite often in the debugging output from Mythbackend:
2008-06-07 14:35:48.531 HTTPRequest::Encode Input : RecTv?/0/item?ChanId?=1249&StartTime?=2008-04-23T22:00:00 2008-06-07 14:35:48.536 HTTPRequest::Encode Output : RecTv?/0/item?ChanId?=1249&StartTime?=2008-04-23T22:00:00 2008-06-07 14:35:48.622 HTTPRequest::Encode Input : RecTv?/1/key=South Park/item?ChanId??=1249amp;StartTime?=2008-04-16T22:00:00 2008-06-07 14:35:48.626 HTTPRequest::Encode Output : RecTv?/1/key=South Park/item?ChanId?=1249&StartTime?=2008-04-16T22:00:00 2008-06-07 14:35:48.650 HTTPRequest::Encode Input : RecTv?/0/item?ChanId?=1249&StartTime?=2008-04-16T22:00:00 2008-06-07 14:35:48.654 HTTPRequest::Encode Output : RecTv?/0/item?ChanId?=1249&StartTime?=2008-04-16T22:00:00
It seems like the HTTPRequest::Encode routing is getting called multiple times for the same string, and because of this, the ampersand in the escaped output was getting re-escaped.
This patch was made against MythTV 0.21p17416.
Attachments (1)
Change History (10)
Changed 16 years ago by
Attachment: | upnp.patch added |
---|
comment:1 Changed 16 years ago by
Owner: | changed from dblain to stuartm |
---|---|
Status: | new → accepted |
comment:2 Changed 16 years ago by
Status: | accepted → started |
---|
comment:3 Changed 16 years ago by
Resolution: | → fixed |
---|---|
Status: | started → closed |
comment:4 Changed 15 years ago by
Resolution: | fixed |
---|---|
Status: | closed → new |
It seems there is a side effect from this patch. On some UPnP clients, the Recordings->All Recordings page does not appear (i.e. it probbaly has errors). Strangely, on some clients, browsing other pages first allows the All Recordings page to display. Very strange.
comment:5 Changed 15 years ago by
Milestone: | 0.21.1 → unknown |
---|---|
Owner: | changed from stuartm to Nigel |
Status: | new → assigned |
Version: | 0.21-fixes → head |
comment:6 Changed 15 years ago by
It wasn't a side-effect, the RegExp? in the patch just doesn't work, but the clients sometimes cache old data so it wasn't happening all the time. Here is the test program I used to experiment:
#include <QApplication> #include <QRegExp> #include <QString> int main(int argc, char *argv[]) { QApplication a(argc, argv); QString data = "blah, blah & blah\n" "Nigel's\n" "Error&Error\n" "Don't wrap. "; QRegExp entities("^(quot|amp|apos|lt|gt|nbsp" "|#\\d\\d\\d\\d|#x[0-F][0-F][0-F][0-F]|);"); qWarning("\tString..."); qWarning(qPrintable(data)); int pos = data.indexOf('&'); while (pos >= 0) { QString afterAmp = data.mid(++pos); if (data.mid(++pos).contains(entities)) { qWarning("ENTITY contained in "); qWarning(qPrintable(afterAmp)) } else data.insert(pos, "amp;"); pos = data.indexOf('&', pos); // Find next & } qWarning("\tbecomes.."); qWarning(qPrintable(data)); }
Fix Escaping of '&' in UPNP Requests