From: Bill Stoddard Date: Wed, 3 Apr 2002 21:26:35 +0000 (+0000) Subject: Fix a couple of edge cases when the content being cached is generated locally. X-Git-Tag: 2.0.35~38 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=683debfe745dbe09ba0f8503b2a36de4a3ff68ed;p=apache Fix a couple of edge cases when the content being cached is generated locally. (ie, the HTTP_HEADER_FILTER has not yet run) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94426 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/experimental/mod_disk_cache.c b/modules/experimental/mod_disk_cache.c index 891f47f290..e5034733c9 100644 --- a/modules/experimental/mod_disk_cache.c +++ b/modules/experimental/mod_disk_cache.c @@ -570,11 +570,22 @@ static apr_status_t write_headers(cache_handle_t *h, request_rec *r, cache_info buf = apr_pstrcat(r->pool, CRLF, NULL); amt = strlen(buf); apr_file_write(hfd, buf, &amt); + + /* This case only occurs when the content is generated locally */ + if (!apr_table_get(r->headers_out, "Content-Type") && r->content_type) { + apr_table_setn(r->headers_out, "Content-Type", + ap_make_content_type(r, r->content_type)); + } } sprintf(statusbuf,"%d", r->status); buf = apr_pstrcat(r->pool, statusbuf, CRLF, NULL); amt = strlen(buf); apr_file_write(hfd, buf, &amt); + + /* This case only occurs when the content is generated locally */ + if (!r->status_line) { + r->status_line = ap_get_status_line(r->status); + } buf = apr_pstrcat(r->pool, r->status_line, "\n", NULL); amt = strlen(buf); apr_file_write(hfd, buf, &amt);