PATCH: Proper namespaces handling in DJabberd

Daniel Ruoso daniel at ruoso.com
Wed Jun 10 19:18:48 UTC 2009


Em Qua, 2009-06-10 às 11:59 -0700, Martin Atkins escreveu:
> Thanks for the patch. It does seem like this is a problem we should address.
> Would you mind providing more information about the bug, such as what 
> you were trying to send, what you expected to happen and what actually 
> happened? Currently it's not clear to me how I might review/test this patch.

Just try to send any XML with namespace information and you should see
it happening, like:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="...">
 <SOAP-ENV:Body>
  <SOAP-ENV:Fault>
    <faultcode>SOAP-ENV:Server</faultcode>
    <faultstring>Bla bla bla</faultstring>
  </SOAP-ENV:Fault>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

would become 

<Envelope xmlns="..." SOAP-ENV="...">
 <Body>
  <Fault>
    <faultcode>SOAP-ENV:Server</faultcode>
    <faultstring>Bla bla bla</faultstring>
  </Fault>
 </Body>
</Envelope>

The problems here are:

 * xmlms:SOAP-ENV became simply SOAP-ENV... which is a non-existant
attribute
 * faultcode and faultstring were unqualified elements and now are
declared as being of the SOAP-ENV namespace
 * renaming the prefixes is not a recommended practice, and, in fact,
you need to understand the specific XSD to do it, since QName types (the
SOAP-ENV:Server value) care about the prefix.

> It'd be cool also to have some new tests to verify the correct behavior 
> so that we can avoid regressions in this area in future -- I assume, 
> given that this hasn't been noticed before, that our tests are currently 
> lacking.

You're right... I'm just lacking the time to understand your testing
framework in detail enough to write a test on my own... but basically,
you just need to make sure the namespace qualification and prefixes are
preserved...


daniel



More information about the Djabberd mailing list