Skip to content

Commit

Permalink
More fixes #3071
Browse files Browse the repository at this point in the history
  • Loading branch information
myleshorton committed Aug 31, 2015
1 parent 8e10bff commit f76c07f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/github.com/getlantern/enproxy/conn_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"net"
"net/http"
"net/http/httputil"
"runtime"

"code.google.com/p/go-uuid/uuid"
"github.com/getlantern/idletiming"
Expand Down
16 changes: 6 additions & 10 deletions src/github.com/getlantern/flashlight/geolookup/geolookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ package geolookup

import (
"fmt"
"io/ioutil"
"math"
"math/rand"
"net/http"
"net/http/httputil"
"sync"
"sync/atomic"
"time"

"github.com/getlantern/enproxy"
"github.com/getlantern/golog"

"github.com/getlantern/flashlight/pubsub"
Expand Down Expand Up @@ -104,9 +103,6 @@ func lookupIp(httpClient *http.Client) (string, string, error) {
return "", "", fmt.Errorf("Could not create request: %q", err)
}

// Enproxy returns an error if this isn't there.
req.Header.Set(enproxy.X_ENPROXY_ID, "1")

if resp, err = httpClient.Do(req); err != nil {
return "", "", fmt.Errorf("Could not get response from server: %q", err)
}
Expand All @@ -117,12 +113,12 @@ func lookupIp(httpClient *http.Client) (string, string, error) {
}()

if resp.StatusCode != http.StatusOK {
body := "body unreadable"
b, err := ioutil.ReadAll(resp.Body)
if err == nil {
body = string(b)
if full, err := httputil.DumpResponse(resp, true); err != nil {
log.Errorf("Could not read full response %v", err)
} else {
log.Errorf("Unexpected response to geo IP lookup: %v", string(full))
}
return "", "", fmt.Errorf("Unexpected response status %d: %v", resp.StatusCode, body)
return "", "", fmt.Errorf("Unexpected response status %d", resp.StatusCode)
}

ip := resp.Header.Get("Lantern-Ip")
Expand Down

0 comments on commit f76c07f

Please sign in to comment.