[Fusioninventory-devel] collect.php protocol

Côme Chilliet come at opensides.be
Thu Dec 3 03:35:37 UTC 2015


Le mercredi 2 décembre 2015, 14:18:59 Guillaume Bougard a écrit :
> Hello Côme,
> 
> as I understand, you want to report the error in fusioninventory-agent if the XML inventory it pushed failed in some way to be integrated in FusionDirectory.
> 
> In that way, just think FIA is just an HTTP client. So and as it only tries to submit an XML, the only thing it checks for error is the HTTP Status code of the server. And then it only logs the returned status line. See HTTP::Response doc, what is log is just the return of $r->status_line() (see request method in FIA code at lib/FusionInventory/Agent/HTTP/Client.pm).
> 
> In conclusion, try just to return an HTTP error with a short description. See also : http://php.net/manual/fr/function.http-response-code.php
> 
> Hope this help,

Thanks, it does help, I’ll try triggering a 500 error in case of error.
I don’t remember where the code for our collect.php is originally from but there is something like this in it:
> $reply = "";
> if (preg_match('/QUERY>PROLOG<\/QUERY/', $xml)) {
>     $reply= '<?xml version="1.0" encoding="UTF-8"?>
>         <REPLY>
>            <RESPONSE>SEND</RESPONSE>
>            <PROLOG_FREQ>8</PROLOG_FREQ>
>         </REPLY>';
> } else {
>     $reply = '<?xml version="1.0" encoding="UTF-8"?>
>        <REPLY>
>        </REPLY>';

And at the end $reply is printed.
So it seems there is an XML reply which FI agent is reading no? Is there anything useful we can put in it?
What it the PROLOG part for?

Côme



More information about the Fusioninventory-devel mailing list