addressable icon indicating copy to clipboard operation
addressable copied to clipboard

Consider changing default heuristic parse to https

Open sporkmonger opened this issue 6 years ago • 5 comments

Currently heuristic_parse("example.com") returns "http://example.com/". At some point I think it'd be better to return "https://example.com/" but we may not be there just yet.

sporkmonger avatar Aug 31 '19 03:08 sporkmonger

Hey @sporkmonger is there any update on this? Happy to grab it if there's no reason as to why not default https over http. My understanding is that it's a simple line change.

danielvdao avatar Dec 27 '24 20:12 danielvdao

It would be a breaking change. So a new major release. I wonder if it is worth it. Maybe it should be opt-in at first?

And it needs to be possible to go back to the old behavior.

dentarg avatar Dec 27 '24 20:12 dentarg

@dentarg ah yeah, you're right. Can you explain what you mean by opt-in? Isn't it opt-in today already? If I were to pass in Addressable::URI.heuristic_parse("www.foo.com", scheme: "https") that's opting into https scheme, right? Vice-versa by doing scheme: "http". Agreed that there should be a way for users to specify http at least.

I don't see why we shouldn't prefer https over http but curious to know what you think! 🤔

danielvdao avatar Dec 27 '24 21:12 danielvdao

Ah right, you can pass hints to the heuristic parse method. I forgot about that.

https://github.com/sporkmonger/addressable/blob/4229164843616783287ca359bbe38b574f1908a3/lib/addressable/uri.rb#L188

So it is only a matter of changing that. (Which we should only do in a new major version IMHO)

dentarg avatar Dec 28 '24 07:12 dentarg

Re: "is it worth it?"

This issue has been open for five years and there hasn't been a lot of user requests to change this default. Maybe because it is so easy to adjust it?

However, if we do change it, everyone that relies on the current default behavior has to take action.

Addressable doesn't change a lot these days and is mostly considered very stable.

If we would produce a major version with more major changes it would probably be worth changing this.

dentarg avatar Dec 28 '24 07:12 dentarg