Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved URL Parsing #222

Merged
merged 3 commits into from
Feb 8, 2023
Merged

Improved URL Parsing #222

merged 3 commits into from
Feb 8, 2023

Conversation

michaelquigley
Copy link
Collaborator

Corrects this issue:

#211

And also supports URLs like:

9090 -> http://127.0.0.1:9090
localhost:9090 -> http://127.0.0.1:9090
https://localhost:9090 -> https://localhost:9090

Should align more closely with what users will likely expect.

@vercel
Copy link

vercel bot commented Feb 8, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated
zrok ⬜️ Ignored (Inspect) Feb 8, 2023 at 4:41PM (UTC)

@michaelquigley michaelquigley self-assigned this Feb 8, 2023
@michaelquigley michaelquigley added the enhancement Enhancement of an existing feature label Feb 8, 2023
@michaelquigley michaelquigley added this to the v0.3 milestone Feb 8, 2023
cmd/zrok/util.go Outdated
func parseUrl(in string) (string, error) {
// parse port-only urls
if iv, err := strconv.ParseInt(in, 10, 0); err == nil {
return fmt.Sprintf("http://127.0.0.1:%d", iv), nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should test for < 65535, no?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i feel like it should tell me that it's inferred 'http'. for example if i zrok share 443, i would have inferred https

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't expect it to infer HTTPS URL scheme if the arg is "443", but I would expect that if the arg was "https".

Copy link
Member

@dovholuknf dovholuknf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really like the way it's going. small nits on the port number inference but other than that lgtm!

@michaelquigley michaelquigley merged commit b97f8b1 into main Feb 8, 2023
@michaelquigley michaelquigley deleted the improved_url_parsing branch February 8, 2023 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants