[
https://issues.apache.org/jira/browse/TS-4946?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15567752#comment-15567752
]
James Fang commented on TS-4946:
--------------------------------
7988 // If the response is prohibited from containing a body,
7989 // we know the content length is trustable for keep-alive
7990 if (is_response_body_precluded(status_code, s->method)) {
7991 s->hdr_info.trust_response_cl = true;
7992 s->hdr_info.response_content_length = 0;
7993 s->client_info.transfer_encoding =
HttpTransact::NO_TRANSFER_ENCODING;
7994 s->server_info.transfer_encoding =
HttpTransact::NO_TRANSFER_ENCODING;
7995 }
seems the above code from HttpTransact::build_response reset
response_content_length to 0,
it cause
6429 void
6430 HttpSM::setup_server_transfer_to_cache_only()
6431 {
6432 TunnelChunkingAction_t action;
6433 int64_t alloc_index;
6434 int64_t nbytes;
6435
6436 alloc_index = find_server_buffer_size();
6437 MIOBuffer *buf = new_MIOBuffer(alloc_index);
6438 IOBufferReader *buf_start = buf->alloc_reader();
6439
6440 action = (t_state.current.server &&
t_state.current.server->transfer_encoding == HttpTransact::CHUNKED_ENCODING) ?
6441 TCA_DECHUNK_CONTENT :
6442 TCA_PASSTHRU_DECHUNKED_CONTENT;
6443
6444 nbytes = server_transfer_init(buf, 0);
6445
6446 HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::tunnel_handler);
6447
6448 HttpTunnelProducer *p =
6449 tunnel.add_producer(server_entry->vc, nbytes, buf_start,
&HttpSM::tunnel_handler_server, HT_HTTP_SERVER, "http server");
6450
6451 tunnel.set_producer_chunking_action(p, 0, action);
6452 tunnel.set_producer_chunking_size(p,
t_state.txn_conf->http_chunking_size);
6453
6454 setup_cache_write_transfer(&cache_sm, server_entry->vc,
&t_state.cache_info.object_store, 0, "cache write");
6455
6456 server_entry->in_tunnel = true;
6457 }
server_transfer_init called in line 6444 return 0.
the tunnel has no data to write, then cache write is skipped.
> ts remove conditional request header for os request, and does't not cache 200
> response
> --------------------------------------------------------------------------------------
>
> Key: TS-4946
> URL: https://issues.apache.org/jira/browse/TS-4946
> Project: Traffic Server
> Issue Type: Bug
> Components: Cache
> Reporter: James Fang
>
> when client send conditional request, and the item doesn't in cache
> ts seems to remove conditional request headers, and send normal request to
> original server.
> when original server response with 200, ts doesn't cache the result.
> is this the expected behaviour ?
> i think we should either send conditional request to os or cache 200 response.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)