apr_bucket_brigade *bb = apr_brigade_create(r->pool,
r->connection->bucket_alloc);
- /* restore content type of cached response */
- ap_set_content_type(r, apr_table_get(cache->handle->resp_hdrs,
- "Content-Type"));
+ /* restore content type of cached response if available */
+ /* Needed especially when stale content gets served. */
+ const char *ct = apr_table_get(cache->handle->resp_hdrs, "Content-Type");
+ if (ct) {
+ ap_set_content_type(r, ct);
+ }
/* restore status of cached response */
r->status = cache->handle->cache_obj->info.status;