@@ -15,7 +15,7 @@ import (
1515)
1616
1717const (
18- baseStoreURL = "https://login.argotunnel.com /"
18+ baseStoreURL = "https://login.cloudflareaccess.org /"
1919 clientTimeout = time .Second * 60
2020)
2121
@@ -83,11 +83,13 @@ func buildRequestURL(baseURL *url.URL, key, value string, cli, useHostOnly bool)
8383 if useHostOnly {
8484 baseURL .Path = ""
8585 }
86+ // TODO: pass arg for tunnel login
8687 if ! cli {
8788 return baseURL .String (), nil
8889 }
8990 q .Set ("redirect_url" , baseURL .String ()) // we add the token as a query param on both the redirect_url and the main url
9091 q .Set ("send_org_token" , "true" ) // indicates that the cli endpoint should return both the org and app token
92+ q .Set ("edge_token_transfer" , "true" ) // use new LoginHelper service built on workers
9193 baseURL .RawQuery = q .Encode () // and this actual baseURL.
9294 baseURL .Path = "cdn-cgi/access/cli"
9395 return baseURL .String (), nil
@@ -103,9 +105,6 @@ func transferRequest(requestURL string, log *zerolog.Logger) ([]byte, string, er
103105 if err != nil {
104106 return nil , "" , err
105107 } else if len (buf ) > 0 {
106- if err := putSuccess (client , requestURL ); err != nil {
107- log .Err (err ).Msg ("Failed to update resource success" )
108- }
109108 return buf , key , nil
110109 }
111110 }
@@ -136,22 +135,3 @@ func poll(client *http.Client, requestURL string, log *zerolog.Logger) ([]byte,
136135 }
137136 return buf .Bytes (), resp .Header .Get ("service-public-key" ), nil
138137}
139-
140- // putSuccess tells the server we successfully downloaded the resource
141- func putSuccess (client * http.Client , requestURL string ) error {
142- req , err := http .NewRequest ("PUT" , requestURL + "/ok" , nil )
143- if err != nil {
144- return err
145- }
146-
147- resp , err := client .Do (req )
148- if err != nil {
149- return err
150- }
151-
152- resp .Body .Close ()
153- if resp .StatusCode != 200 {
154- return fmt .Errorf ("HTTP Response Status Code: %d" , resp .StatusCode )
155- }
156- return nil
157- }
0 commit comments