Squid cache_object:// URI scheme is deprecated
According to Squid documentation, the cache_object:// URI scheme is deprecated.
Squid 6.3 accidentally removed support for legacy cache_object URLs, but Squid 6.4 reinstated support for them (https://github.com/squid-cache/squid/pull/1475), at least for now. Support for the legacy cache_object URLs is slated for final removal in Squid 7.
The modern method of fetching this information is using the squid-internal-mgr URLs with a standard HTTP client. For example, it can be accessed simply with curl (i.e. instead of the legacy / deprecated squidclient tool) as:
curl http://localhost:3128/squid-internal-mgr/counters
Squid has supported this method since version 3.2.0.10, released in July 2011.
Support for the legacy cache_object URLs has already been removed from Squid's master branch, and will thus be absent when Squid 7 is released.
To support Squid 7 and later, squid-exporter needs to implement support for the squid-internal-mgr endpoint via HTTP(S). Since this method has been supported by Squid for well over ten years, I also suggest that it is time for squid-exporter to remove support for the legacy cache_object:// method.
Just for the record, I was planning to refactor squid-exporter's cache_object get() function using a custom HTTP RoundTripper. The reason for needing a custom RoundTripper is that the cache_object:// URI is not RFC-3986 compliant, and is thus rejected by Go's default HTTP transport.
I did get 90% of the way there, but things started to get fiddly with refactoring the client test to use a httptest server (which also would have required a custom RoundTripper to accept the non-compliant cache_object:// URI in the GET request). Given that this legacy code just needs to die, I decided to stop wasting my time on that effort.
I am happy to provide a PR which will drop support for the legacy cache_object:// URI and instead implement support for the squid-internal-mgr style endpoint. Such a PR would likely obsolete a couple of outstanding PRs, and might also inadvertently fix a couple of outstanding issues.
Thanks for looking into this and also providing a PR. I merged your clean up CL but not sadly there is a merge conflict with this CL. I really appreciate it if you can resolve the conflicts and make it possible to merge this one.
Also sorry for getting into this so late, life got in the way :(