phpinnacle / ridge

Pure asynchronous PHP implementation of the AMQP 0-9-1 protocol.
MIT License
50 stars 13 forks source link

Passing an incorrect login / password does not result in throwing an exception #18

Closed michalzielanski closed 2 years ago

michalzielanski commented 3 years ago

When we provide an incorrect login or password, the broker closes the connection (without sending the ConnectionCloseFrame, it just terminates the socket connection) and Ridge does not inform about it in any way. I think an exception should be thrown informing about this fact.

Example:

use Amp\Loop;
use PHPinnacle\Ridge\Client;

Loop::run(function () {
    $client = Client::create('amqp://user:wrongpass@localhost:5672');

    yield $client->connect();

    echo "Execution will never get here. Nor will an exception be thrown.";

    // (...)
});

RabbitMQ logs:

2020-09-10 08:39:02.330 [info] <0.13118.7> accepting AMQP connection <0.13118.7> (192.168.5.23:33952 -> 172.17.0.3:5672)
2020-09-10 08:39:02.332 [error] <0.13118.7> Error on AMQP connection <0.13118.7> (192.168.5.23:33952 -> 172.17.0.3:5672, state: starting):
AMQPLAIN login refused: user 'user' - invalid credentials
2020-09-10 08:39:05.332 [info] <0.13118.7> closing AMQP connection <0.13118.7> (192.168.5.23:33952 -> 172.17.0.3:5672)
mmasiukevich commented 2 years ago

24