D-Bus server: accept WBXML with charset in incoming connections

A user reported via email that the Nokia 515 sends
'application/vnd.syncml+wbxml; charset=UTF-8' as type of its messages
this tripped up the syncevo-http-server, leading to:

   [ERROR] syncevo-dbus-server: /org/syncevolution/Server: message type 'application/vnd.syncml+wbxml; charset=UTF-8' not supported for starting a sync

We need to strip the '; charset=UTF-8' suffix also when checking for
WBXML.
This commit is contained in:
Patrick Ohly 2014-01-08 16:00:37 +01:00
parent e6dddfd1c4
commit 41e878d0d8

View file

@ -96,6 +96,13 @@ std::string Connection::buildDescription(const StringMap &peer)
return buffer;
}
static bool IsSyncML(const std::string &messageType)
{
return messageType == TransportAgent::m_contentTypeSyncML ||
messageType == TransportAgent::m_contentTypeSyncWBXML;
}
void Connection::process(const Caller_t &caller,
const GDBusCXX::DBusArray<uint8_t> &message,
const std::string &message_type)
@ -245,8 +252,7 @@ void Connection::process(const Caller_t &caller,
}
// TODO: use the session ID set by the server if non-null
} else if (// relaxed checking for XML: ignore stuff like "; CHARSET=UTF-8"
message_type.substr(0, message_type.find(';')) == TransportAgent::m_contentTypeSyncML ||
message_type == TransportAgent::m_contentTypeSyncWBXML) {
IsSyncML(message_type.substr(0, message_type.find(';')))) {
// run a new SyncML session as server
serverMode = true;
if (m_peer.find("config") == m_peer.end() &&