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

FIX: Editing ChangeLog and Readme for CallingServer. #23167

Merged
2 commits merged into from
Jul 27, 2021
Merged

Conversation

cochi2
Copy link
Member

@cochi2 cochi2 commented Jul 24, 2021

Also, Applying new comments received for the RedirectPolicy

@ghost ghost added the Communication label Jul 24, 2021
@cochi2 cochi2 self-assigned this Jul 24, 2021
@cochi2 cochi2 requested a review from srnagar July 24, 2021 21:15
&& !locations.contains(response.getHeaderValue(LOCATION_HEADER_NAME))
&& redirectNumber < MAX_REDIRECTS;
private boolean isRedirectResponse(HttpResponse response) {
return response.getStatusCode() == SC_MOVED_TEMPORARILY || response.getStatusCode() == SC_MOVED_PERMANENTLY;
Copy link
Member

Choose a reason for hiding this comment

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

307 (temporary redirect) and 308 (permanent redirect) should be redirected as well.

}
if (attemptedRedirectLocations.contains(response.getHeaderValue(LOCATION_HEADER_NAME))) {
logger.error(String.format("Request to %s was redirected more than once to: %s",
context.getHttpRequest().getUrl(), response.getHeaderValue(LOCATION_HEADER_NAME)));
Copy link
Member

Choose a reason for hiding this comment

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

Is it also worth printing the path here to trace back to which two URLs are redirected to the same location? It will help in troubleshooting. For this, you might have to keep track of the order of the locations by using a List instead of a Set.

return next.clone().process().flatMap(httpResponse -> {
if (shouldRedirect(httpResponse, redirectNumber, locations)) {
if (isRedirectResponse(httpResponse)
Copy link
Member

Choose a reason for hiding this comment

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

For 302 (moved permanently) and 308 (permanent redirect), we should consider caching the redirect location of a request URL and go there directly on the first attempt for the next request. For temporary redirects too, we might want to cache for a certain time interval.

@srnagar
Copy link
Member

srnagar commented Jul 26, 2021

@alzimmermsft and @samvaity - some of my comments in this PR should be addressed when we move the redirect policy to azure-core.
#23095

Also, Applying new comments received for the RedirectPolicy
@cochi2 cochi2 force-pushed the fmorales/redirect_changes branch from 0de38ba to a5f141b Compare July 27, 2021 15:05
@cochi2 cochi2 force-pushed the fmorales/redirect_changes branch from a5f141b to ec4bbe4 Compare July 27, 2021 16:19
@ghost
Copy link

ghost commented Jul 27, 2021

Hello @cochi2!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit ae606a5 into main Jul 27, 2021
@ghost ghost deleted the fmorales/redirect_changes branch July 27, 2021 20:37
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants