From 765dbb443d3c067e8a0455125ccf9f0c3f82a4c1 Mon Sep 17 00:00:00 2001 From: David Hill Date: Wed, 23 Apr 2014 18:08:57 -0400 Subject: [PATCH] Fix a bug in fetching the XML URL. In Discover, the reponse was lowercased for comparison. However, this caused a 404 - Not found when fetching the url provided by the location header if the url contained uppercase. ok @owainga --- upnp.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/upnp.go b/upnp.go index 269ac7ed..86a2748c 100644 --- a/upnp.go +++ b/upnp.go @@ -110,8 +110,7 @@ func Discover() (nat NAT, err error) { // HTTP header field names are case-insensitive. // http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 locString := "\r\nlocation: " - answer = strings.ToLower(answer) - locIndex := strings.Index(answer, locString) + locIndex := strings.Index(strings.ToLower(answer), locString) if locIndex < 0 { continue }