robots.txt取得時、text/plain以外の応答は失敗扱いにする
This commit is contained in:
parent
4360144d6f
commit
3fd62dcd6f
@ -162,6 +162,11 @@ class MetadataResolveService
|
|||||||
$client = app(Client::class);
|
$client = app(Client::class);
|
||||||
try {
|
try {
|
||||||
$res = $client->get($robotsUrl);
|
$res = $client->get($robotsUrl);
|
||||||
|
if (stripos($res->getHeaderLine('Content-Type'), 'text/plain') !== 0) {
|
||||||
|
Log::error('robots.txtの取得に失敗: 不適切なContent-Type (' . $res->getHeaderLine('Content-Type') . ')');
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (string) $res->getBody();
|
return (string) $res->getBody();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user