samuong / alpaca

A local HTTP proxy for command-line tools. Supports PAC scripts and NTLM authentication.
Apache License 2.0
196 stars 35 forks source link

Remove bare string used as context key. #17

Closed anzdaddy closed 3 years ago

anzdaddy commented 5 years ago

The following code uses a bare string as a context key. This is a bug.

https://github.com/samuong/alpaca/blob/8ac2ded38992c1795572fe4aba38eafaed7521c7/proxyfinder_test.go#L35

https://github.com/samuong/alpaca/blob/7d23c7f4fa7937c229d0cf5fe65a77d0dfa54abb/proxy.go#L41

camh- commented 5 years ago

Also, as per @anzdaddy's comment on #16: "https://golang.org/pkg/sync/atomic/#AddUint64 would be simpler, probably faster and won't leak a goroutine."

While there, may as well fix that too.