Repository navigation
Add HttpTransact::get_max_age and TSHttpTxnGetMaxAge - #6730
Conversation
|
@ema please run |
| } | ||
|
|
||
| int | ||
| HttpTransact::get_max_age(State *s, HTTPHdr *response) |
There was a problem hiding this comment.
Why is the State object a parameter to this function?
There was a problem hiding this comment.
Good question, state is needed by TxnDebug. I have kept the two debugging statements (printing s_maxage or max_age depending on which one is defined) because they were used in calculate_document_freshness_limit. If we decide that they are not needed, after all, then we can avoid passing State as a parameter to the function.
There was a problem hiding this comment.
My general thought it that we should avoid duplicating Debug()'s which are already in the core. It's not intended for debugging "line-by-line" code, but rather, show internal stats, transitions, state machine states etc. as the request is being processed.
So, assuming there's an existing Debug that shows the max-age, we should remove it here.
There was a problem hiding this comment.
My general thought it that we should avoid duplicating Debug()'s which are already in the core. It's not intended for debugging "line-by-line" code, but rather, show internal stats, transitions, state machine states etc. as the request is being processed.
So, assuming there's an existing Debug that shows the max-age, we should remove it here.
I couldn't find any, so I've re-added one single debug statement showing max-age to calculate_document_freshness_limit. Let me know if this looks any better!
Add a new function called HttpTransact::get_max_age based on the logic in HttpTransact::calculate_document_freshness_limit that extracts max_age depending on s-maxage and max-age. Expose the function as TSHttpTxnGetMaxAge.
| freshness_limit = std::min(std::max(0, freshness_limit), static_cast<int>(s->txn_conf->cache_guaranteed_max_lifetime)); | ||
| if (max_age >= 0) { | ||
| freshness_limit = std::min(std::max(0, max_age), static_cast<int>(s->txn_conf->cache_guaranteed_max_lifetime)); | ||
| TxnDebug("http_match", "calculate_document_freshness_limit --- freshness_limit = %d", freshness_limit); |
|
Cherry-picked to v9.0.x branch. |
Add a new function called HttpTransact::get_max_age based on the logic
in HttpTransact::calculate_document_freshness_limit that extracts
max_age depending on s-maxage and max-age. Expose the function as
TSHttpTxnGetMaxAge.