Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RCORE-2222 Remove 308 redirect support from App/AppUser #7996

Merged
merged 10 commits into from
Aug 30, 2024

Conversation

michael-wb
Copy link
Contributor

@michael-wb michael-wb commented Aug 23, 2024

What, How & Why?

Removes the 301/308 http redirection support from the app services support in App. The redirection tests have been removed in PR #7994.

Fixes #7942

☑️ ToDos

  • 📝 Changelog update
  • [ ] 🚦 Tests (or not relevant)
  • [ ] C-API, if public C++ API changed
  • [ ] bindgen/spec.yml, if public C++ API changed

@michael-wb michael-wb self-assigned this Aug 23, 2024
@cla-bot cla-bot bot added the cla: yes label Aug 23, 2024
Copy link
Collaborator

@danieltabacaru danieltabacaru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this reverting to the state before supporting redirection?

@michael-wb
Copy link
Contributor Author

Is this reverting to the state before supporting redirection?

Technically yes - the redirection is being removed since there is already support for handling 301/308 redirections in the HTTP transport supplied by the SDK and Core will never actually see a 301/308 response. The only exception to this is the CPP SDK, and I am working on that now so it supports redirections as well.

@danieltabacaru
Copy link
Collaborator

Technically yes - the redirection is being removed since there is already support for handling 301/308 redirections in the HTTP transport supplied by the SDK and Core will never actually see a 301/308 response. The only exception to this is the CPP SDK, and I am working on that now so it supports redirections as well.
Is the CPP support already handled in this PR?

@michael-wb
Copy link
Contributor Author

michael-wb commented Aug 23, 2024

Unfortunately not, I created realm/realm-cpp#239 for adding redirection support in the CPP SDK.

Copy link

coveralls-official bot commented Aug 23, 2024

Pull Request Test Coverage Report for Build michael.wilkersonbarker_1371

Details

  • 40 of 44 (90.91%) changed or added relevant lines in 1 file are covered.
  • 79 unchanged lines in 14 files lost coverage.
  • Overall coverage increased (+0.002%) to 91.106%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/realm/object-store/sync/app.cpp 40 44 90.91%
Files with Coverage Reduction New Missed Lines %
src/realm/array_string.cpp 1 88.03%
src/realm/mixed.cpp 1 86.61%
src/realm/sync/noinst/server/server.cpp 1 74.69%
src/realm/uuid.cpp 1 98.48%
test/test_index_string.cpp 1 93.48%
src/realm/sync/noinst/client_impl_base.cpp 2 82.83%
test/object-store/sync/flx_sync.cpp 2 98.35%
test/test_lang_bind_helper.cpp 2 93.2%
src/realm/query_expression.hpp 3 93.85%
test/fuzz_tester.hpp 5 57.18%
Totals Coverage Status
Change from base Build 2594: 0.002%
Covered Lines: 217173
Relevant Lines: 238374

💛 - Coveralls

request = std::move(request)](const Response& response) mutable {
self->check_for_redirect_response(std::move(request), response, std::move(completion));
request_ref,
[completion = std::move(completion), request = std::move(request)](const Response& response) mutable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to capture self here to keep App alive for the duration of the request, or is the contract here that the completion is responsible for keeping the App alive?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The completion callback provided to do_request() captures an App shared pointer, which will ensure the app sticks around until the callback is called.
The only exception is when the original request is re-sent after successfully refreshing the user access token after the request sent by do_authenticated_request() initially failed.
I will update this call and add a statement to do_request() regarding ensuring the callback contains an App shared ptr instance in the captures.

request = std::move(request)](const Response& response) mutable {
self->check_for_redirect_response(std::move(request), response, std::move(completion));
request_ref,
[completion = std::move(completion), request = std::move(request)](const Response& response) mutable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to capture self here to keep the App alive?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is only called from do_request(), so the completion callback will have a reference to to App, like do_request() does.

Base automatically changed from mwb/remove-308-tests to master August 30, 2024 14:48
An error occurred while trying to automatically change base from mwb/remove-308-tests to master August 30, 2024 14:48
@michael-wb michael-wb merged commit 1760013 into master Aug 30, 2024
45 checks passed
@michael-wb michael-wb deleted the mwb/remove-308-support branch August 30, 2024 16:09
@github-actions github-actions bot mentioned this pull request Sep 20, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove 308 redirect support from App/AppUser
3 participants