forked from Ivasoft/opds-proxy
Kobo eReaders have a buggy browser that makes 2 requests for the same HTTP resource when you click a link. This change ensures that requests within a certain time frame from the same IP, for the same path / query params will only be executed a single time. We record the http request response and replay it for the second request. If we get 2 simultaneous requests, we use the sync/singleflight library to ensure only the first request is actually processed. The second waits for the shared result of the first. This probably adds latency since some requests are blocked while we determine if we already have a cache entry, but for a simple service like this I don't think it matters.
37 lines
992 B
Modula-2
37 lines
992 B
Modula-2
module github.com/evan-buss/opds-proxy
|
|
|
|
go 1.22
|
|
|
|
require (
|
|
github.com/knadh/koanf/parsers/yaml v0.1.0
|
|
github.com/knadh/koanf/providers/file v1.1.0
|
|
github.com/knadh/koanf/v2 v2.1.1
|
|
)
|
|
|
|
require (
|
|
github.com/gorilla/securecookie v1.1.2
|
|
github.com/spf13/pflag v1.0.5
|
|
)
|
|
|
|
require (
|
|
github.com/tidwall/gjson v1.14.2 // indirect
|
|
github.com/tidwall/match v1.1.1 // indirect
|
|
github.com/tidwall/pretty v1.2.0 // indirect
|
|
)
|
|
|
|
require (
|
|
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
|
github.com/go-task/slim-sprig/v3 v3.0.0
|
|
github.com/go-viper/mapstructure/v2 v2.0.0 // indirect
|
|
github.com/google/uuid v1.6.0
|
|
github.com/knadh/koanf/maps v0.1.1 // indirect
|
|
github.com/knadh/koanf/parsers/json v0.1.0
|
|
github.com/knadh/koanf/providers/posflag v0.1.0
|
|
github.com/mitchellh/copystructure v1.2.0 // indirect
|
|
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
|
github.com/tidwall/sjson v1.2.5
|
|
golang.org/x/sync v0.8.0
|
|
golang.org/x/sys v0.22.0 // indirect
|
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
|
)
|