Ticket #4920: upnp.patch

File upnp.patch, 1.3 KB (added by jeff@…, 12 years ago)

Patch to fix issue with escaping characters in UPNP responses.

  • libs/libmythupnp/httprequest.cpp

    diff -Naur ./mythtv-new/libs/libmythupnp/httprequest.cpp ./mythtv/libs/libmythupnp/httprequest.cpp
    old new  
    11271127QString &HTTPRequest::Encode( QString &sStr )
    11281128{
    11291129    //VERBOSE(VB_UPNP, QString("HTTPRequest::Encode Input : %1").arg(sStr));
    1130     sStr.replace(QRegExp( "&"), "&" ); // This _must_ come first
     1130    sStr.replace(QRegExp( "&(?!(amp|lt|gt|quot|apos);)"), "&" ); // This _must_ come first
    11311131    sStr.replace(QRegExp( "<"), "&lt;"  );
    11321132    sStr.replace(QRegExp( ">"), "&gt;"  );
    11331133    sStr.replace(QRegExp("\""), "&quot;");
  • libs/libmythupnp/upnpcds.cpp

    diff -Naur ./mythtv-new/libs/libmythupnp/upnpcds.cpp ./mythtv/libs/libmythupnp/upnpcds.cpp
    old new  
    864864
    865865            QStringMap  mapParams;
    866866            QString     sParams = idPath.last().section( '?', 1, 1 );
    867             sParams.replace(QRegExp( "&amp;"), "&" );
     867            sParams.replace(QRegExp( "&(?!(amp|lt|gt|quot|apos);)"), "&amp;" );
    868868
    869869            HTTPRequest::GetParameters( sParams, mapParams );
    870870