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

Comments

Projects
None yet
2 participants
@dmathieu

dmathieu commented May 14, 2017

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.

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne May 15, 2017

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.

Member

ddfreyne commented May 15, 2017

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

This comment has been minimized.

Show comment
Hide comment
@dmathieu

dmathieu May 15, 2017

Awesome!

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

dmathieu commented May 15, 2017

Awesome!

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

@ddfreyne ddfreyne closed this in #1179 May 15, 2017

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne May 15, 2017

Member

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

Member

ddfreyne commented May 15, 2017

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

@dmathieu

This comment has been minimized.

Show comment
Hide comment
@dmathieu

dmathieu May 15, 2017

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

dmathieu commented May 15, 2017

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