1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 03:14:39 +01:00
This commit is contained in:
Daniil Gentili 2023-01-21 23:02:34 +01:00
parent 7a3822e0cc
commit 2c9eb73566
2 changed files with 6 additions and 16 deletions

View File

@ -264,21 +264,11 @@ final class Connection
}
$this->httpReqCount = 0;
$this->httpResCount = 0;
if (!isset($this->writer)) {
$this->writer = new WriteLoop($this);
}
if (!isset($this->reader)) {
$this->reader = new ReadLoop($this);
}
if (!isset($this->checker)) {
$this->checker = new CheckLoop($this);
}
if (!isset($this->cleanup)) {
$this->cleanup = new CleanupLoop($this);
}
if (!isset($this->waiter)) {
$this->waiter = new HttpWaitLoop($this);
}
$this->writer ??= new WriteLoop($this);
$this->reader ??= new ReadLoop($this);
$this->checker ??= new CheckLoop($this);
$this->cleanup ??= new CleanupLoop($this);
$this->waiter ??= new HttpWaitLoop($this);
if (!isset($this->pinger) && !$this->ctx->isMedia() && !$this->ctx->isCDN()) {
$this->pinger = new PingLoop($this);
}

View File

@ -80,7 +80,7 @@ trait Files
throw new Exception("Wrong status code: {$status} ".$response->getReason());
}
$mime = \trim(\explode(';', $response->getHeader('content-type') ?? 'application/octet-stream')[0]);
$size = $response->getHeader('content-length') ?? $size;
$size = (int) ($response->getHeader('content-length') ?? $size);
$stream = $response->getBody();
if (!$size) {
$this->logger->logger("No content length for {$url}, caching first");