From be116b561321cddc1e1a474e6cefcbf58b7b5e44 Mon Sep 17 00:00:00 2001 From: Christopher Davis Date: Sun, 24 Jan 2010 01:24:53 -0800 Subject: [PATCH] Change proxyPrivacy to dontIdentifyToClients; restore local hostname detection. --- client.c | 8 ++++---- http.c | 23 ++++++++++++++--------- http.h | 3 ++- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/client.c b/client.c index 00f9e9c..3f450d3 100644 --- a/client.c +++ b/client.c @@ -1756,7 +1756,7 @@ httpServeObject(HTTPConnectionPtr connection) if((object->flags & OBJECT_FAILED) && !proxyOffline) { n = snnprintf(connection->buf, n, bufsize, "\r\nWarning: 111 %s Revalidation failed", - proxyName->string); + getScrubbedProxyName()); if(request->error_code) n = snnprintf(connection->buf, n, bufsize, " (%d %s)", @@ -1767,16 +1767,16 @@ httpServeObject(HTTPConnectionPtr connection) objectMustRevalidate(object, &request->cache_control)) { n = snnprintf(connection->buf, n, bufsize, "\r\nWarning: 112 %s Disconnected operation", - proxyName->string); + getScrubbedProxyName()); } else if(objectIsStale(object, &request->cache_control)) { n = snnprintf(connection->buf, n, bufsize, "\r\nWarning: 110 %s Object is stale", - proxyName->string); + getScrubbedProxyName()); } else if(object->expires < 0 && object->max_age < 0 && object->age < current_time.tv_sec - 24 * 3600) { n = snnprintf(connection->buf, n, bufsize, "\r\nWarning: 113 %s Heuristic expiration", - proxyName->string); + getScrubbedProxyName()); } } diff --git a/http.c b/http.c index e30ae1f..ca30095 100644 --- a/http.c +++ b/http.c @@ -60,7 +60,7 @@ int proxyOffline = 0; int relaxTransparency = 0; AtomPtr proxyAddress = NULL; -int proxyPrivacy = 0; +int dontIdentifyToClients = 0; static int timeoutSetter(ConfigVariablePtr var, void *value); @@ -107,9 +107,9 @@ preinitHttp() "Don't use Via headers."); CONFIG_VARIABLE(dontTrustVaryETag, CONFIG_TRISTATE, "Whether to trust the ETag when there's Vary."); - CONFIG_VARIABLE(proxyPrivacy, CONFIG_BOOLEAN, - "Set to avoid transmitting hostname, port, timezone, " - "etc."); + CONFIG_VARIABLE(dontIdentifyToClients, CONFIG_BOOLEAN, + "Avoid sending machine-identifiable information " + "to clients."); preinitHttpParser(); } @@ -180,10 +180,6 @@ initHttp() if(proxyName) return; - else if(proxyPrivacy) { - proxyName = internAtom("polipo"); - return; - } buf = get_chunk(); if(buf == NULL) { @@ -895,7 +891,7 @@ httpWriteErrorHeaders(char *buf, int size, int offset, int do_body, ":

" "\n%3d %s

", code, htmlMessage); - if (!proxyPrivacy) { + if (!dontIdentifyToClients) { char timeStr[100]; /* On BSD systems, tv_sec is a long. */ const time_t ct = current_time.tv_sec; @@ -1088,3 +1084,12 @@ httpHeaderMatch(AtomPtr header, AtomPtr headers1, AtomPtr headers2) return 1; } + +const char * +getScrubbedProxyName(void) +{ + if(dontIdentifyToClients) + return "polipo"; + + return proxyName->string; +} diff --git a/http.h b/http.h index e918ba2..9ffeeba 100644 --- a/http.h +++ b/http.h @@ -140,7 +140,7 @@ extern int expectContinue; extern AtomPtr atom100Continue; extern int disableVia; extern int dontTrustVaryETag; -extern int proxyPrivacy; +extern int dontIdentifyToClients; void preinitHttp(void); void initHttp(void); @@ -174,3 +174,4 @@ int httpWriteErrorHeaders(char *buf, int size, int offset, int do_body, AtomListPtr urlDecode(char*, int); void httpTweakCachability(ObjectPtr); int httpHeaderMatch(AtomPtr header, AtomPtr headers1, AtomPtr headers2); +const char *getScrubbedProxyName(void); -- 2.11.4.GIT