Ticket #8634: mythplugins-mythvideo-8634-handle_301_redirects.patch

File mythplugins-mythvideo-8634-handle_301_redirects.patch, 1.3 KB (added by mdean, 19 months ago)

Cleaned up version of anonymous's patch that's not corrupted by wiki formatting

  • mythvideo/mythvideo/videodlg.cpp

    ---
     mythvideo/mythvideo/videodlg.cpp |    9 	7 +	2 -	0 !
     1 file changed, 7 insertions(+), 2 deletions(-)
    
    old new namespace 
    137137      public slots: 
    138138        void InspectHeader(const QHttpResponseHeader &header) 
    139139        { 
    140             if (header.statusCode() == 302) 
     140            if (header.statusCode() == 302 || header.statusCode() == 301) 
    141141            { 
    142                 QString m_redirectUrl = header.value("Location"); 
     142                QString redirectUrl = header.value("Location"); 
     143                int iPos = redirectUrl.indexOf(":80"); 
     144                if(iPos != -1) 
     145                    redirectUrl.remove(iPos,3); 
     146                m_redirectUrl = redirectUrl; 
    143147                m_redirectCount++; 
    144148            } 
    145149            else if (header.statusCode() == 404) 
    namespace 
    186190            if (!m_redirectUrl.isEmpty() && m_redirectCount <= 8) 
    187191            { 
    188192                m_url.setUrl(m_redirectUrl); 
     193                m_http.setHost(m_url.host()); 
    189194                m_data_buffer.reset(); 
    190195                StartCopy(); 
    191196                return;