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

Should the external links check perform HEAD requests? #1178

Closed
dmathieu opened this issue May 14, 2017 · 4 comments
Closed

Should the external links check perform HEAD requests? #1178

dmathieu opened this issue May 14, 2017 · 4 comments

Comments

@dmathieu
Copy link
Contributor

While I understand HEAD requests allow speeding up the checks, and the 405 HTTP response is handled, many web servers don't handle HEAD requests, and won't send a 405 either.

This basically makes the elinks check useless, as it can't be relied upon.

Steps to reproduce

  1. Create a page with a link to https://redis.io/topics/protocol inside it.
  2. Run nanoc check elinks

Expected behavior

This page does exist, and if users were to click the link, they wouldn't get a 404. The test should therefore not fail,

Actual behavior

Because the server doesn't handle HEAD requests, and doesn't return 405, the test fails, when the page actually exists.

Fixing this

I'm absolutely fine opening a PR fixing this, either by entirely removing the HEAD request, or any other solution proposed.
I want to make sure this kind of change would be approved though. And a quick search didn't show any other similar issue.

@denisdefreyne
Copy link
Member

Makes sense!

An alternative could be to perform a HEAD request and fall back to GET if the HEAD returns a 404, but I don’t see the benefit of doing that over doing a GET in the first place.

I’ve opened PR #1179 to fix this.

@dmathieu
Copy link
Contributor Author

Awesome!

If I may make another suggestion, how about setting an user agent?
Like nanoc/link_checker?

@denisdefreyne
Copy link
Member

@dmathieu I don’t think that setting a custom user agent would bring much. Do you have a use case for it?

@dmathieu
Copy link
Contributor Author

Not specifically. It's just a way to be a better citizen.
Thanks for the HEAD fix! 🌷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants