nakagami / firebirdsql

Firebird RDBMS sql driver for Go (golang)
MIT License
227 stars 60 forks source link

Test fails when password contains "?" #78

Closed D3coded closed 5 years ago

D3coded commented 5 years ago

The following test case fails, because the password part includes a "?".

{"user:!password?@localhost/c:/fbdata/database.fdb", "localhost:3050", "c:/fbdata/database.fdb", "user", "!password?", "", "Srp", "true"}

I guess it fails in the package "net\url" in the function "parseAuthority" called here

Test result:

Running tool: C:\Go\bin\go.exe test -timeout 30s github.com\nakagami\firebirdsql -run ^(TestDSNParse)$

--- FAIL: TestDSNParse (0.00s) [...]\go\src\github.com\nakagami\firebirdsql\utils_test.go:55: User unknown FAIL FAIL github.com/nakagami/firebirdsql 0.051s Error: Tests failed.

My go version: go1.11.2 windows/amd64

nakagami commented 5 years ago

Umm, thanks,

I hope to fix it someday. I want someone's Pull Request.

bat22 commented 5 years ago

workaround until the problem is fixed: userInfo := url.UserPassword("user", "!password?").String() dsn := userInfo + "@localhost:3050/dbname"

nakagami commented 5 years ago

thanks, @bat22

I realize connection string has URL encoded.

package main

import (
    "fmt"
    "net/url"
)  

func main() {
    userInfo := url.UserPassword("user", "!p@ssword?").String()
    dsn := userInfo + "@localhost:3050/dbname"
    fmt.Println(dsn)

}  
  user:%21p%40ssword%3F@localhost:3050/dbname