Code Monkey home page Code Monkey logo

uriparser.jl's Introduction

URIParser.jl

This Julia package provides URI parsing according to RFC 3986.

This package is deprecated. Please open new issues in URIs.jl.

Build Status codecov.io

URIParser URIParser

The main interaction with the package is through the URI constructor, which takes a string argument, e.g.

julia> using URIParser

julia> URI("hdfs://user:password@hdfshost:9000/root/folder/file.csv")
URI(hdfs://user:password@hdfshost:9000/root/folder/file.csv)

julia> URI("https://user:password@httphost:9000/path1/path2;paramstring?q=a&p=r#frag")
URI(https://user:password@httphost:9000/path1/path2;paramstring?q=a&p=r#frag)

julia> URI("news:comp.infosystems.www.servers.unix")
URI(news:comp.infosystems.www.servers.unix)

Additionally, there is a method for taking the parts of the URI individually, as well as a convenience method taking host and path which constructs a valid HTTP URL:

julia> URI("hdfs","hdfshost",9000,"/root/folder/file.csv","","","user:password")
URI(hdfs://user:password@hdfshost:9000/root/folder/file.csv)

julia> URI("google.com","/some/path")
URI(http://google.com:80/some/path)

Afterwards, you may either pass the API struct directly to another package (probably the more common use case) or extract parts of the URI as follows:

julia> uri = URI("https://user:password@httphost:9000/path1/path2;paramstring?q=a&p=r#frag")
URI(https://user:password@httphost:9000/path1/path2;paramstring?q=a&p=r#frag)

julia> uri.scheme
"https"

julia> uri.host
"httphost"

julia> dec(uri.port)
"9000"

julia> uri.path
"/path1/path2;paramstring"

julia> uri.query
"q=a&p=r"

julia> uri.fragment
"frag"

julia> uri.specifies_authority
true

The specifies_authority may need some extra explanation. The reson for its existence is that RFC 3986 differentiates between empty authorities and missing authorities, but there is not way to distinguish these by just looking at the fields. As an example:

julia> URI("file:///a/b/c").specifies_authority
true

julia> URI("file:///a/b/c").host
""

julia> URI("file:a/b/c").specifies_authority
false

julia> URI("file:a/b/c").host
""

Now, while the file scheme consideres these to be equivalent, this may not necessarily be true for all schemes and thus the distinction is necessary.

uriparser.jl's People

Contributors

abhijithch avatar ararslan avatar aviks avatar c42f avatar davidanthoff avatar garborg avatar iainnz avatar jakebolewski avatar jiahao avatar jonathananderson avatar juliatagbot avatar keno avatar malmaud avatar mdcfrancis avatar musm avatar nolta avatar oxinabox avatar pabloferz avatar porterjamesj avatar quinnj avatar rofinn avatar s2maki avatar samoconnor avatar stevengj avatar tanmaykm avatar tkelman avatar toblux avatar yuyichao avatar

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.