diff --git a/example_config.yaml b/example_config.yaml index 4116a99..3e455a6 100644 --- a/example_config.yaml +++ b/example_config.yaml @@ -36,6 +36,16 @@ chihaya: # Disabling this should increase performance/decrease load. enable_request_timing: false + # Whether to listen on /announce.php and /scrape.php in addition to their + # non-.php counterparts. + # This is an option for compatibility with (very) old clients or otherwise + # outdated systems. + # This might be useful to retracker.local users, for more information see + # http://rutracker.wiki/Оптимизация_обмена_битторрент_траффиком_в_локальных_сетях + # and + # http://rutracker.wiki/Retracker.local + enable_legacy_php_urls: false + # When enabled, the IP address used to connect to the tracker will not # override the value clients advertise as their IP address. allow_ip_spoofing: false diff --git a/frontend/http/frontend.go b/frontend/http/frontend.go index 1ed1323..fc4957e 100644 --- a/frontend/http/frontend.go +++ b/frontend/http/frontend.go @@ -64,6 +64,7 @@ type Config struct { WriteTimeout time.Duration `yaml:"write_timeout"` TLSCertPath string `yaml:"tls_cert_path"` TLSKeyPath string `yaml:"tls_key_path"` + EnableLegacyPHPURLs bool `yaml:"enable_legacy_php_urls"` EnableRequestTiming bool `yaml:"enable_request_timing"` ParseOptions `yaml:",inline"` } @@ -76,6 +77,7 @@ func (cfg Config) LogFields() log.Fields { "writeTimeout": cfg.WriteTimeout, "tlsCertPath": cfg.TLSCertPath, "tlsKeyPath": cfg.TLSKeyPath, + "enableLegacyPHPURLs": cfg.EnableLegacyPHPURLs, "enableRequestTiming": cfg.EnableRequestTiming, "allowIPSpoofing": cfg.AllowIPSpoofing, "realIPHeader": cfg.RealIPHeader, @@ -177,6 +179,13 @@ func (f *Frontend) handler() http.Handler { router := httprouter.New() router.GET("/announce", f.announceRoute) router.GET("/scrape", f.scrapeRoute) + + if f.EnableLegacyPHPURLs { + log.Info("http: enabling legacy PHP URLs") + router.GET("/announce.php", f.announceRoute) + router.GET("/scrape.php", f.scrapeRoute) + } + return router }