Skip to content

Feature: HEAD request with open? #6

Open
@svoop

Description

@svoop

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions