]> granicus.if.org Git - apache/commitdiff
Fix a couple of edge cases when the content being cached is generated locally.
authorBill Stoddard <stoddard@apache.org>
Wed, 3 Apr 2002 21:26:35 +0000 (21:26 +0000)
committerBill Stoddard <stoddard@apache.org>
Wed, 3 Apr 2002 21:26:35 +0000 (21:26 +0000)
(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

modules/experimental/mod_disk_cache.c

index 891f47f290ee0970d563ba90dbf6ddcca3381ceb..e5034733c95ca4fd5a2c14e494187fd7ce3fc781 100644 (file)
@@ -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);