Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion include/proxy/http/HttpTransact.h
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,6 @@ class HttpTransact
static void HandleCacheOpenReadHitFreshness(State *s);
static void HandleCacheOpenReadHit(State *s);
static void HandleCacheOpenReadMiss(State *s);
static void set_cache_prepare_write_action_for_new_request(State *s);
static void build_response_from_cache(State *s, HTTPWarningCode warning_code);
static void handle_cache_write_lock(State *s);
static void HandleResponse(State *s);
Expand Down
3 changes: 2 additions & 1 deletion src/proxy/http/HttpSM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8057,8 +8057,9 @@ HttpSM::set_next_state()
}

case HttpTransact::SM_ACTION_CACHE_ISSUE_WRITE: {
ink_assert(cache_sm.cache_write_vc == nullptr);
ink_assert((cache_sm.cache_write_vc == nullptr) || t_state.redirect_info.redirect_in_process);
HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_cache_open_write);

do_cache_prepare_write();
break;
}
Expand Down
31 changes: 7 additions & 24 deletions src/proxy/http/HttpTransact.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2171,7 +2171,12 @@ HttpTransact::DecideCacheLookup(State *s)
if (s->redirect_info.redirect_in_process) {
// without calling out the CACHE_LOOKUP_COMPLETE_HOOK
if (s->txn_conf->cache_http) {
HttpTransact::set_cache_prepare_write_action_for_new_request(s);
if (s->cache_info.write_lock_state == CACHE_WL_FAIL) {
s->cache_info.action = CACHE_PREPARE_TO_WRITE;
s->cache_info.write_lock_state = HttpTransact::CACHE_WL_INIT;
} else if (s->cache_info.write_lock_state == CACHE_WL_SUCCESS) {
s->cache_info.action = CACHE_DO_WRITE;
}
}
LookupSkipOpenServer(s);
} else {
Expand Down Expand Up @@ -3286,7 +3291,7 @@ HttpTransact::HandleCacheOpenReadMiss(State *s)
} else if (s->api_server_response_no_store) { // plugin may have decided not to cache the response
s->cache_info.action = CACHE_DO_NO_ACTION;
} else {
HttpTransact::set_cache_prepare_write_action_for_new_request(s);
s->cache_info.action = CACHE_PREPARE_TO_WRITE;
}

///////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -3341,28 +3346,6 @@ HttpTransact::HandleCacheOpenReadMiss(State *s)
return;
}

void
HttpTransact::set_cache_prepare_write_action_for_new_request(State *s)
{
// This method must be called no more than one time per request. It should
// not be called for non-cacheable requests.
if (s->cache_info.write_lock_state == CACHE_WL_SUCCESS) {
// If and only if this is a redirected request, we may have already
// prepared a cache write (during the handling of the previous request
// which got the 3xx response) and can safely re-use it. Otherwise, we
// risk storing the response under the wrong cache key. This is a release
// assert because the correct behavior would be to prepare a new write,
// but we can't do that because we failed to release the lock. To recover
// we would have to tell the state machine to abort its write, and we
// don't have a state for that.
ink_release_assert(s->redirect_info.redirect_in_process);
s->cache_info.action = CACHE_DO_WRITE;
} else {
s->cache_info.action = CACHE_PREPARE_TO_WRITE;
s->cache_info.write_lock_state = HttpTransact::CACHE_WL_INIT;
}
}

///////////////////////////////////////////////////////////////////////////////
// Name : OriginServerRawOpen
// Description: called for ssl tunneling
Expand Down

This file was deleted.

140 changes: 0 additions & 140 deletions tests/gold_tests/redirect/redirect_to_same_origin_on_cache.test.py

This file was deleted.