diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-02-24 23:55:03 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-05-10 21:08:27 +0200 |
commit | 5c2e9795f3a8f09c7f53dcdb15933bb51b26d680 (patch) | |
tree | 0c6fb42a9b7f609a42db3bc7afa512ab7c3e10c5 /tunnel/tools/libwg-go/service.go | |
parent | 249163daf8eecabd1b79c45a7790a41de5cabebe (diff) |
tunnel: download pac in java
Diffstat (limited to 'tunnel/tools/libwg-go/service.go')
-rw-r--r-- | tunnel/tools/libwg-go/service.go | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/tunnel/tools/libwg-go/service.go b/tunnel/tools/libwg-go/service.go index e49081e7..f5460486 100644 --- a/tunnel/tools/libwg-go/service.go +++ b/tunnel/tools/libwg-go/service.go @@ -121,14 +121,21 @@ func (e *LibwgServiceImpl) StartHttpProxy(ctx context.Context, req *gen.StartHtt listenPort = e.httpProxy.GetAddrPort().Port() } - pacFileUrl, err := url.Parse(req.PacFileUrl) - if err != nil { - return buildStartHttpProxyError(fmt.Sprintf("Bad pacFileUrl: %v (%s)", err, req.PacFileUrl)) - } - - err = e.httpProxy.SetPacFileUrl(pacFileUrl) - if err != nil { - return buildStartHttpProxyError(fmt.Sprintf("Bad pacFileUrl: %v (%s)", req.PacFileUrl)) + content := req.GetPacFileContent() + if content != "" { + err := e.httpProxy.SetPacFileContent(content) + if err != nil { + return buildStartHttpProxyError(fmt.Sprintf("Bad pacFileContent: %v (%s)", content)) + } + } else { + pacFileUrl, err := url.Parse(req.GetPacFileUrl()) + if err != nil { + return buildStartHttpProxyError(fmt.Sprintf("Bad pacFileUrl: %v (%s)", err, req.GetPacFileUrl())) + } + err = e.httpProxy.SetPacFileUrl(pacFileUrl) + if err != nil { + return buildStartHttpProxyError(fmt.Sprintf("Bad pacFileUrl: %v (%s)", err, pacFileUrl)) + } } r := &gen.StartHttpProxyResponse{ |