Ticket #11214: 0001-mythmusic-Fix-streaming-radio-not-being-able-to-conn.patch

File 0001-mythmusic-Fix-streaming-radio-not-being-able-to-conn.patch, 2.1 KB (added by paulh <mythtv@…>, 8 years ago)
  • mythplugins/mythmusic/mythmusic/shoutcast.cpp

    From 79156ff6bb3877178e0b7ea1284c79641cda1132 Mon Sep 17 00:00:00 2001
    From: Paul Harrison <pharrison@mythtv.org>
    Date: Thu, 1 Nov 2012 21:34:11 +0000
    Subject: [PATCH] mythmusic: Fix streaming radio not being able to connect to
     some streams
    
    This fixes a couple of errors with creating the stream GET request header.
    If the path part of the the URI is empty the HTTP/1.1 spec says it should be
    specified as "/" and not be empty and the Host request-header field should
    contain the port if it is non standard.
    ---
     mythplugins/mythmusic/mythmusic/shoutcast.cpp |   20 ++++++++++++++++++--
     1 files changed, 18 insertions(+), 2 deletions(-)
    
    diff --git a/mythplugins/mythmusic/mythmusic/shoutcast.cpp b/mythplugins/mythmusic/mythmusic/shoutcast.cpp
    index 7aaecc7..2608af8 100644
    a b class ShoutCastRequest 
    7777                      "Accept: */*\r\n");
    7878
    7979        QString path = url.path();
     80        QString host = url.host();
     81
     82        if (path.isEmpty())
     83            path = "/";
     84
    8085        if (url.hasQuery())
    8186            path += '?' + url.encodedQuery();
    8287
     88        if (url.port() != -1)
     89            host += QString(":%1").arg(url.port());
     90
    8391        hdr.replace("%PATH%", path);
    84         hdr.replace("%HOST%", url.host());
     92        hdr.replace("%HOST%", host);
    8593        hdr.replace("%VERSION%", MYTH_BINARY_VERSION);
    8694
    8795        if (!url.userName().isEmpty() && !url.password().isEmpty())
    class IceCastRequest 
    123131                      "Accept: */*\r\n");
    124132
    125133        QString path = url.path();
     134        QString host = url.host();
     135
     136        if (path.isEmpty())
     137            path = "/";
     138
    126139        if (url.hasQuery())
    127140            path += '?' + url.encodedQuery();
    128141
     142        if (url.port() != -1)
     143            host += QString(":%1").arg(url.port());
     144
    129145        hdr.replace("%PATH%", path);
    130         hdr.replace("%HOST%", url.host());
     146        hdr.replace("%HOST%", host);
    131147        hdr.replace("%VERSION%", MYTH_BINARY_VERSION);
    132148
    133149        if (!url.userName().isEmpty() && !url.password().isEmpty())