Don't crash on error response to UPnP query (fixes #226)

This commit is contained in:
Jakob Borg 2014-05-16 19:04:32 +02:00
parent 40c750141a
commit 78f0f2b131

View File

@ -87,6 +87,9 @@ Mx: 3
reader := bufio.NewReader(bytes.NewBuffer(resp[:n])) reader := bufio.NewReader(bytes.NewBuffer(resp[:n]))
request := &http.Request{} request := &http.Request{}
response, err := http.ReadResponse(reader, request) response, err := http.ReadResponse(reader, request)
if err != nil {
return nil, err
}
if response.Header.Get("St") != "urn:schemas-upnp-org:device:InternetGatewayDevice:1" { if response.Header.Get("St") != "urn:schemas-upnp-org:device:InternetGatewayDevice:1" {
return nil, errors.New("no igd") return nil, errors.New("no igd")