| 6792 | } |
| 6793 | |
| 6794 | HttpTunnelProducer * |
| 6795 | HttpSM::setup_cache_read_transfer() |
| 6796 | { |
| 6797 | int64_t alloc_index, hdr_size; |
| 6798 | int64_t doc_size; |
| 6799 | |
| 6800 | ink_assert(cache_sm.cache_read_vc != nullptr); |
| 6801 | |
| 6802 | doc_size = t_state.cache_info.object_read->object_size_get(); |
| 6803 | alloc_index = buffer_size_to_index(doc_size + index_to_buffer_size(HTTP_HEADER_BUFFER_SIZE_INDEX), |
| 6804 | t_state.http_config_param->max_payload_iobuf_index); |
| 6805 | |
| 6806 | #ifndef USE_NEW_EMPTY_MIOBUFFER |
| 6807 | MIOBuffer *buf = new_MIOBuffer(alloc_index); |
| 6808 | #else |
| 6809 | MIOBuffer *buf = new_empty_MIOBuffer(alloc_index); |
| 6810 | buf->append_block(HTTP_HEADER_BUFFER_SIZE_INDEX); |
| 6811 | #endif |
| 6812 | |
| 6813 | buf->water_mark = static_cast<int>(t_state.txn_conf->default_buffer_water_mark); |
| 6814 | |
| 6815 | IOBufferReader *buf_start = buf->alloc_reader(); |
| 6816 | |
| 6817 | // Now dump the header into the buffer |
| 6818 | ink_assert(t_state.hdr_info.client_response.status_get() != HTTP_STATUS_NOT_MODIFIED); |
| 6819 | client_response_hdr_bytes = hdr_size = write_response_header_into_buffer(&t_state.hdr_info.client_response, buf); |
| 6820 | cache_response_hdr_bytes = client_response_hdr_bytes; |
| 6821 | |
| 6822 | HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::tunnel_handler); |
| 6823 | |
| 6824 | if (doc_size != INT64_MAX) { |
| 6825 | doc_size += hdr_size; |
| 6826 | } |
| 6827 | |
| 6828 | HttpTunnelProducer *p = tunnel.add_producer(cache_sm.cache_read_vc, doc_size, buf_start, &HttpSM::tunnel_handler_cache_read, |
| 6829 | HT_CACHE_READ, "cache read"); |
| 6830 | tunnel.add_consumer(_ua.get_entry()->vc, cache_sm.cache_read_vc, &HttpSM::tunnel_handler_ua, HT_HTTP_CLIENT, "user agent"); |
| 6831 | // if size of a cached item is not known, we'll do chunking for keep-alive HTTP/1.1 clients |
| 6832 | // this only applies to read-while-write cases where origin server sends a dynamically generated chunked content |
| 6833 | // w/o providing a Content-Length header |
| 6834 | if (t_state.client_info.receive_chunked_response) { |
| 6835 | bool const drop_chunked_trailers = t_state.http_config_param->oride.http_drop_chunked_trailers == 1; |
| 6836 | bool const parse_chunk_strictly = t_state.http_config_param->oride.http_strict_chunk_parsing == 1; |
| 6837 | tunnel.set_producer_chunking_action(p, client_response_hdr_bytes, TCA_CHUNK_CONTENT, drop_chunked_trailers, |
| 6838 | parse_chunk_strictly); |
| 6839 | tunnel.set_producer_chunking_size(p, t_state.txn_conf->http_chunking_size); |
| 6840 | } |
| 6841 | _ua.get_entry()->in_tunnel = true; |
| 6842 | cache_sm.cache_read_vc = nullptr; |
| 6843 | return p; |
| 6844 | } |
| 6845 | |
| 6846 | HttpTunnelProducer * |
| 6847 | HttpSM::setup_cache_transfer_to_transform() |
nothing calls this directly
no test coverage detected