Closed GoogleCodeExporter closed 9 years ago
Ok, now I found that I can register the jaxl_pre_handler before the requires
for JAXL0206 and that way detect the errors.
With regular expressions I get the type and condition attributes of the <body>
tag and if type is 'terminate' and condition contains something then I report
the error for the user.
But anyway I think this issue should be kept open until JAXL implements a
handler to handle the terminate error type from the BOSH server passing the
condition attribute to the handler, so users of JAXL don't need to fiddle with
regular expressions.
In case it helps someone, this is my jaxl_pre_handler:
function JAXLPreHandler ($payload, $jaxl)
{
//echo "DEBUG: " . __METHOD__ . ": "; var_dump ($payload);
preg_match ('/<body.*[[:blank:]]*type[[:blank:]]*=[[:blank:]]*[\'"]([^\'"]*)[\'"]/',
$payload, $Matches);
$Type = strtolower(trim(@$Matches[1])); unset($Matches);
if ($Type == 'terminate') {
preg_match ('/<body.*[[:blank:]]*condition[[:blank:]]*=[[:blank:]]*[\'"]([^\'"]*)[\'"]/',
$payload, $Matches);
$Condition = trim(@$Matches[1]); unset($Matches);
if ($Condition != '') throw new Exception("Connection error: $payload.");
}
}
Hope this helps, thanks!
Original comment by iba...@gmail.com
on 30 May 2012 at 10:56
Grr, forgot to add "return $payload;" to the end of that function, sorry! :-)
Original comment by iba...@gmail.com
on 30 May 2012 at 11:08
Hello Friends,
I am no longer accepting issues/bugs on google code issue list.
Have any Question? Want to discuss? Need Help? Use Google Group/Forum.
https://groups.google.com/forum/#!forum/jaxl
Found something missing or a bug in the source code? Kindly report an issue.
https://github.com/abhinavsingh/JAXL/issues
Sorry for any inconvenience caused.
--
Abhinav
Original comment by mailsfor...@gmail.com
on 12 Sep 2012 at 9:48
Original issue reported on code.google.com by
iba...@gmail.com
on 30 May 2012 at 7:56