proxy protocol: added an option to make the proxy header required

now we can configure SFTPGo to accept or reject requests without the proxy
header when the proxy protocol is enabled
This commit is contained in:
Nicola Murino
2020-02-29 00:02:06 +01:00
parent 830e3d1f64
commit 7163fde724
7 changed files with 94 additions and 16 deletions

View File

@@ -1709,3 +1709,18 @@ func TestSFTPExtensions(t *testing.T) {
}
sftpExtensions = initialSFTPExtensions
}
func TestProxyProtocolVersion(t *testing.T) {
c := Configuration{
ProxyProtocol: 1,
}
proxyListener := c.getProxyListener(nil)
if proxyListener.Policy != nil {
t.Error("proxy listener policy must be nil")
}
c.ProxyProtocol = 2
proxyListener = c.getProxyListener(nil)
if proxyListener.Policy == nil {
t.Error("proxy listener policy must be not nil")
}
}