diff --git a/mythtv/libs/libmythbase/msocketdevice.cpp b/mythtv/libs/libmythbase/msocketdevice.cpp
index 76afc03..5f7e7d8 100644
|
a
|
b
|
|
| 42 | 42 | ****************************************************************************/ |
| 43 | 43 | |
| 44 | 44 | #include "msocketdevice.h" |
| | 45 | #include "mythverbose.h" |
| 45 | 46 | |
| 46 | 47 | #include "qwindowdefs.h" |
| 47 | 48 | #include <string.h> |
| … |
… |
MSocketDevice::MSocketDevice( Type type )
|
| 189 | 190 | this, type ); |
| 190 | 191 | #endif |
| 191 | 192 | init(); |
| 192 | | //setSocket( createNewSocket(), type ); |
| | 193 | |
| | 194 | // For the time being, if it's of type Datagram create the socket now |
| | 195 | // rather than later during connect (since there wont be one with udp) |
| | 196 | if (type == Datagram) |
| | 197 | setSocket( createNewSocket(), type ); |
| 193 | 198 | } |
| 194 | 199 | |
| 195 | 200 | /*! |
| … |
… |
quint16 MSocketDevice::port() const
|
| 549 | 554 | */ |
| 550 | 555 | QHostAddress MSocketDevice::address() const |
| 551 | 556 | { |
| 552 | | return a; |
| | 557 | |
| | 558 | QString ipaddress; |
| | 559 | if (a.toString().startsWith("0:0:0:0:0:FFFF:")) |
| | 560 | { |
| | 561 | Q_IPV6ADDR addr = a.toIPv6Address(); |
| | 562 | // addr contains 16 unsigned characters |
| | 563 | |
| | 564 | ipaddress = QString("%1.%2.%3.%4").arg(addr[12]).arg(addr[13]).arg(addr[14]).arg(addr[15]); |
| | 565 | } |
| | 566 | else |
| | 567 | ipaddress = a.toString(); |
| | 568 | |
| | 569 | return QHostAddress(ipaddress); |
| 553 | 570 | } |
| 554 | 571 | |
| 555 | 572 | |
diff --git a/mythtv/libs/libmythupnp/upnpdevice.cpp b/mythtv/libs/libmythupnp/upnpdevice.cpp
index d121dcb..6b49297 100644
|
a
|
b
|
void UPnpDeviceDesc::GetValidXML(
|
| 357 | 357 | QString BaseAddr; |
| 358 | 358 | QHostAddress addr(sBaseAddress); |
| 359 | 359 | |
| | 360 | BaseAddr = sBaseAddress; |
| | 361 | |
| 360 | 362 | #if !defined(QT_NO_IPV6) |
| 361 | 363 | // Basically if it appears to be an IPv6 IP surround the IP with [] otherwise don't bother |
| 362 | | if (( addr.protocol() == QAbstractSocket::IPv6Protocol ) || (sBaseAddress.contains(":"))) |
| | 364 | if (sBaseAddress.contains(":")) |
| 363 | 365 | BaseAddr = "[" + sBaseAddress + "]"; |
| 364 | 366 | else |
| 365 | 367 | #endif |
| 366 | | if ( addr.protocol() == QAbstractSocket::IPv4Protocol ) |
| 367 | | BaseAddr = sBaseAddress; |
| 368 | 368 | |
| 369 | 369 | os << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" |
| 370 | 370 | "<root xmlns=\"urn:schemas-upnp-org:device-1-0\" xmlns:mythtv=\"mythtv.org\">\n" |
diff --git a/mythtv/libs/libmythupnp/upnptasksearch.cpp b/mythtv/libs/libmythupnp/upnptasksearch.cpp
index 20d6d8e..cb7c0d6 100644
|
a
|
b
|
void UPnpSearchTask::SendMsg( MSocketDevice *pSocket,
|
| 108 | 108 | it != m_addressList.end(); |
| 109 | 109 | ++it ) |
| 110 | 110 | { |
| | 111 | QString ipaddress = *it; |
| | 112 | |
| | 113 | // If this looks like an IPv6 address, then enclose it in []'s |
| | 114 | if (ipaddress.contains(":")) |
| | 115 | ipaddress = "[" + ipaddress + "]"; |
| | 116 | |
| 111 | 117 | QString sHeader = QString ( "HTTP/1.1 200 OK\r\n" |
| 112 | | "LOCATION: http://[%1]:%2/getDeviceDesc\r\n" ) |
| 113 | | .arg( *it ) |
| | 118 | "LOCATION: http://%1:%2/getDeviceDesc\r\n" ) |
| | 119 | .arg( ipaddress ) |
| 114 | 120 | .arg( m_nServicePort); |