From mike.gabriel@das-netzwerkteam.de  Fri Dec  7 09:06:01 2012
Received: (at submit) by bugs.x2go.org; 7 Dec 2012 08:06:01 +0000
Received: from freya.das-netzwerkteam.de (freya.das-netzwerkteam.de [88.198.48.199])
	by ymir (Postfix) with ESMTPS id 2AD575DA79
	for <submit@bugs.x2go.org>; Fri,  7 Dec 2012 09:06:01 +0100 (CET)
Received: from grimnir.das-netzwerkteam.de (grimnir.das-netzwerkteam.de [78.46.204.98])
	by freya.das-netzwerkteam.de (Postfix) with ESMTPS id EA5F81F4
	for <submit@bugs.x2go.org>; Fri,  7 Dec 2012 09:06:00 +0100 (CET)
Received: from localhost (localhost [127.0.0.1])
	by grimnir.das-netzwerkteam.de (Postfix) with ESMTP id D543F3BB2B
	for <submit@bugs.x2go.org>; Fri,  7 Dec 2012 09:06:00 +0100 (CET)
X-Virus-Scanned: Debian amavisd-new at grimnir.das-netzwerkteam.de
Received: from grimnir.das-netzwerkteam.de ([127.0.0.1])
	by localhost (grimnir.das-netzwerkteam.de [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 3rduKSwbG4Hr for <submit@bugs.x2go.org>;
	Fri,  7 Dec 2012 09:06:00 +0100 (CET)
Received: from localhost (localhost [127.0.0.1])
	by grimnir.das-netzwerkteam.de (Postfix) with ESMTP id A89463BF0C
	for <submit@bugs.x2go.org>; Fri,  7 Dec 2012 09:06:00 +0100 (CET)
Received: from localhost (localhost [127.0.0.1])
	by grimnir.das-netzwerkteam.de (Postfix) with ESMTP id 865423BB2B
	for <submit@bugs.x2go.org>; Fri,  7 Dec 2012 09:06:00 +0100 (CET)
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
	grimnir.das-netzwerkteam.de
X-Spam-Flag: NO
X-Spam-Status: No, hits=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_20
	autolearn=ham version=3.3.1 running as userid=
X-Spam-Level: 
X-Spam-Bayes-Score: 0.0752
Received: by grimnir.das-netzwerkteam.de (Postfix, from userid 33)
	id 1297A3BF0C; Fri,  7 Dec 2012 09:06:00 +0100 (CET)
Received: from nocatv2.tng.de (nocatv2.tng.de [213.178.75.58]) by
 mail.das-netzwerkteam.de (Horde Framework) with HTTP; Fri, 07 Dec 2012
 09:06:00 +0100
Message-ID: <20121207090600.117438jpjzttqsfc@mail.das-netzwerkteam.de>
X-Priority: 3 (Normal)
Date: Fri, 07 Dec 2012 09:06:00 +0100
From: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
To: submit@bugs.x2go.org
Subject: get rid of remnant html tags in client<->broker communications
MIME-Version: 1.0
Content-Type: multipart/signed;
 boundary="=_5udywwv27vs";
 protocol="application/pgp-signature";
 micalg="pgp-sha1"
Content-Transfer-Encoding: 7bit
User-Agent: Internet Messaging Program (IMP) H3 (4.3.4)

This message is in MIME format and has been PGP signed.

--=_5udywwv27vs
Content-Type: multipart/mixed;
 boundary="=_5tl8jwdtvvqf"
Content-Transfer-Encoding: 7bit

This message is in MIME format.

--=_5tl8jwdtvvqf
Content-Type: text/plain;
 charset=UTF-8;
 DelSp="Yes";
 format="flowed"
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Package: x2goclient
Severity: normal
Version: 3.99.3.1-HEAD
Tags: patch confirmed

Hi Alex,

I have taken a closer look at the httpbrokerclient.cpp code in  
x2goclient. Most replies from the httpbroker are compliant with a  
text/plain content type. This is good IMHO.

However, in HttpBrokerClient::createIniFile x2goclient expects <br>  
html tags as line breaks. If these <br> tags are missing, the session  
profile won't get recognized by x2goclient.

With the current developmental code in x2gobroker.git, I try to  
implement the current broker API with no html elements at all, so I'd  
be happy if these last required <br>s could be made unnecessary.

Currently, as a list of session profiles the httpbroker client code in  
x2goclient expects some broker output like this:

"""
START_USER_SESSIONS<br>[b00830a9-aec4-4e9e-88f8-ddbffeb1c8ea]defsndport=1<br>sndport=4713<br>xinerama=1<br>variant=<br>useiconv=0<br>iconvfrom=UTF-8<br>height=600<br>usekbd=1<br>applications=TERMINAL,WWWBROWSER,MAILCLIENT,OFFICE<br>host=localhost<br>export=<br>user=<br>fstunnel=1<br>quality=9<br>sshport=22<br>sound=1<br>fullscreen=0<br>rootless=0<br>layout=<br>name=LOCALHOST<br>sshproxyport=22<br>soundsystem=pulse<br>speed=2<br>iconvto=UTF-8<br>soundtunnel=1<br>useexports=1<br>width=800<br>command=KDE<br>multidisp=0<br>print=1<br>setdpi=0<br>type=auto<br>dpi=96<br>pack=16m-jpeg<br>
END_USER_SESSIONS<br>
"""

So, I am quite keen on x2goclient being able to _also_ handle broker  
output that looks like this, instead:

"""
[47af8619-d619-43de-bf00-2c30c47772d1]
defsndport=1
sndport=4713
xinerama=1
variant=
useiconv=0
iconvfrom=UTF-8
height=600
usekbd=1
applications=TERMINAL,WWWBROWSER,MAILCLIENT,OFFICE
host=localhost
export=
user=
fstunnel=1
quality=9
sshport=22
sound=1
fullscreen=0
rootless=0
layout=
name=LOCALHOST
sshproxyport=22
soundsystem=pulse
speed=2
iconvto=UTF-8
soundtunnel=1
useexports=1
width=800
command=KDE
multidisp=0
print=1
setdpi=0
type=auto
dpi=96
pack=16m-jpeg
END_USER_SESSIONS
"""

Attached to this post you find a patch against httpbrokerclient.* that  
makes x2goclient understand both variants of httpbroker output (IMHO).  
Can you please cross-check if that patch keeps x2goclient working with  
all other broker implementations that are currently deployed at your  
customers' sites?

Greets,
Mike

-- 

DAS-NETZWERKTEAM
mike gabriel, rothenstein 5, 24214 neudorf-bornstein
fon: +49 (1520) 1976 148

GnuPG Key ID 0x25771B31
mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de

freeBusy:
https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.xfb

--=_5tl8jwdtvvqf
Content-Type: text/x-diff;
 charset=UTF-8;
 name="httpbrokerclient-no-br-tags-anymore.patch"
Content-Disposition: attachment;
 filename="httpbrokerclient-no-br-tags-anymore.patch"
Content-Transfer-Encoding: 7bit

--- a/httpbrokerclient.cpp
+++ b/httpbrokerclient.cpp
@@ -319,16 +319,18 @@ void HttpBrokerClient::testConnection()
 }
 
 
-void HttpBrokerClient::createIniFile(const QString& content)
+void HttpBrokerClient::createIniFile(const QString& raw_content)
 {
+    QString content;
+    content = raw_content;
+    content.replace("<br>","\n");
+    x2goDebug<<"inifile content: "<<content<<"\n";
     QString cont;
-    QStringList lines=content.split("START_USER_SESSIONS<br>");
+    QStringList lines=content.split("START_USER_SESSIONS\n");
     if (lines.count()>1)
     {
         cont=lines[1];
-        cont=cont.split("END_USER_SESSIONS")[0];
-        cont.replace("\n","");
-        cont.replace("<br>","\n");
+        cont=cont.split("END_USER_SESSIONS\n")[0];
     }
     mainWindow->config.iniFile=cont;
 }


--=_5tl8jwdtvvqf--

--=_5udywwv27vs
Content-Type: application/pgp-signature
Content-Description: Digitale PGP-Unterschrift
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQIcBAABAgAGBQJQwaNnAAoJEJr0azAldxsxPrQP/jihszQTspAoOz7g7UE6wqiX
elIRW663lXEuOmTW0IA1jA6uHvYRRJDE80UhwHq38aUt5dUKcwyjFNK3X3nzv2AH
4LBvli90s2exSW94efnVTtdYfAu7+pcxLwPAhuLgPiEkxphxLkiqgQXPPxvGyoPO
MLl+BAArpH+X6rN8y0d1KTf8GgdccmM2QPHRPnGn15AAHdkk+DbAm8Ezg2aSTNjb
YY0e6jI7FexyJOZ7PLoAe9VUOb9IPaWJIOMKLvq6eZeIyppTix2OvKMJrhaD92jr
WdhG7JAelGxTyYpguEWCT31K+EPYm9DW3hkoHB6adldtPf9x9XEhKWZK+CIkrB4f
yZaa6wiHBVB6ZgAmQx3VwqG0NTvCYjdaf15+0jxBGl4zMaaxYvXYKlYui1OCVs2A
/GueJeF3Tt6xyFLQ4nVxblfVMLOHFXTPNgrG/6mQ9/ie32aPBI0PtstGsyXYSrJ4
D+86JZ7756N0aw9hmaoS87tfptsgKYS0ZlAqOxkHB8G43/15d0kb5Tyt8aN+cG7Q
+MtltcRPEhMN8Xhx+is9pXvf+rhmRWy1S01cZdXFrf6xaIzHbXtehFkksJ5QoMHF
ZrTbNH4wyMIYWRUy9KTLgIbVJf/GG1TWCWXjmUgNqk1Os+kPlI6l7g2QXbHuW0ee
eXnAG5STlBU3dfloqWGc
=FVfS
-----END PGP SIGNATURE-----

--=_5udywwv27vs--
