Thanks for the quick reply Adam!
Yes, looking at HttpRequestHandler, I can see that the Via http header
is added when the HttpRequest object is copied using
copyHttpRequest(...) during HttpRequestHandler.processMessage(...).
Probably the most elegant way to prevent this would be to to add an
implementation of HttpRequestFilter which strips out the via header (a
simple one-liner):
httpRequest.removeHeader(HttpHeaders.Names.VIA));
This is effective as the filter call happens after the copy, and
probably better than making any code changes as it preserves the
purity of your proxy code (using it as an anonymizer breaks the
compliance should probably be considered a customisation rather than a
feature). The only downside is a very slight performance hit from
adding and then removing the http header.
The only other issue i have is that the copyHttpRequest strips the
hostname from the uri before forwarding it. Again, it's easy to
reverse this in the filter, but i was wondering why you decided to do
this as a default behaviour?
I'm happy to add this functionality as a property in
littleshoot.properties, a lookup could be done in
DefaultHttpProxyServer to see if the anonymizing HttpRequestFilter
should be added (only if no filter is provided). Let me know if thats
what you'd like... and if there are any other considerations for an
anonymizer that i've missed.
I haven't tried this yet, i've only looked at the code so ofc it might
not work...
Thanks for the help,
James