Version: (using KDE KDE 3.1.94) Installed from: Unlisted Binary Package Konsole ssh://user@host bookmarks should allow a port to be specified (ssh://user@host:port)
I can report that this bug is real, and it's a pain for me. We have terminal servers milking the console ports of our servers, with each serial port served by a telnet server on a different high numbered port. The bookmarks I've created are of the form telnet://terminal-server:2043 . The URL is not properly cracked into arguments into telnet. If I try and put a space in instead of the colon, it gets translated into a %20 escape sequence. The ktelnetservice code cracks these URL's correctly. Here's the output on a konsole after selecting a bookmark "telnet://jshriver@terminal-server:2043": $ telnet -l jshriver terminal-server:2043 telnet: could not resolve terminal-server:2043/telnet: Name or service not known Here's the output on a konsole after selecting a bookmark "telnet://jshriver@terminal-server 2044": $ telnet -l jshriver terminal-server%202044 telnet: could not resolve terminal-server%202044/telnet: Name or service not known The presence of absence of username@ in the URL does not affect the bug. It's correctly parsing that @ and making the -l argument, but it's not doing the same with :'s for port. (No idea what it does with passwords.) KDE 3.1.1a, Konsole 1.2.1, on a Debian Linux system. Not sure if the IT folks here built from source, or downloaded the Debian "packages".
telnet works just fine in KDE 3.2
Correction: telnet urls work just fine with Alt-F2 but not in konsole.
Subject: kdebase/konsole/konsole CVS commit by waba: Handle port in bookmarked telnet/ssh urls. CCMAIL: 71177-done@bugs.kde.org M +19 -20 konsole.cpp 1.441 --- kdebase/konsole/konsole/konsole.cpp #1.440:1.441 @@ -2158,5 +2158,4 @@ void Konsole::enterURL(const QString& UR { QString path, login, host, newtext; - int i; if (URL.startsWith("file:")) { @@ -2167,26 +2166,19 @@ void Konsole::enterURL(const QString& UR } else if (URL.contains("://", true)) { - i = URL.find("://", 0); - newtext = URL.left(i); - path = URL.mid(i + 3); - /* - * Is it protocol://user@host, or protocol://host ? - */ - if (path.contains("@", true)) { - i = path.find("@", 0); - login = path.left(i); - host = path.mid(i + 1); - if (!login.isEmpty()) { - newtext = newtext + " -l " + login; - } - } else { - host = path; - } + KURL u(URL); + newtext = u.protocol(); + bool isSSH = (newtext == "ssh"); + if (u.port() && isSSH) + newtext += " -p " + QString().setNum(u.port()); + if (u.hasUser()) + newtext += " -l " + u.user(); /* * If we have a host, connect. */ - if (!host.isEmpty()) { - newtext = newtext + " " + host; + if (u.hasHost()) { + newtext = newtext + " " + u.host(); + if (u.port() && !isSSH) + newtext += QString(" %1").arg(u.port()); se->setUserTitle(31,""); // we don't know remote cwd te->emitText(newtext + "\r"); @@ -2648,6 +2640,11 @@ void Konsole::newSession(const QString& else if ((!url.protocol().isEmpty()) && (url.hasHost())) { protocol = url.protocol(); + bool isSSH = (protocol == "ssh"); args.append( protocol.latin1() ); /* argv[0] == command to run. */ host = url.host(); + if (url.port() && isSSH) { + args.append("-p"); + args.append(QCString().setNum(url.port())); + } if (url.hasUser()) { login = url.user(); @@ -2656,4 +2653,6 @@ void Konsole::newSession(const QString& } args.append(host.latin1()); + if (url.port() && !isSSH) + args.append(QCString().setNum(url.port())); newSession( NULL, protocol.latin1() /* protocol */, args /* arguments */, QString::null /*term*/, QString::null /*icon*/,