@@ -43,6 +43,7 @@ type ProxySettings struct {
4343 LegacyHTDOCSPath string `json:"legacyHTDOCSPath"`
4444 LegacyCGIBINPath string `json:"legacyCGIBINPath"`
4545 PhpCgiPath string `json:"phpCgiPath"`
46+ OverridePaths []string `json:"overridePaths"`
4647}
4748
4849// ExtApplicationTypes is a map that holds the content types of different file extensions
@@ -164,7 +165,7 @@ func main() {
164165 newURL .Host = "127.0.0.1:" + proxySettings .ServerHTTPSPort
165166 }
166167
167- //Make the request to the zip server.
168+ // Make the request to the zip server.
168169 client := & http.Client {}
169170 proxyReq , err := http .NewRequest (r .Method , newURL .String (), r .Body )
170171 proxyReq .Header = r .Header
@@ -174,43 +175,39 @@ func main() {
174175 fmt .Printf ("\t Serving from Zip...\n " )
175176 }
176177
177- //Check Legacy
178+ // Check Legacy
178179 if proxyResp .StatusCode >= 400 {
179180 fmt .Printf ("\t Serving from Legacy...\n " )
180181
181- //Decide on the port to use
182- port := proxySettings .LegacyGoPort
183- if proxySettings .LegacyUsePHPServer {
184- port = proxySettings .LegacyPHPPort
185- }
182+ port := proxySettings .LegacyPHPPort
186183
187- //Set the Proxy URL and apply it to the Transpor layer so that the request respects the proxy.
184+ // Set the Proxy URL and apply it to the Transpor layer so that the request respects the proxy.
188185 proxyURL , _ := url .Parse ("http://127.0.0.1:" + port )
189186 proxy := http .ProxyURL (proxyURL )
190187 transport := & http.Transport {Proxy : proxy }
191188
192- //A custom Dialer is required for the "localflash" urls, instead of using the DNS, we use this.
189+ // A custom Dialer is required for the "localflash" urls, instead of using the DNS, we use this.
193190 transport .DialContext = func (ctx context.Context , network , addr string ) (net.Conn , error ) {
194191 //Set Dialer timeout and keepalive to 30 seconds and force the address to localhost.
195192 dialer := & net.Dialer {Timeout : 30 * time .Second , KeepAlive : 30 * time .Second }
196193 addr = "127.0.0.1:" + port
197194 return dialer .DialContext (ctx , network , addr )
198195 }
199196
200- //TODO: Investigate if I need to blank this out... I don't think this is required.
197+ // TODO: Investigate if I need to blank this out... I don't think this is required.
201198 r .RequestURI = ""
202199
203- //Make the request with the custom transport.
200+ // Make the request with the custom transport.
204201 client := & http.Client {Transport : transport , Timeout : 300 * time .Second }
205202 proxyResp , err = client .Do (r )
206203 }
207204
208- //An error occured, log it for debug purposes
205+ // An error occured, log it for debug purposes
209206 if err != nil {
210207 fmt .Printf ("UNHANDLED ERROR: %s\n " , err )
211208 }
212209
213- //Update the content type based upon ext for now.
210+ // Update the content type based upon ext for now.
214211 setContentType (r , proxyResp )
215212 return r , proxyResp
216213 })
@@ -228,6 +225,7 @@ func main() {
228225 proxySettings .GameRootPath ,
229226 proxySettings .PhpCgiPath ,
230227 proxySettings .ExtMimeTypes ,
228+ proxySettings .OverridePaths ,
231229 ),
232230 ))
233231 }()
@@ -284,3 +282,7 @@ func runLegacyPHP() {
284282
285283 wg .Wait ()
286284}
285+
286+ func serveOverrideFile (w http.ResponseWriter , r * http.Request ) {
287+
288+ }
0 commit comments