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
|
| 77 | 77 | "Accept: */*\r\n"); |
| 78 | 78 | |
| 79 | 79 | QString path = url.path(); |
| | 80 | QString host = url.host(); |
| | 81 | |
| | 82 | if (path.isEmpty()) |
| | 83 | path = "/"; |
| | 84 | |
| 80 | 85 | if (url.hasQuery()) |
| 81 | 86 | path += '?' + url.encodedQuery(); |
| 82 | 87 | |
| | 88 | if (url.port() != -1) |
| | 89 | host += QString(":%1").arg(url.port()); |
| | 90 | |
| 83 | 91 | hdr.replace("%PATH%", path); |
| 84 | | hdr.replace("%HOST%", url.host()); |
| | 92 | hdr.replace("%HOST%", host); |
| 85 | 93 | hdr.replace("%VERSION%", MYTH_BINARY_VERSION); |
| 86 | 94 | |
| 87 | 95 | if (!url.userName().isEmpty() && !url.password().isEmpty()) |
| … |
… |
class IceCastRequest
|
| 123 | 131 | "Accept: */*\r\n"); |
| 124 | 132 | |
| 125 | 133 | QString path = url.path(); |
| | 134 | QString host = url.host(); |
| | 135 | |
| | 136 | if (path.isEmpty()) |
| | 137 | path = "/"; |
| | 138 | |
| 126 | 139 | if (url.hasQuery()) |
| 127 | 140 | path += '?' + url.encodedQuery(); |
| 128 | 141 | |
| | 142 | if (url.port() != -1) |
| | 143 | host += QString(":%1").arg(url.port()); |
| | 144 | |
| 129 | 145 | hdr.replace("%PATH%", path); |
| 130 | | hdr.replace("%HOST%", url.host()); |
| | 146 | hdr.replace("%HOST%", host); |
| 131 | 147 | hdr.replace("%VERSION%", MYTH_BINARY_VERSION); |
| 132 | 148 | |
| 133 | 149 | if (!url.userName().isEmpty() && !url.password().isEmpty()) |