Giter Club home page Giter Club logo

Comments (9)

jameshfisher avatar jameshfisher commented on May 27, 2024

More generally, the same output occurs when replacing "localhost" with any single-label domain, e.g. "foo".

from purl.

jameshfisher avatar jameshfisher commented on May 27, 2024

The assumption that the URL is going to be multi-label seems to be hard-coded into Purl's API, e.g. $url->publicSuffix, $url->registerableDomain.

from purl.

jameshfisher avatar jameshfisher commented on May 27, 2024

An example of correct behavior would be PHP's parse_url:

echo parse_url("http://foo/", PHP_URL_HOST) . "\n";

which outputs

foo

from purl.

jameshfisher avatar jameshfisher commented on May 27, 2024

Note that this bug is also present in https://github.com/auraphp/Aura.Uri which also uses the public suffix list.

from purl.

jameshfisher avatar jameshfisher commented on May 27, 2024

The issue with Aura.Uri is here.

from purl.

jameshfisher avatar jameshfisher commented on May 27, 2024

The issue seems to be hard-coded in the source, too: https://github.com/jwage/purl/blob/master/src/Purl/Parser.php#L40

from purl.

jameshfisher avatar jameshfisher commented on May 27, 2024

The issue is not present in version 0.0.2.

from purl.

jameshfisher avatar jameshfisher commented on May 27, 2024

This is odder than I thought. The behavior of 0.0.2 is different when executed using the command line to when executed on a web server. Specifically, "localhost" gets elided when using the web server but not when using the command line.

from purl.

jeremykendall avatar jeremykendall commented on May 27, 2024

@jameshfisher Thanks for the bug report. I'll take a look at it later today and let you know what I come up with.

from purl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.