alexanderGugel / alexanderGugel/wsd

HTTP 400 response causes segfault

Aperta
#9 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
423
Fork
29
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.