Skip to content

Resolve member function overload ambiguity and incorrect pointer casting for secondsToExpiry HTTP cache - #1309

Draft
uNetworkingAB with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-seconds-to-expiry-cache-errors
Draft

Resolve member function overload ambiguity and incorrect pointer casting for secondsToExpiry HTTP cache#1309
uNetworkingAB with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-seconds-to-expiry-cache-errors

Conversation

Copilot AI commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Recently introduced changes to the secondsToExpiry cache feature introduced compilation errors due to overloaded member function name resolution failure and a type safety mismatch during pointer retrieval.

Key Changes

  • Resolve Overload Resolution Ambiguity in AppWrapper.h

    • Explicitly cast &APP::get to the non-cached 2-parameter signature static_cast<APP && (APP::*)(std::string, uWS::MoveOnlyFunction<void(uWS::HttpResponse<SSL> *, uWS::HttpRequest *)> &&)> when fallback-registering standard non-cached GET routes. This prevents the compiler from failing when resolving the overloaded get method introduced by HttpCache.
  • Fix Pointer Type Safety in HttpResponseWrapper.h

    • Updated the getHttpResponse helper to cast the underlying instance pointer to uWS::HttpCacheResponse * instead of uWS::HttpResponse<true> * when PROTOCOL == 3 (CACHE). This aligns the static types with the actual instantiated types, preventing undefined behavior and memory mismatches.

Code Snippet

// src/AppWrapper.h
} else {
    uWS_App_get<APP>(static_cast<uWS::App && (uWS::App::*)(std::string, uWS::MoveOnlyFunction<void(uWS::HttpResponse<false> *, uWS::HttpRequest *)> &&)>(&uWS::App::get), args);
}

// src/HttpResponseWrapper.h
} else if constexpr (PROTOCOL == 3) {
    return (uWS::HttpCacheResponse *) res;
}

Copilot AI and others added 2 commits September 13, 2026 09:31
…e feature

Co-authored-by: uNetworkingAB <110806833+uNetworkingAB@users.noreply.github.com>
Co-authored-by: uNetworkingAB <110806833+uNetworkingAB@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants