Skip to content

Commit f18c47f

Browse files
authored
Merge pull request #1491 from getlantern/atavism/remove-api-proto
Remove old pro client
2 parents 5616dc8 + 52cb5a2 commit f18c47f

File tree

10 files changed

+0
-2177
lines changed

10 files changed

+0
-2177
lines changed

Diff for: client/handler.go

-27
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,13 @@ import (
55
"errors"
66
"net"
77
"net/http"
8-
"strings"
98
"time"
109

1110
"github.com/getlantern/idletiming"
1211
"github.com/getlantern/proxy/v3/filters"
1312

1413
"github.com/getlantern/flashlight/v7/chained"
15-
"github.com/getlantern/flashlight/v7/common"
1614
"github.com/getlantern/flashlight/v7/ops"
17-
"github.com/getlantern/flashlight/v7/pro"
1815
)
1916

2017
func (client *Client) handle(conn net.Conn) error {
@@ -47,11 +44,6 @@ func (client *Client) filter(cs *filters.ConnectionState, req *http.Request, nex
4744
req.URL.Scheme = "http"
4845
req.URL.Host = req.Host
4946

50-
if common.Platform == "android" && req.URL != nil && req.URL.Host == "localhost" &&
51-
strings.HasPrefix(req.URL.Path, "/pro/") {
52-
return client.interceptProRequest(cs, req)
53-
}
54-
5547
op, ok := client.opsMap.get(cs.Downstream())
5648
if ok {
5749
op.UserAgent(req.Header.Get("User-Agent")).OriginFromRequest(req)
@@ -118,25 +110,6 @@ func (client *Client) isHTTPProxyPort(r *http.Request) bool {
118110
return false
119111
}
120112

121-
// interceptProRequest specifically looks for and properly handles pro server
122-
// requests (similar to desktop's APIHandler)
123-
func (client *Client) interceptProRequest(cs *filters.ConnectionState, r *http.Request) (*http.Response, *filters.ConnectionState, error) {
124-
log.Debugf("Intercepting request to pro server: %v", r.URL.Path)
125-
// Strip /pro from path.
126-
r.URL.Path = r.URL.Path[4:]
127-
pro.PrepareProRequest(r, client.user)
128-
r.Header.Del("Origin")
129-
resp, err := common.GetHTTPClient().Do(r)
130-
if err != nil {
131-
log.Errorf("Error intercepting request to pro server: %v", err)
132-
resp = &http.Response{
133-
StatusCode: http.StatusInternalServerError,
134-
Close: true,
135-
}
136-
}
137-
return filters.ShortCircuit(cs, r, resp)
138-
}
139-
140113
func (client *Client) redirectHTTPS(cs *filters.ConnectionState, req *http.Request, httpsURL string, op *ops.Op) (*http.Response, *filters.ConnectionState, error) {
141114
log.Debugf("httpseverywhere redirecting to %v", httpsURL)
142115
if op != nil {

0 commit comments

Comments
 (0)