<div dir="ltr"><div><div><div><div><div><div><br><br>On Wed, Jun 15, 2016 at 10:58 AM, Gary Buhrmaster <<a href="mailto:gary.buhrmaster@gmail.com">gary.buhrmaster@gmail.com</a>> wrote:<br>> On Wed, Jun 15, 2016 at 10:22 AM, Stephen Worthington<br>> <<a href="mailto:stephen_agent@jsw.gen.nz">stephen_agent@jsw.gen.nz</a>> wrote:<br>> ....<br>>> I do not know QT at all, and my C++ is also quite rusty.  But when I<br>>> had a look at that code and Googled QNetworkRequest, the thought I had<br>>> was to make the original query have the<br>>> QNetworkRequest::FollowRedirectsAttribute flag, so that it would<br>>> automatically follow any redirects without any further intervention.<br>><br>> Just as an FYI:<br>><br>> According to the docs that attribute was added recently (in Qt 5.6),<br>> and Qt 5.6 is beyond the "minimum supported Qt version" MythTV<br>> supports (which is Qt 5.2).  Adding a requirement to move forward<br>> in the Qt version would have to be negotiated with the devs.<br>> Otherwise, you likely have to implement your own redirection code.<br>><br>> I believe MythDownloadManager supports following redirects,<br>> and moving to the MythTV abstraction might be viable, although<br>> perhaps a larger effort.<br>> _______________________________________________<br>> mythtv-users mailing list<br>> <a href="mailto:mythtv-users@mythtv.org">mythtv-users@mythtv.org</a><br>> <a href="http://lists.mythtv.org/mailman/listinfo/mythtv-users">http://lists.mythtv.org/mailman/listinfo/mythtv-users</a><br>> <a href="http://wiki.mythtv.org/Mailing_List_etiquette">http://wiki.mythtv.org/Mailing_List_etiquette</a><br>> MythTV Forums: <a href="https://forum.mythtv.org">https://forum.mythtv.org</a><br><br><br></div>I hadn't planned on submitting anything for release as this issue seems pretty specific to my IPTV stream provider.<br><br></div>I was able to finally get things working with the following changes:<br><br>--- mythtv-0.28-fixes/mythtv/libs/libmythtv/recorders/httptsstreamhandler.h    2016-06-12 12:30:49.849391706 -0400<br>+++ mythtv-0.28-fixes-IPTV/mythtv/libs/libmythtv/recorders/httptsstreamhandler.h    2016-06-15 12:27:17.523334878 -0400<br>@@ -59,6 +59,7 @@<br>     HTTPTSStreamHandler    *m_parent;<br>     QTimer                  m_timer;<br>     QNetworkAccessManager   m_mgr;<br>+    QNetworkRequest         m_req;<br>     QNetworkReply          *m_reply;<br>     QMutex                  m_lock;<br>     QMutex                  m_replylock;<br><br>--- mythtv-0.28-fixes/mythtv/libs/libmythtv/recorders/httptsstreamhandler.cpp    2016-06-14 19:40:26.402093279 -0400<br>+++ mythtv-0.28-fixes-IPTV/mythtv/libs/libmythtv/recorders/httptsstreamhandler.cpp    2016-06-15 17:32:46.331242516 -0400<br>@@ -145,7 +145,13 @@<br> <br>     // the HTTP request<br>     m_replylock.lock();<br>-    m_reply = m_mgr.get(QNetworkRequest(url));<br>+    m_req = QNetworkRequest(url);<br>+    m_req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);<br>+    m_req.setRawHeader("User-Agent", "Kodi/16.0 (X11; Linux x86_64) Fedora/23 App_Bitness/64 Version/16.0-Git:Unknown");<br>+    m_req.setRawHeader("Accept", "*/*");<br>+    m_req.setRawHeader("Accept-Charset", "UTF-8,*;q=0.8");<br>+    m_req.setRawHeader("Connection", "close"); <br>+    m_reply = m_mgr.get(m_req);<br>     m_replylock.unlock();<br> <br>     connect(&m_timer, SIGNAL(timeout()), &event_loop, SLOT(quit()));<br><br></div>It seems that the request needed to define a user agent other than a web browser before the redirect would happen as well as other modifications to the header data. Once I implemented setAttribute(QNetworkRequest::FollowRedirectsAttribute, true) it worked swimmingly with the redirect.<br><br></div>This patch is pretty specific to someone using IPTVsubs as their provider and I'm sure there is a more robust solution, but it works for me.<br><br></div>Thanks again Stephen for your suggestion regarding using wireshark to monitor the network traffic. That was invaluable to determining the nature of the problem.<br><br></div>Thanks!<br><div><div><div><div><div><div><br></div></div></div></div></div></div></div>