mirror of
https://github.com/xzeldon/http-proxy-server.git
synced 2024-12-26 17:05:46 +00:00
fix(main.go): add validation for AUTH_USERNAME and AUTH_PASSWORD to ensure both are provided or neither is provided
This commit is contained in:
parent
cacc311854
commit
8e0a899bf2
4
main.go
4
main.go
@ -116,6 +116,10 @@ func main() {
|
||||
flag.StringVar(&AUTH_PASSWORD, "password", "", "Password for proxy authentication")
|
||||
flag.Parse()
|
||||
|
||||
if (AUTH_USERNAME == "" && AUTH_PASSWORD != "") || (AUTH_USERNAME != "" && AUTH_PASSWORD == "") {
|
||||
log.Fatal("Error: Both username and password must be provided, or neither should be.")
|
||||
}
|
||||
|
||||
server := &http.Server{
|
||||
Addr: ":" + PORT,
|
||||
Handler: http.HandlerFunc(mainHandler),
|
||||
|
Loading…
Reference in New Issue
Block a user