ruby / ruby/open-uri

Feature: HEAD request with open?

Open
#6 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
61
Forks
22
Avg merge
15m
Merged PRs (30d)
2

Description

It's quite a common task to check whether a URI leads to a dead end or not. For a "simple" HEAD request, handling the many edge cases (SSL, proxy etc) with net/http is very cumbersome and this excellent gem implements already most of these, therefore ...

Would you consider adding HEAD requests to open-uri. Possible API:

URI.open?("http://www.ruby-lang.org/")

The HTTP status of the HEAD request should be interpreted as follows:

  • Any 5xx status raises an exception: Server error means it's impossible to tell whether the URI is okay.
  • Any 4xx status returns false: The URI is not valid.
  • Any other status returns true: The URI is valid.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing URI.open entry point and how open-uri delegates HTTP handling to net/http. Implement the proposed URI.open? behavior for HEAD requests, including the stated 4xx, 5xx, and other-status outcomes, and verify the resulting API across those status classes.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
networking
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.