masaori335 commented on code in PR #13158:
URL: https://github.com/apache/trafficserver/pull/13158#discussion_r3245072072
##########
src/proxy/http/HttpSM.cc:
##########
@@ -5091,6 +5091,35 @@ HttpSM::do_range_setup_if_necessary()
if (t_state.cache_info.action == HttpTransact::CacheAction_t::REPLACE)
{
if (t_state.hdr_info.server_response.status_get() == HTTPStatus::OK)
{
Dbg(dbg_ctl_http_range, "Serving transform after stale cache
re-serve");
+
+ // Ranges and range_output_cl were computed against the stale
cached object size. If the fresh origin Content-Length
+ // differs, re-parse the Range against the fresh value so the
outgoing Content-Length/Content-Range match the body
+ // actually being sent. Without this, Content-Length/Content-Range
advertise the stale cached size.
+ const int64_t fresh_cl =
t_state.hdr_info.server_response.get_content_length();
+ const int64_t cached_cl = t_state.cache_info.object_read ?
t_state.cache_info.object_read->object_size_get() : -1;
+ if (fresh_cl > 0 && fresh_cl != cached_cl) {
Review Comment:
Make sense. We need to cover the case of new Content-Length is 0.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]