Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 10, 2022. It is now read-only.
This repository was archived by the owner on Jan 10, 2022. It is now read-only.

Incomplete buffer response #4

@flaviu-chelaru

Description

@flaviu-chelaru

Hello,

I've installed a local openfire server with plaintext authorization.

Authorization response is not complete, so the script triggers error.

[2014-11-19 14:07:41] xmpp.DEBUG: Received buffer '<' from 'localhost:5222' [] []
[2014-11-19 14:07:41] xmpp.DEBUG: Received buffer 'success xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>' from 'localhost:5222' [] []

As you can see above, the buffer is triggered twice for the same response, and this triggers error

XML parsing error: "Not well-formed (invalid token)" at Line 1 at column 1

Adding full stack trace with error.

XML parsing error: "Not well-formed (invalid token)" at Line 1 at column 1
#0 api\vendor\fabiang\xmpp\src\Stream\XMLStream.php(160): Fabiang\Xmpp\Exception\XMLParserException::create(Resource id #317)
#1 api\vendor\fabiang\xmpp\src\Connection\Socket.php(109): Fabiang\Xmpp\Stream\XMLStream->parse('success xmlns="...')
#2 api\vendor\fabiang\xmpp\src\Connection\Socket.php(165): Fabiang\Xmpp\Connection\Socket->receive()
#3 api\vendor\fabiang\xmpp\src\EventListener\Stream\Authentication\Plain.php(66): Fabiang\Xmpp\Connection\Socket->send('<auth xmlns="ur...')
#4 api\vendor\fabiang\xmpp\src\EventListener\Stream\Authentication.php(116): Fabiang\Xmpp\EventListener\Stream\Authentication\Plain->authenticate('admin', 'admin')
#5 [internal function]: Fabiang\Xmpp\EventListener\Stream\Authentication->authenticate(Object(Fabiang\Xmpp\Event\XMLEvent))
#6 api\vendor\fabiang\xmpp\src\Event\EventManager.php(126): call_user_func(Array, Object(Fabiang\Xmpp\Event\XMLEvent))
#7 api\vendor\fabiang\xmpp\src\Stream\XMLStream.php(361): Fabiang\Xmpp\Event\EventManager->trigger('{urn:ietf:param...', Object(Fabiang\Xmpp\Stream\XMLStream), Array)
#8 api\vendor\fabiang\xmpp\src\Stream\XMLStream.php(163): Fabiang\Xmpp\Stream\XMLStream->trigger()
#9 api\vendor\fabiang\xmpp\src\Connection\Socket.php(109): Fabiang\Xmpp\Stream\XMLStream->parse('<?xml version='...')
#10 api\vendor\fabiang\xmpp\src\Connection\Socket.php(165): Fabiang\Xmpp\Connection\Socket->receive()
#11 api\vendor\fabiang\xmpp\src\Connection\Socket.php(183): Fabiang\Xmpp\Connection\Socket->send('<?xml version="...')
#12 api\vendor\fabiang\xmpp\src\EventListener\Stream\StartTls.php(100): Fabiang\Xmpp\Connection\Socket->connect()
#13 [internal function]: Fabiang\Xmpp\EventListener\Stream\StartTls->proceed(Object(Fabiang\Xmpp\Event\XMLEvent))
#14 api\vendor\fabiang\xmpp\src\Event\EventManager.php(126): call_user_func(Array, Object(Fabiang\Xmpp\Event\XMLEvent))
#15 api\vendor\fabiang\xmpp\src\Stream\XMLStream.php(361): Fabiang\Xmpp\Event\EventManager->trigger('{urn:ietf:param...', Object(Fabiang\Xmpp\Stream\XMLStream), Array)
#16 api\vendor\fabiang\xmpp\src\Stream\XMLStream.php(163): Fabiang\Xmpp\Stream\XMLStream->trigger()
#17 api\vendor\fabiang\xmpp\src\Connection\Socket.php(109): Fabiang\Xmpp\Stream\XMLStream->parse('<proceed xmlns=...')
#18 api\vendor\fabiang\xmpp\src\Connection\Socket.php(165): Fabiang\Xmpp\Connection\Socket->receive()
#19 api\vendor\fabiang\xmpp\src\EventListener\Stream\StartTls.php(80): Fabiang\Xmpp\Connection\Socket->send('<starttls xmlns...')
#20 [internal function]: Fabiang\Xmpp\EventListener\Stream\StartTls->starttls(Object(Fabiang\Xmpp\Event\XMLEvent))
#21 api\vendor\fabiang\xmpp\src\Event\EventManager.php(126): call_user_func(Array, Object(Fabiang\Xmpp\Event\XMLEvent))
#22 api\vendor\fabiang\xmpp\src\Stream\XMLStream.php(361): Fabiang\Xmpp\Event\EventManager->trigger('{urn:ietf:param...', Object(Fabiang\Xmpp\Stream\XMLStream), Array)
#23 api\vendor\fabiang\xmpp\src\Stream\XMLStream.php(163): Fabiang\Xmpp\Stream\XMLStream->trigger()
#24 api\vendor\fabiang\xmpp\src\Connection\Socket.php(109): Fabiang\Xmpp\Stream\XMLStream->parse('<?xml version='...')
#25 api\vendor\fabiang\xmpp\src\Connection\Socket.php(165): Fabiang\Xmpp\Connection\Socket->receive()
#26 api\vendor\fabiang\xmpp\src\Connection\Socket.php(183): Fabiang\Xmpp\Connection\Socket->send('<?xml version="...')
#27 api\vendor\fabiang\xmpp\src\Client.php(113): Fabiang\Xmpp\Connection\Socket->connect()
#28 api\app\commands\xmppTest.php(63): Fabiang\Xmpp\Client->connect()
#29 api\vendor\laravel\framework\src\Illuminate\Console\Command.php(112): xmppTest->fire()
#30 api\vendor\symfony\console\Symfony\Component\Console\Command\Command.php(252): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 api\vendor\laravel\framework\src\Illuminate\Console\Command.php(100): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 api\vendor\symfony\console\Symfony\Component\Console\Application.php(889): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#33 api\vendor\symfony\console\Symfony\Component\Console\Application.php(193): Symfony\Component\Console\Application->doRunCommand(Object(xmppTest), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#34 api\vendor\symfony\console\Symfony\Component\Console\Application.php(124): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#35 api\artisan(59): Symfony\Component\Console\Application->run()
#36 {main}

This is a Laravel Framework command
Code bellow:

public function fire() {

        try {           
            $logger = new Logger('xmpp');
            $logger->pushHandler(new StreamHandler('php://stdout', Logger::DEBUG)); 

            $options  = new Options('localhost:5222');

            $authenticationClasses = $options->getAuthenticationClasses();
            unset($authenticationClasses['digest-md5']);            

            $options
                    ->setAuthenticationClasses($authenticationClasses)
                    ->setLogger($logger)
                    ->setUsername('admin')->setPassword('admin');

            $client = new Client($options);            
            $client->connect();       


            sleep(2);
            $client->disconnect(); 
        }catch (\Fabiang\Xmpp\Exception $ex)
        {
            print $ex->getTraceAsString();
        } catch (Exception $ex) {
            print $ex->getMessage().PHP_EOL;
            print $ex->getTraceAsString();
        }        
    }

How can i fix this?
\Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions