Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault when basic auth in place #17

Closed
nsteinmetz opened this issue Feb 6, 2018 · 3 comments
Closed

Segfault when basic auth in place #17

nsteinmetz opened this issue Feb 6, 2018 · 3 comments
Labels

Comments

@nsteinmetz
Copy link
Contributor

Hi,

First, thanks for your code, a smart way to embed a portable wait-for-it mechanism and with the support of urls (and not only host:port which may not be sufficient).

Testing your software, I add the following issue with a site having a basic auth mechanism on top of it.

waitforit -address=https://test.mycorp.com/tunnel/tunnel.nocache.js -timeout=60 -retry=500 -debug
2018/02/06 11:41:53 Waiting 60 seconds
2018/02/06 11:41:53 Dial address: test.mycorp.com:443
2018/02/06 11:41:53 ping TCP: test.mycorp.com:443
2018/02/06 11:41:53 Up: test.mycorp.com:443
2018/02/06 11:41:53 HTTP address: https://test.mycorp.com:443/tunnel/tunnel.nocache.js
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x122cadd]

goroutine 5 [running]:
main.pingHTTP(0xc420010370, 0x3c, 0x1f4, 0x12ce7a8, 0x0, 0x0)
	/Users/maxnunes/Development/go/src/github.com/maxcnunes/waitforit/network.go:68 +0x32d
main.DialConn(0xc420010370, 0x3c, 0x1f4, 0x12ce7a8, 0x0, 0x0)
	/Users/maxnunes/Development/go/src/github.com/maxcnunes/waitforit/network.go:47 +0x1d1
main.DialConfigs.func1(0xc420074120, 0x12ce7a8, 0x0, 0x0, 0x50, 0x7ffeefbffbcb, 0x39, 0x3c, 0x1f4)
	/Users/maxnunes/Development/go/src/github.com/maxcnunes/waitforit/network.go:23 +0x7a
created by main.DialConfigs
	/Users/maxnunes/Development/go/src/github.com/maxcnunes/waitforit/network.go:16 +0x11f

Indeed:

curl -I https://test.mycorp.com:443/tunnel/tunnel.nocache.js
HTTP/2 401
content-type: text/plain
www-authenticate: Basic realm="traefik"
content-length: 17
date: Tue, 06 Feb 2018 10:43:25 GMT

Maybe you should either support authentication if possible of if you see a 401 code, exit from process and say it's not supported ?

I think it's a edge case as I will embed the code in my container which are below the auth barrier and will not have to challenge it in normal conditions.

Thanks,
Nicolas

@maxcnunes maxcnunes added the bug label Aug 30, 2018
@maxcnunes
Copy link
Owner

Thanks for the report @nsteinmetz. I will try to work on it once I get some free time (may take a while though). PRs are welcome if anyone wants to get it solved earlier.

@maxcnunes
Copy link
Owner

Added support for headers option at e635952

waitforit \
    -address=http://google.com \
    -header "Authorization: Basic Zm9vOmJhcg==" \
    -header "X-ID: 111" \
    -debug

@nsteinmetz
Copy link
Contributor Author

Cool thanks - will test it next week :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants