Interpret HTTP transport errors as MTProto errors
This commit is contained in:
parent
0f6f80c7de
commit
05f44fbea4
@ -2,5 +2,5 @@
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
$handler = new \danog\MadelineProto\Server(['type' => AF_INET, 'protocol' => 0, 'address' => 'localhost', 'port' => 8009]);
|
||||
$handler = new \danog\MadelineProto\Server(['type' => AF_INET, 'protocol' => 0, 'address' => 'localhost', 'port' => 8000, 'transport_protocol' => 'tcp_abridged']);
|
||||
$handler->start();
|
||||
|
@ -305,8 +305,8 @@ class Connection
|
||||
$response = $this->read_http_payload();
|
||||
if ($response['code'] !== 200) {
|
||||
Logger::log($response['body']);
|
||||
|
||||
throw new Exception($response['description'], $response['code']);
|
||||
return $this->pack_signed_int(-$response['code']);
|
||||
//throw new Exception($response['description'], $response['code']);
|
||||
}
|
||||
$close = $response['protocol'] === 'HTTP/1.0';
|
||||
if (isset($response['headers']['connection'])) {
|
||||
|
@ -63,7 +63,7 @@ class Server
|
||||
} elseif ($pid) {
|
||||
return $this->pids[] = $pid;
|
||||
}
|
||||
$handler = new \danog\MadelineProto\Server\Handler($socket, 'tcp_abridged', null, null, null, null, null);
|
||||
$handler = new \danog\MadelineProto\Server\Handler($socket, $this->settings['transport_protocol'], null, null, null, null, null);
|
||||
$handler->loop();
|
||||
die;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ class Handler extends \danog\MadelineProto\Connection
|
||||
}
|
||||
}
|
||||
|
||||
public function on_request($method, $args)
|
||||
public function on_request($request_id, $method, $args)
|
||||
{
|
||||
if (count($method) === 0 || count($method) > 2) {
|
||||
throw new \danog\MadelineProto\Exception('Invalid method called');
|
||||
|
Loading…
Reference in New Issue
Block a user