Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn user about HTTP No-Index headers #106

Merged
merged 6 commits into from
Jul 19, 2021
Merged

Warn user about HTTP No-Index headers #106

merged 6 commits into from
Jul 19, 2021

Conversation

Tom32i
Copy link
Collaborator

@Tom32i Tom32i commented Jul 15, 2021

Fix #65

@Tom32i Tom32i requested a review from ogizanagi July 15, 2021 11:57
@Tom32i Tom32i self-assigned this Jul 15, 2021
@Tom32i
Copy link
Collaborator Author

Tom32i commented Jul 15, 2021

I need to test this.

src/Builder.php Outdated Show resolved Hide resolved
@@ -396,6 +397,12 @@ private function buildUrl(string $url, bool $ignoreContentNotFoundErrors = false
$output = ob_get_clean();
$content = $response->getContent() ?: $output;

if ($this->hasNoIndexHeader($response) && !$this->hasNoIndexTag($content)) {
$this->logger->warning('Url "{url}" contains a "x-robots-tag: noindex" header that will be lost by going static. Consider using the HTML tag "<meta name="robots" content="noindex" />" instead.', [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the progress bar (used in normal verbosity and interactive mode) may "eat" the first logs by redrawing over, the user might miss the warnings if there are only a few of them.
Note this is not an issue in CI (non-interactive), or whenever using another verbosity level (-v is enough). But I've 1 or 2 idea(s) for gathering such warnings to be displayed at the end of the command execution with the progress bar.

src/Builder.php Outdated Show resolved Hide resolved
@Tom32i Tom32i merged commit 55fbca1 into master Jul 19, 2021
@Tom32i Tom32i deleted the handle-http-no-index branch July 19, 2021 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add warning on HTTP headers?
2 participants