<style>
/* Changing the layout to use less space for mobiles */
@media screen and (max-device-width: 480px), screen and (-webkit-min-device-pixel-ratio: 2) {
#email-body { min-width: 30em !important; }
#email-page { padding: 8px !important; }
#email-banner { padding: 8px 8px 0 8px !important; }
#email-avatar { margin: 1px 8px 8px 0 !important; padding: 0 !important; }
#email-fields { padding: 0 8px 8px 8px !important; }
#email-gutter { width: 0 !important; }
}
</style>
<div id="email-body">
<table id="email-wrap" align="center" border="0" cellpadding="0" cellspacing="0" style="background-color:#f0f0f0;color:#000000;width:100%;">
<tr valign="top">
<td id="email-page" style="padding:16px !important;">
<table align="center" border="0" cellpadding="0" cellspacing="0" style="background-color:#ffffff;border:1px solid #bbbbbb;color:#000000;width:100%;">
<tr valign="top">
<td bgcolor="#ffffff" style="background-color:#ffffff;color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;line-height:1;"><img src="https://shibboleth.net/images/shib_240x83.png" alt="" style="vertical-align:top;" /></td>
</tr><tr valign="top">
<td id="email-banner" style="padding:32px 32px 0 32px;">
<table align="left" border="0" cellpadding="0" cellspacing="0" width="100%" style="width:100%;">
<tr valign="top">
<td style="color:#505050;font-family:Arial,FreeSans,Helvetica,sans-serif;padding:0;">
<img id="email-avatar" src="https://issues.shibboleth.net/jira/secure/useravatar?avatarId=10202" alt="" height="48" width="48" border="0" align="left" style="padding:0;margin: 0 16px 16px 0;" />
<div id="email-action" style="padding: 0 0 8px 0;font-size:12px;line-height:18px;">
<a class="user-hover" rel="zccx04fxbfekk/ldylvfqohcyf4=@https://aai-logon.switch.ch/idp/shibboleth" id="email_zccx04fxbfekk/ldylvfqohcyf4=@https://aai-logon.switch.ch/idp/shibboleth" href="https://issues.shibboleth.net/jira/secure/ViewProfile.jspa?name=zccx04fxbfekk%2Fldylvfqohcyf4%3D%40https%3A%2F%2Faai-logon.switch.ch%2Fidp%2Fshibboleth" style="color:#326ca6;">Kaspar Brand</a>
commented on <img src="https://issues.shibboleth.net/jira/images/icons/issuetypes/task.png" height="16" width="16" border="0" align="absmiddle" alt="Task"> <a style='color:#326ca6;text-decoration:none;' href='https://issues.shibboleth.net/jira/browse/JSE-7'>JSE-7</a>
</div>
<div id="email-summary" style="font-size:16px;line-height:20px;padding:2px 0 16px 0;">
<a style='color:#326ca6;text-decoration:none;' href='https://issues.shibboleth.net/jira/browse/JSE-7'><strong>Recast [FileBacked]HttpResource to use conditional gets, not pointless HEADS</strong></a>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr valign="top">
<td id="email-fields" style="padding:0 32px 32px 32px;">
<table border="0" cellpadding="0" cellspacing="0" style="padding:0;text-align:left;width:100%;" width="100%">
<tr valign="top">
<td id="email-gutter" style="width:64px;white-space:nowrap;"></td>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td colspan="2" style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 16px 0;width:100%;">
<div class="comment-block" style="background-color:#edf5ff;border:1px solid #dddddd;color:#000000;padding:12px;"><p>I gave it a try with today's snapshot (i.e. 3.0-20141013.065912-145). My current findings:</p>
<p>1) the IdP distribution currently lacks httpclient-cache-*.jar, which implements the caching client(s)</p>
<p>2) switching to a caching client will indeed "short-circuit" GET requests with the <tt>HTTPResource</tt>, i.e. usually only the first of the three GETs will hit the server. There's a problem with the subsequent requests, however: instead of using the "origin-form" for the request target, they use the "absolute-form" (RFC 7230, section 5.3). Specifically, this is what can be seen in the process.log:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>2014-10-13 12:25:49,065 - DEBUG [net.shibboleth.ext.spring.resource.FileBackedHTTPResource:131] - FileBackedHTTPResource [https://host.example.net/attribute-filter.xml|URL [file:/opt/shibboleth-idp/conf/attribute-filter.remote.xml]]: Attempting to fetch HTTP resource
2014-10-13 12:25:49,251 - DEBUG [org.apache.http.headers:124] - http-outgoing-0 >> GET /attribute-filter.xml HTTP/1.1
2014-10-13 12:25:49,251 - DEBUG [org.apache.http.headers:127] - http-outgoing-0 >> Host: host.example.net
2014-10-13 12:25:49,288 - DEBUG [net.shibboleth.ext.spring.resource.HTTPResource:137] - The response came from an upstream server
2014-10-13 12:25:49,289 - DEBUG [net.shibboleth.ext.spring.resource.HTTPResource:257] - Attempting to fetch remote resource as 'https://host.example.net/attribute-filter.xml'
2014-10-13 12:25:49,291 - DEBUG [net.shibboleth.ext.spring.resource.HTTPResource:131] - A response was generated from the cache with no requests sent upstream
2014-10-13 12:25:49,296 - DEBUG [net.shibboleth.ext.spring.resource.HTTPResource:155] - Attempting to get data from remote resource 'https://host.example.net/attribute-filter.xml'
2014-10-13 12:25:49,298 - DEBUG [net.shibboleth.ext.spring.resource.HTTPResource:131] - A response was generated from the cache with no requests sent upstream
2014-10-13 12:25:49,298 - DEBUG [net.shibboleth.ext.spring.resource.FileBackedHTTPResource:99] - FileBackedHTTPResource [https://host.example.net/attribute-filter.xml|URL [file:/opt/shibboleth-idp/conf/attribute-filter.remote.xml]]: Copying file.
2014-10-13 12:25:49,301 - DEBUG [net.shibboleth.ext.spring.resource.FileBackedHTTPResource:101] - FileBackedHTTPResource [https://host.example.net/attribute-filter.xml|URL [file:/opt/shibboleth-idp/conf/attribute-filter.remote.xml]]: Copy done.
2014-10-13 12:30:49,447 - DEBUG [net.shibboleth.ext.spring.resource.FileBackedHTTPResource:131] - FileBackedHTTPResource [https://host.example.net/attribute-filter.xml|URL [file:/opt/shibboleth-idp/conf/attribute-filter.remote.xml]]: Attempting to fetch HTTP resource
2014-10-13 12:30:49,507 - DEBUG [org.apache.http.headers:124] - http-outgoing-2 >> GET https://host.example.net/attribute-filter.xml HTTP/1.1
2014-10-13 12:30:49,509 - DEBUG [org.apache.http.headers:127] - http-outgoing-2 >> Host: host.example.net
2014-10-13 12:30:49,519 - DEBUG [net.shibboleth.ext.spring.resource.HTTPResource:140] - The response was generated from the cache after validating the entry with the origin server
2014-10-13 12:30:49,519 - DEBUG [net.shibboleth.ext.spring.resource.HTTPResource:257] - Attempting to fetch remote resource as 'https://host.example.net/attribute-filter.xml'
2014-10-13 12:30:49,521 - DEBUG [net.shibboleth.ext.spring.resource.HTTPResource:131] - A response was generated from the cache with no requests sent upstream
2014-10-13 12:35:49,446 - DEBUG [net.shibboleth.ext.spring.resource.FileBackedHTTPResource:131] - FileBackedHTTPResource [https://host.example.net/attribute-filter.xml|URL [file:/opt/shibboleth-idp/conf/attribute-filter.remote.xml]]: Attempting to fetch HTTP resource
2014-10-13 12:35:49,448 - DEBUG [net.shibboleth.ext.spring.resource.HTTPResource:131] - A response was generated from the cache with no requests sent upstream
2014-10-13 12:35:49,448 - DEBUG [net.shibboleth.ext.spring.resource.HTTPResource:257] - Attempting to fetch remote resource as 'https://host.example.net/attribute-filter.xml'
2014-10-13 12:35:49,450 - DEBUG [net.shibboleth.ext.spring.resource.HTTPResource:131] - A response was generated from the cache with no requests sent upstream
2014-10-13 12:40:49,446 - DEBUG [net.shibboleth.ext.spring.resource.FileBackedHTTPResource:131] - FileBackedHTTPResource [https://host.example.net/attribute-filter.xml|URL [file:/opt/shibboleth-idp/conf/attribute-filter.remote.xml]]: Attempting to fetch HTTP resource
2014-10-13 12:40:49,509 - DEBUG [org.apache.http.headers:124] - http-outgoing-3 >> GET https://host.example.net/attribute-filter.xml HTTP/1.1
2014-10-13 12:40:49,509 - DEBUG [org.apache.http.headers:127] - http-outgoing-3 >> Host: host.example.net
2014-10-13 12:40:49,518 - DEBUG [net.shibboleth.ext.spring.resource.HTTPResource:140] - The response was generated from the cache after validating the entry with the origin server
2014-10-13 12:40:49,519 - DEBUG [net.shibboleth.ext.spring.resource.HTTPResource:257] - Attempting to fetch remote resource as 'https://host.example.net/attribute-filter.xml'
2014-10-13 12:40:49,521 - DEBUG [net.shibboleth.ext.spring.resource.HTTPResource:131] - A response was generated from the cache with no requests sent upstream
</pre>
</div></div>
<p>(host name sanitized, and only including lines matching the regex 'headers.*(GET|Host)|HTTPResource')</p>
<p>As can be seen from the org.apache.http.headers messages, the first GET request after the IdP startup correctly uses the origin-form, but any later request will switch to the absolute-form. This is clearly non-RFC compliant ("When making a request directly to an origin server, other than a CONNECT or server-wide OPTIONS request <span class="error">[...]</span>, a client MUST send only the absolute path and query components of the target URI as the request-target", section 5.3.1), and makes using a caching HttpClient unsuitable, in my opinion.</p>
<p>I'm not sure if this is a problem with Apache HttpClient (Cache) itself, and would appreciate more insights (Rod and/or Brent?). FWIW, this is how I configured the HttpClient which I used with <tt>net.shibboleth.ext.spring.resource.FileBackedHTTPResource</tt>:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java"> <bean id=<span class="code-quote">"InMemoryCachingHttpClientBuilder"</span> class=<span class="code-quote">"net.shibboleth.utilities.java.support.httpclient.InMemoryCachingHttpClientBuilder"</span> />
<bean id=<span class="code-quote">"HttpClient"</span> factory-bean=<span class="code-quote">"InMemoryCachingHttpClientBuilder"</span> factory-method=<span class="code-quote">"buildClient"</span> />
</pre>
</div></div></div>
<div style="color:#505050;padding:4px 0 0 0;"> </div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td><!-- End #email-page -->
</tr>
<tr valign="top">
<td style="color:#505050;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:10px;line-height:14px;padding: 0 16px 16px 16px;text-align:center;">
This message is automatically generated by JIRA.<br />
If you think it was sent incorrectly, please contact your JIRA administrators<br />
For more information on JIRA, see: <a style='color:#326ca6;' href='http://www.atlassian.com/software/jira'>http://www.atlassian.com/software/jira</a>
</td>
</tr>
</table><!-- End #email-wrap -->
</div><!-- End #email-body -->