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 the issue that xds routing fails when okhttp2.2.0 is used #1648

Merged
merged 1 commit into from
Oct 14, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package io.sermant.router.spring.interceptor;

import com.squareup.okhttp.Headers;
import com.squareup.okhttp.HttpUrl;
import com.squareup.okhttp.Request;

import io.sermant.core.common.LoggerFactory;
Expand All @@ -31,6 +30,7 @@

import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -89,8 +89,15 @@ private Map<String, String> getHeaders(Request request) {
}

private Request rebuildRequest(Request request, URI uri, ServiceInstance serviceInstance) {
URL url = null;
try {
url = new URL(BaseHttpRouterUtils.rebuildUrlByXdsServiceInstance(uri, serviceInstance));
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Convert url string to url failed.", e.getMessage());
return request;
}
return request.newBuilder()
.url(HttpUrl.parse(BaseHttpRouterUtils.rebuildUrlByXdsServiceInstance(uri, serviceInstance)))
.url(url)
.build();
}

Expand Down
Loading