diff options
| -rw-r--r-- | core/net/url.odin | 2 | ||||
| -rw-r--r-- | tests/core/net/test_core_net.odin | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/core/net/url.odin b/core/net/url.odin index ef43d6c9f..53c94d863 100644 --- a/core/net/url.odin +++ b/core/net/url.odin @@ -24,7 +24,7 @@ import "core:encoding/hex" split_url :: proc(url: string, allocator := context.allocator) -> (scheme, host, path: string, queries: map[string]string) { s := url - i := strings.last_index(s, "://") + i := strings.index(s, "://") if i >= 0 { scheme = s[:i] s = s[i+3:] diff --git a/tests/core/net/test_core_net.odin b/tests/core/net/test_core_net.odin index ab5f2e117..5326e5023 100644 --- a/tests/core/net/test_core_net.odin +++ b/tests/core/net/test_core_net.odin @@ -572,6 +572,11 @@ split_url_test :: proc(t: ^testing.T) { {"a" = "", "b" = ""}, {"http://example.com/example?a&b"}, }, + { + "https", "example.com", "/callback", + {"redirect" = "https://other.com/login"}, + {"https://example.com/callback?redirect=https://other.com/login"}, + }, } for test in test_cases { |