<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">On 9 Nov 2015, at 20:45, Roger Dingledine <<a href="mailto:arma@mit.edu" class="">arma@mit.edu</a>> wrote:</div><div class=""><br class=""></div><blockquote type="cite" class=""><div class=""><span class="">On Mon, Nov 09, 2015 at 08:04:55PM +1100, Tim Wilson-Brown - teor wrote:</span><br class=""><blockquote type="cite" class=""><span class="">Subsequent queries get the same IP address for several tens of seconds afterwards.</span><br class=""></blockquote><span class=""></span><br class=""><span class="">Woah. Are we setting the Expires: http header in our Tor answer based on</span><br class=""><span class="">how long we think the *payload* will remain valid, and the proxy in the</span><br class=""><span class="">middle is caching both the payload and the headers for that time?</span><br class=""></div></blockquote><div class=""><br class=""></div>That's what most caches do with unknown headers: cache them for the same period as the payload.<div class=""><br class=""></div><div class="">HTTP 1.0 is silent on whether headers should be cached - it just says content should be cached.</div><div class=""><a href="http://www.w3.org/Protocols/HTTP/1.0/spec.html#Expires" class="">http://www.w3.org/Protocols/HTTP/1.0/spec.html#Expires</a><br class=""><div class=""><br class=""></div><div class="">HTTP 1.1 specifies that headers are cached along with content, except for a few headers that don't get cached. (It also specifies that "not-modified" and similar responses replace headers from the original response. But I doubt that's relevant here.)<div class="">https://tools.ietf.org/html/rfc7234</div><div class=""><br class=""><div class="">For HTTP 1.1 compliant caches, Tor can specifically indicate that X-Your-IP-Address-Is is a hop-by-hop header by using a the "Connection" header like this:</div><div class="">Connection: close X-Your-IP-Address-Is</div><div class="">("close" indicates that Tor doesn't support persistent connections.)</div><div class="">This would cause the X-Your-IP-Address-Is header to not ever be sent out by the cache, not even on the first connection. If Tor sees the IP address of the cache, this is what we want. But if it sees the IP address of the relay, we want the first response to have the X-Your-IP-Address-Is header, and any cached responses to not have it (see below).</div><div class="">https://tools.ietf.org/html/rfc7230#section-6.1</div><div class=""><br class=""></div><div class="">Alternately, we could use:</div><div class="">Cache-Control: no-cache="X-Your-IP-Address-Is"</div><div class="">This is interpreted as a request not to cache the header at all, or, if the no-cache="<header-name>" feature is not supported, it's generally interpreted as a request not to cache the entire document. (This also causes the cache to attempt to revalidate the header, which might not be what we want, as Tor might not support cache revalidation.)</div><div class="">https://tools.ietf.org/html/rfc7234#section-5.2.2</div><div class=""><br class=""></div><div class="">These are HTTP 1.1 features, but Tor provides a HTTP 1.0 response. HTTP 1.1 caches are supposed to handle headers by applying the HTTP 1.1 rules, regardless of the version of the response.</div><div class=""><br class=""></div><div class="">For HTTP 1.0 compliant caches, Tor can disable caching:</div><div class="">Pragma: no-cache</div><div class="">(This will also disable caching for HTTP 1.1 caches unless we provide a more generous Cache-Control header, like the one above.)</div><div class="">https://tools.ietf.org/html/rfc7234#section-5.4</div><div class=""><br class=""></div><div class="">If we disable caching, this will put more load on Faravahar. But at least we'll get correct behaviour.</div><div class=""><br class=""></div><div class="">If we remove the header, some relays might not be able to find their IP address as quickly.</div><div class="">(Do we believe IP addresses from other relays, or just the authorities?)</div><div class=""><br class=""></div><div class="">Tim</div><div class=""><br class=""></div><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Tim Wilson-Brown (teor)</div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">teor2345 at gmail dot com<br class="">PGP 968F094B<br class=""><br class="">teor at blah dot im<br class="">OTR CAD08081 9755866D 89E2A06F E3558B7F B5A9D14F</div></div><div class=""><br class=""></div></div></div></div></body></html>