* Reads headers from a buffer and returns an array of headers. * Returns NULL on file error * This routine tries to deal with too long lines and continuation lines. * @@@: XXX: FIXME: currently the headers are passed thru un-merged. * Is that okay, or should they be collapsed where possible? */
| 863 | * Is that okay, or should they be collapsed where possible? |
| 864 | */ |
| 865 | static apr_status_t recall_headers(cache_handle_t *h, request_rec *r) |
| 866 | { |
| 867 | disk_cache_object_t *dobj = (disk_cache_object_t *) h->cache_obj->vobj; |
| 868 | apr_status_t rv; |
| 869 | |
| 870 | /* This case should not happen... */ |
| 871 | if (!dobj->hdrs.fd) { |
| 872 | ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00719) |
| 873 | "recalling headers; but no header fd for %s", dobj->name); |
| 874 | return APR_NOTFOUND; |
| 875 | } |
| 876 | |
| 877 | h->req_hdrs = apr_table_make(r->pool, 20); |
| 878 | h->resp_hdrs = apr_table_make(r->pool, 20); |
| 879 | |
| 880 | /* Call routine to read the header lines/status line */ |
| 881 | rv = read_table(h, r, h->resp_hdrs, dobj->hdrs.fd); |
| 882 | if (rv != APR_SUCCESS) { |
| 883 | ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02987) |
| 884 | "Error reading response headers from %s for %s", |
| 885 | dobj->hdrs.file, dobj->name); |
| 886 | } |
| 887 | rv = read_table(h, r, h->req_hdrs, dobj->hdrs.fd); |
| 888 | if (rv != APR_SUCCESS) { |
| 889 | ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02988) |
| 890 | "Error reading request headers from %s for %s", |
| 891 | dobj->hdrs.file, dobj->name); |
| 892 | } |
| 893 | |
| 894 | apr_file_close(dobj->hdrs.fd); |
| 895 | |
| 896 | ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00720) |
| 897 | "Recalled headers for URL %s", dobj->name); |
| 898 | return APR_SUCCESS; |
| 899 | } |
| 900 | |
| 901 | static apr_status_t recall_body(cache_handle_t *h, apr_pool_t *p, apr_bucket_brigade *bb) |
| 902 | { |
no test coverage detected