internal/socks: permit authenticating with an empty password
The behavior is accepted widely, and I found no reason to deny it.
Fixes golang/go#57285
Change-Id: I39b07295cc89481ea0d6b70b71f2aa57f1a01407
GitHub-Last-Rev: b00ecb1d7afd1f0ae60d2215f33161e535931eb4
GitHub-Pull-Request: golang/net#157
Reviewed-on: https://go-review.googlesource.com/c/net/+/457355
Run-TryBot: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
diff --git a/internal/socks/socks.go b/internal/socks/socks.go
index 97db234..84fcc32 100644
--- a/internal/socks/socks.go
+++ b/internal/socks/socks.go
@@ -289,7 +289,7 @@
case AuthMethodNotRequired:
return nil
case AuthMethodUsernamePassword:
- if len(up.Username) == 0 || len(up.Username) > 255 || len(up.Password) == 0 || len(up.Password) > 255 {
+ if len(up.Username) == 0 || len(up.Username) > 255 || len(up.Password) > 255 {
return errors.New("invalid username/password")
}
b := []byte{authUsernamePasswordVersion}