Nick is right. The two URLs: http://localhost:8080/test?a=b&c=d http://localhost:8080/#test?a=b&c=d have _nothing_ but the "origin" part in common. Note that everything after the `#` is just for the browser, the backend server will never get that. It won't tell the difference between: http://localhost:8080/#test?a=b&c=d and http://localhost:8080/
Regards, Witold Szczerba On Sat, Dec 10, 2016 at 3:06 AM, Nick H <[email protected]> wrote: > I would call this not a bug, since it conforms to the URL standard > <https://url.spec.whatwg.org/#url-syntax>. in your second example, > ?a=b&c=d is not a query string, but a part of the fragment string. > > This is just one of several ways that URL syntax can lead you down a dark > alley and steal your wallet. > > On Fri, Dec 9, 2016 at 5:53 PM, Charlie Koster <[email protected]> > wrote: > >> I submitted an issue >> <https://github.com/evancz/url-parser/issues/23#issue-194702768> to >> evancz/url-parser but it ended up being human error on my part. However, >> I'm making this post because of my closing comment >> <https://github.com/evancz/url-parser/issues/23#issuecomment-266169129> >> on that issue. >> >> To summarize, I'm using `UrlParser.parseHash` along with >> `Url.stringParam` and I can't get that parser to work. After some digging I >> noticed that elm-lang/Navigation is providing me a `Location` that doesn't >> have a search attribute. Here are two examples. >> >> Navigate to http://localhost:8080*/test?a=b&c=d* >> Logging the Location gives me: >> { href = "http://localhost:8080/test?a=b&c=d", host = "localhost:8080", >> hostname = "localhost", protocol = "http:", origin = " >> http://localhost:8080", port_ = "8080", pathname = "/test", search = >> "?a=b&c=d", hash = "", username = <internal structure>, password = < >> internal structure> } >> >> Notice the search attribute as my query string. >> >> Navigate to http://localhost:8080*/#test?a=b&c=d* >> Logging the Location gives me: >> { href = "http://localhost:8080/#test?a=b&c=d", host = "localhost:8080", >> hostname = "localhost", protocol = "http:", origin = " >> http://localhost:8080", port_ = "8080", pathname = "/", search = "", >> hash = "#test?a=b&c=d", username = <internal structure>, password = < >> internal structure> } >> >> Notice the search attribute is an empty string and the hash attribute >> contains both the hash and the query string >> >> My question to the community.. Is this a bug with elm-lang/Navigation, >> evancz/url-parser, or not a bug at all because that's how hashes work and I >> have to deal with this manually? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Elm Discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to the Google Groups > "Elm Discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
