Skip to content

Commit

Permalink
Removed dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
myleshorton committed Dec 19, 2024
1 parent 29111f0 commit f14f33c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 35 deletions.
14 changes: 0 additions & 14 deletions client/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,6 @@ func (client *Client) handle(conn net.Conn) error {
return err
}

func normalizeExoAd(req *http.Request) (*http.Request, bool) {
host, _, err := net.SplitHostPort(req.Host)
if err != nil {
host = req.Host
}
if strings.HasSuffix(host, ".exdynsrv.com") {
qvals := req.URL.Query()
qvals.Set("p", "https://www.getlantern.org/")
req.URL.RawQuery = qvals.Encode()
return req, true
}
return req, false
}

func (client *Client) filter(cs *filters.ConnectionState, req *http.Request, next filters.Next) (*http.Response, *filters.ConnectionState, error) {
if client.isHTTPProxyPort(req) {
log.Debugf("Reject proxy request to myself: %s", req.Host)
Expand Down
21 changes: 0 additions & 21 deletions client/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,6 @@ import (
"github.com/getlantern/httpseverywhere"
)

func TestNormalizeExoAd(t *testing.T) {
doTestNormalizeExoAd(t, "syndication.exdynsrv.com")
doTestNormalizeExoAd(t, "syndication.exdynsrv.com:80")
doTestNormalizeExoAd(t, "syndication.exdynsrv.com:443")

req, _ := http.NewRequest("GET", "http://exdynsrv.com.friendlygfw.cn", nil)
_, ad := normalizeExoAd(req)
assert.False(t, ad)
}

func doTestNormalizeExoAd(t *testing.T, host string) {
req, _ := http.NewRequest("GET", "http://"+host, nil)
qvals := req.URL.Query()
qvals.Set("p", "https://www.somethingelse.com")
req.URL.RawQuery = qvals.Encode()

req2, ad := normalizeExoAd(req)
assert.True(t, ad)
assert.Equal(t, "https://www.getlantern.org/", req2.URL.Query().Get("p"))
}

func TestRewriteHTTPSSuccess(t *testing.T) {
client := newClient()
client.rewriteToHTTPS = httpseverywhere.Eager()
Expand Down

0 comments on commit f14f33c

Please sign in to comment.