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

HTTP 400 response causes segfault #9

Open
thsutton opened this issue Jun 9, 2017 · 0 comments
Open

HTTP 400 response causes segfault #9

thsutton opened this issue Jun 9, 2017 · 0 comments

Comments

@thsutton
Copy link

thsutton commented Jun 9, 2017

Attempting to use WSD with an endpoint that returns an HTTP 400 Bad Request results in a segfault. It probably ought to detect non-OK responses and report them appropriately.

$ curl -s --include  "http://localhost:9080/ws-bi-stream?products=elephant"
HTTP/1.1 400 Bad Request
Server: myapp
Date: Fri, 09 Jun 2017 01:55:05 GMT
Content-Type: text/plain; charset=UTF-8
Content-Length: 51

Invalid request:

'elephant' is not a valid product
$ ./wsd.exe -url "ws://localhost:9080/ws-bi-stream?products=elephant"
connecting to ws://localhost:9080/ws-bi-stream?products=elephant from http://localhost/...
panic: websocket.Dial ws://localhost:9080/ws-bi-stream?products=elephant: bad status
        panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x68 pc=0x5e122d]

goroutine 1 [running]:
golang.org/x/net/websocket.(*Conn).Close(0x0, 0x2, 0x2)
        .../go/src/golang.org/x/net/websocket/websocket.go:236 +0x2d
panic(0x61a940, 0xc0420da340)
        C:/Go/src/runtime/panic.go:489 +0x2dd
main.main()
        .../wsd/main.go:126 +0xbaa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant