orignal
there is no rush
orignal
the network is stable
dr|z3d
fair enough, both re stability and wanting a battle-tested release.
orignal
we plan to make new release becuase sometimes i2pd crashes
dr|z3d_
ok, crashes not so hot, I don't think we're in that zone with java.
orignal
they are rare and on windows only
dr|z3d
ok, could be worse.
dr|z3d
zzz: got a couple of seconds to look some over for me?
dr|z3d
*something
dr|z3d
should be a yes/no type feedback response.. looking at setting default cache-control headers in the http server tunnel if none are set.
zzz
no, I don't believe a proxy should mess with cache-control headers unless it is doing caching, otherwise it knows nothing
dr|z3d
that wasn't the question, but noted :)
zzz
so whats the question
dr|z3d
this is what I've got, does it look like it'll do what I want it to?
dr|z3d
protected static String formatHeaders(Map<String, List<String>> headers, StringBuilder command) {
dr|z3d
StringBuilder buf = new StringBuilder(command.length() + headers.size() * 64);
dr|z3d
buf.append(command.toString().trim()).append("\r\n");
dr|z3d
for (Map.Entry<String, List<String>> e : headers.entrySet()) {
dr|z3d
String name = e.getKey();
dr|z3d
String cacheControlPolicy = "private, no-cache, max-age=604800";
dr|z3d
for(String val: e.getValue()) {
dr|z3d
buf.append(name.trim()).append(": ").append(val.trim()).append("\r\n");
dr|z3d
if (!name.toLowerCase().contains("cache-control")) {
dr|z3d
buf.append("Cache-Control").append(": ").append(cacheControlPolicy).append("\r\n");
dr|z3d
}
dr|z3d
}
dr|z3d
}
zzz
what is it you want to do?
dr|z3d
inject that header into the response headers if there's no cache-control set on the server.
zzz
well, ignoring for the moment that I told you why it's a bad idea, formatHeaders() in used for both directions, so that's not the right place
dr|z3d
ok
dr|z3d
when you say it's not the right place, presumably it would work?
dr|z3d
but given it's the wrong place, could I just shunt the relevant code to the right place?
zzz
if working requires that it happens only in the direction you want, then it doesn't work
zzz
I also caution you not to get adventurous and break the project outproxy
dr|z3d
private static void addEntry(..) looks like a possible candidate.
dr|z3d
ok, so that's adding both request and response headers.
zzz
look above at where we add connection: close if not present
zzz
but not in the mood to help you screw up stormycloud
dr|z3d
thanks, you've helped plenty already. and panic not, nothing's getting screwed :)
zzz
tl;dr we aren't a caching proxy
dr|z3d
if I can get this working as intended, I'll only use it for in-net connections.
dr|z3d
no, we're not a caching proxy, this is true. but the client is capable of caching content where the site operator hasn't bothered to set a policy.
dr|z3d
all the header is saying is "check there's not a fresher copy of the resource, otherwise cache locally for 3 days". I think that's sane in the absence of anything better configured at the server end.
zzz
if you want to implement a caching proxy on the client side then why are you barking up the server side tree?
dr|z3d
for the most part, I doubt it'll have any effect, except where the site operator is either clueless or negligent :)
dr|z3d
I don't want to implement a caching proxy, I just want to fix sites that are hosted without a cache-control header. As you say, the proxy knows nothing.
dr|z3d
I wouldn't have raised the question if I thought I was going to get so much pushback. Anyways, thanks.
zzz
:)