setContentMD5(reply.getContentMD5());
String vary[] = reply.getVary();
setVary(vary);
if (vary != null) {
// update the conneg headers
ArrayDictionary a = null;
for (int i=0; i< vary.length; i++) {
if (vary[i].equals("*")) {
continue;
}
if (a == null) {
a = new ArrayDictionary(vary.length);
}
a.put (vary[i].toLowerCase(), request.getValue(vary[i]));
}
// FIXME we should be able to update to save multiple
// matches, but with a limitation of course
if (a != null) {
setConnegHeaders(a);
}
}
if (reply.hasHeader(reply.H_ETAG)) {
setETag(reply.getETag().toString());
} else {
// be safe here!
setETag(null);
}
ArrayDictionary a = new ArrayDictionary(5, 5);
Enumeration e = reply.enumerateHeaderDescriptions();
while ( e.hasMoreElements() ) {
HeaderDescription d = (HeaderDescription) e.nextElement();
// Skip all well-known headers:
if ( d.isHeader(Reply.H_CONTENT_TYPE)
|| d.isHeader(Reply.H_CONTENT_LENGTH)
|| d.isHeader(Reply.H_LAST_MODIFIED)
|| d.isHeader(Reply.H_ETAG)
|| d.isHeader(Reply.H_AGE)
|| d.isHeader(Reply.H_DATE)
|| d.isHeader(Reply.H_VARY)
|| d.isHeader(Reply.H_CONNECTION)
|| d.isHeader(Reply.H_PROXY_CONNECTION)
|| d.isHeader(Reply.H_TRANSFER_ENCODING)
|| d.isHeader(Reply.H_CONTENT_MD5)
|| d.getName().equalsIgnoreCase("keep-alive"))
continue;
// This is an extra header:
a.put(d.getName(), reply.getValue(d));
}
setExtraHeaders(a);
// FIXME add the headers ;)
}