JuliaLang / Downloads.jl

MIT License
89 stars 34 forks source link

Ability to rewrite all urls #208

Open habemus-papadum opened 1 year ago

habemus-papadum commented 1 year ago

Hi, small feature request/proposal -- it would be useful to be able to have a hook so that all urls could be re-written prior to download e.g. https://www.foo.bar/bazz?q=2 --> https://www.foo.bar.myproxy.local/bazz?q=2

perhaps provided by a new function Downloads.url_rewriter!(f::Function) ## f::string->string

While this could be also achieved by using default_downloader! provided in #207, this seems brittle (side note -- implementing it at that level would require Easy.get_url)

This would be a pretty small change but opens up the question of how much global state is desired in this package, where should it live (e.g. as a global URL_REWRITER or implicitly embedded into the default downloader, or maybe there should be a global stack of easy_hooks that are always applied prior to the hooks attached to the Downloader)

Curious to gather thoughts/interest prior to starting work.

Thanks!

habemus-papadum commented 1 year ago

Addressed in #209