Commit bb8d2b9e authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Fix the '@' disappearance in UDP addresses.

parent 5f9af46a
...@@ -452,11 +452,15 @@ void NetOpenPanel::updateProtocol( int idx ) { ...@@ -452,11 +452,15 @@ void NetOpenPanel::updateProtocol( int idx ) {
void NetOpenPanel::updateMRL() { void NetOpenPanel::updateMRL() {
QString mrl = ""; QString mrl = "";
QString addr = ui.addressText->text(); QString addr = ui.addressText->text();
addr = QUrl::toPercentEncoding( addr, ":/?#@!$&'()*+,;=" );
int proto = ui.protocolCombo->currentIndex(); int proto = ui.protocolCombo->currentIndex();
if( addr.contains( "://") && proto != 5 ) { if( addr.contains( "://") && ( proto != 5 || proto != 6 ) )
{
mrl = addr; mrl = addr;
} else { }
else
{
switch( proto ) { switch( proto ) {
case 0: case 0:
mrl = "http://" + addr; mrl = "http://" + addr;
...@@ -480,7 +484,8 @@ void NetOpenPanel::updateMRL() { ...@@ -480,7 +484,8 @@ void NetOpenPanel::updateMRL() {
break; break;
case 5: case 5:
mrl = "udp://@"; mrl = "udp://@";
if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() ) { if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() )
{
mrl += "[::]"; mrl += "[::]";
} }
mrl += QString(":%1").arg( ui.portSpin->value() ); mrl += QString(":%1").arg( ui.portSpin->value() );
...@@ -489,16 +494,18 @@ void NetOpenPanel::updateMRL() { ...@@ -489,16 +494,18 @@ void NetOpenPanel::updateMRL() {
case 6: /* UDP multicast */ case 6: /* UDP multicast */
mrl = "udp://@"; mrl = "udp://@";
/* Add [] to IPv6 */ /* Add [] to IPv6 */
if ( addr.contains(':') && !addr.contains('[') ) { if ( addr.contains(':') && !addr.contains('[') )
{
mrl += "[" + addr + "]"; mrl += "[" + addr + "]";
} else mrl += addr; }
else mrl += addr;
mrl += QString(":%1").arg( ui.portSpin->value() ); mrl += QString(":%1").arg( ui.portSpin->value() );
emit methodChanged("udp-caching"); emit methodChanged("udp-caching");
} }
} }
// Encode the boring stuffs // Encode the boring stuffs
mrl = QUrl( mrl ).toEncoded();
if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) { if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) {
mrl += " :access-filter=timeshift"; mrl += " :access-filter=timeshift";
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment