| 940 | } |
| 941 | |
| 942 | static apr_status_t store_body(cache_handle_t *h, request_rec *r, |
| 943 | apr_bucket_brigade *in, apr_bucket_brigade *out) |
| 944 | { |
| 945 | apr_bucket *e; |
| 946 | apr_status_t rv = APR_SUCCESS; |
| 947 | cache_socache_object_t *sobj = |
| 948 | (cache_socache_object_t *) h->cache_obj->vobj; |
| 949 | cache_socache_dir_conf *dconf = |
| 950 | ap_get_module_config(r->per_dir_config, &cache_socache_module); |
| 951 | int seen_eos = 0; |
| 952 | |
| 953 | if (!sobj->offset) { |
| 954 | sobj->offset = dconf->readsize; |
| 955 | } |
| 956 | if (!sobj->timeout && dconf->readtime) { |
| 957 | sobj->timeout = apr_time_now() + dconf->readtime; |
| 958 | } |
| 959 | |
| 960 | if (!sobj->newbody) { |
| 961 | sobj->body_length = 0; |
| 962 | sobj->newbody = 1; |
| 963 | } |
| 964 | if (sobj->offset) { |
| 965 | apr_brigade_partition(in, sobj->offset, &e); |
| 966 | } |
| 967 | |
| 968 | while (APR_SUCCESS == rv && !APR_BRIGADE_EMPTY(in)) { |
| 969 | const char *str; |
| 970 | apr_size_t length; |
| 971 | |
| 972 | e = APR_BRIGADE_FIRST(in); |
| 973 | |
| 974 | /* are we done completely? if so, pass any trailing buckets right through */ |
| 975 | if (sobj->done || !sobj->pool) { |
| 976 | APR_BUCKET_REMOVE(e); |
| 977 | APR_BRIGADE_INSERT_TAIL(out, e); |
| 978 | continue; |
| 979 | } |
| 980 | |
| 981 | /* have we seen eos yet? */ |
| 982 | if (APR_BUCKET_IS_EOS(e)) { |
| 983 | seen_eos = 1; |
| 984 | sobj->done = 1; |
| 985 | APR_BUCKET_REMOVE(e); |
| 986 | APR_BRIGADE_INSERT_TAIL(out, e); |
| 987 | break; |
| 988 | } |
| 989 | |
| 990 | /* honour flush buckets, we'll get called again */ |
| 991 | if (APR_BUCKET_IS_FLUSH(e)) { |
| 992 | APR_BUCKET_REMOVE(e); |
| 993 | APR_BRIGADE_INSERT_TAIL(out, e); |
| 994 | break; |
| 995 | } |
| 996 | |
| 997 | /* metadata buckets are preserved as is */ |
| 998 | if (APR_BUCKET_IS_METADATA(e)) { |
| 999 | APR_BUCKET_REMOVE(e); |
nothing calls this directly
no test coverage detected