Hi Patrick,
On Sep 25, 2009, at 19:04 , Patrick Ohly wrote:
I get a segfault now:
1439 else if (getEncoding()!=enc) {
1440 // already known encoding does not match actual
encoding
1441 PDEBUGPRINTFX(DBG_ERROR,(
1442 "Warning: Incoming data encoding mismatch:
expected=%s, found=%s",
1443 SyncMLEncodingNames[getEncoding()],
1444 SyncMLEncodingNames[enc]
1445 ));
(gdb) p enc
$1 = SML_WBXML
(gdb) p this
$3 = (class sysync::TSyncServer * const) 0xd74b00
(gdb) p *this
Reading in symbols for /home/patrick/projects/libsynthesis/src/
DB_interfaces/api_db/pluginapiagent.cpp...done.
$4 = {<sysync::TSyncSession> = {_vptr.TSyncSession = 0x7fbc5f07ccf0,
fDumpCount = 0,
fOutgoingXMLInstance = 0x0, fIncomingXMLInstance = 0x0,
fXMLtranslate = false, fMsgDump = false,
fLimitedRemoteFieldLengths = false, fDontSendEmptyProperties =
false, fDoQuote8BitContent = false,
...
(gdb) p this->fEncoding
$5 = 14108592
I just did a WriteSyncMLBuffer() for the initial message. How would I
set the content type at that stage?
If you have a content type from HTTP headers, you can write the
"contenttype" value of the session key.
Note that later, when the engine has data ready for you, you can read
"contenttype" to get the "Content-Type:" header value to use in your
response (even if you wrote something invalid into it before - the
return value is not a store string, but generated from fEncoding).
Ah, the code tries to guess the
encoding if fEncoding == SML_UNDEF, except for me fEncoding seems to
be
uninitialized. Setting it to SML_UNDEF in TSyncSession::TSyncSession()
fixed the problem.
Thanks for the fix! I'll have to check though why this is
uninitialized because I think it should be initialized when the smlTk
instance is set up.
I'm getting the first message exchange done, now it fails with in
my
HTTP server script because I'm not handling the session ID yet (need
to
follow the hints in your other email). I think this is enough for
today,
though.
:-) Have a nice weekend!
Lukas Zeller (luz(a)synthesis.ch)
-
Synthesis AG, SyncML Solutions & Sustainable Software Concepts
info(a)synthesis.ch,
http://www.synthesis.ch