You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the URL library to parse a Host header, and when my application is running on localhost the value that comes out of the header is localhost:3000 (for example).
This value is parsed into a Url but comes out with cannot_be_a_base() as true, so I can't join it.
With url 2.1.1 I can't call set_scheme on the parsed URL either, but that seems to be related to another regression that multiple people have raised in #577. With 2.1.0 I can call set_scheme on the parsed URL but it still comes out as cannot_be_a_base().
I worked around this by prepending "http://" onto whatever comes out of the Host header. I see this library also has a Host struct, but I don't see any way to convert a Host into a Url. I guess what' I'm looking for is a better way to build a URL from parts.
The text was updated successfully, but these errors were encountered:
genbattle
changed the title
not-a-base on base:port string
not-a-base on host:port string
Feb 22, 2020
I see this library also has a Host struct, but I don't see any way to convert a Host into a Url
you would need a scheme to convert it to a valid URL. But it does seem like there should be an API to build a url from parts rather than having to create a string and parse it. Maybe an api that allows you to do something like:
let url = Url::builder("http").host(host).port(port)
I'm using the URL library to parse a Host header
The Host header isn't a URL. It is just the host, optionally followed by the port.
I'm using the URL library to parse a
Host
header, and when my application is running on localhost the value that comes out of the header islocalhost:3000
(for example).This value is parsed into a
Url
but comes out withcannot_be_a_base()
astrue
, so I can't join it.With url
2.1.1
I can't callset_scheme
on the parsed URL either, but that seems to be related to another regression that multiple people have raised in #577. With2.1.0
I can callset_scheme
on the parsed URL but it still comes out ascannot_be_a_base()
.I worked around this by prepending "http://" onto whatever comes out of the
Host
header. I see this library also has aHost
struct, but I don't see any way to convert aHost
into aUrl
. I guess what' I'm looking for is a better way to build a URL from parts.The text was updated successfully, but these errors were encountered: