mirror of
https://github.com/danog/dns-over-https.git
synced 2024-11-26 11:54:44 +01:00
Throw DNS exception if HTTP response !== 200
This commit is contained in:
parent
c94adf5873
commit
1b9e2e6e8b
@ -13,6 +13,7 @@ use LibDNS\Decoder\DecoderFactory;
|
||||
use LibDNS\Encoder\EncoderFactory;
|
||||
use LibDNS\Messages\Message;
|
||||
use function Amp\call;
|
||||
use Amp\Dns\DnsException;
|
||||
|
||||
/** @internal */
|
||||
final class HttpsSocket extends Socket
|
||||
@ -81,7 +82,12 @@ final class HttpsSocket extends Socket
|
||||
}
|
||||
$response = $this->httpClient->request($request);
|
||||
return call(function () use ($response, $id) {
|
||||
$response = yield (yield $response)->getBody();
|
||||
$response = yield $response;
|
||||
if ($response->getStatus() !== 200) {
|
||||
throw new DnsException("HTTP result !== 200: ".$response->getReason());
|
||||
}
|
||||
$response = yield $response->getBody();
|
||||
|
||||
|
||||
switch ($this->nameserver->getType()) {
|
||||
case Nameserver::RFC8484_GET:
|
||||
|
Loading…
Reference in New Issue
Block a user