Convenience methods to create URL authority from its parts

Open
#458 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
api, networking

Research direction

Start by locating the Authority parsing implementation and existing construction or parsing tests. Review how host and port pairs are currently converted, including IPv6 handling. Done should provide a documented convenience conversion from separate host and port values without requiring callers to format the authority string themselves.

Written by the indexing model from the issue text.

Description

Currently, the only way to build an Authority object is to parse a string in the form <host>:<port>. This can be a bit inconvenient: In the case the host is an ipv6 address, it needs to be enclosed in [], and the developer will have to do a somewhat complex dance to go from a Host/Port pair to a proper authority string.

It'd be nice to have additional convenience methods, e.g.

// From a host and a port
impl TryFrom<(&str, u16)> for Authority {}

This way, if &str is an IPv6 address (which can be detected by trying to parse it with Ipv6Addr::parse), it can automatically be bracketed.

Dominant language
Rust
Stars
1.4k
Forks
378
Avg merge
1d 21h
Merged PRs (30d)
5

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.

More from hyperium/http

All issues in hyperium/http

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.