Skip to content

Commit

Permalink
rebase branch
Browse files Browse the repository at this point in the history
  • Loading branch information
iamsanjay committed Jan 20, 2025
1 parent 780c0a2 commit dbe7c4f
Show file tree
Hide file tree
Showing 2 changed files with 5,510 additions and 4,589 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
import org.apache.solr.client.api.util.SolrVersion;
import org.apache.solr.client.solrj.ResponseParser;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrClientFunction;
Expand All @@ -58,7 +59,6 @@
import org.apache.solr.common.util.ObjectReleaseTracker;
import org.apache.solr.common.util.SolrNamedThreadFactory;
import org.eclipse.jetty.client.AuthenticationStore;
import org.eclipse.jetty.client.FormRequestContent;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.HttpClientTransport;
import org.eclipse.jetty.client.HttpProxy;
Expand Down Expand Up @@ -87,7 +87,6 @@
import org.eclipse.jetty.http2.client.transport.HttpClientTransportOverHTTP2;
import org.eclipse.jetty.io.ClientConnector;
import org.eclipse.jetty.util.BlockingArrayQueue;
import org.eclipse.jetty.util.Fields;
import org.eclipse.jetty.util.ssl.KeyStoreScanner;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.slf4j.Logger;
Expand All @@ -106,11 +105,12 @@
* </ul>
*/
public class Http2SolrClient extends HttpSolrClientBase {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
public static final String REQ_PRINCIPAL_KEY = "solr-req-principal";
private static final String USER_AGENT =
"Solr[" + MethodHandles.lookup().lookupClass().getName() + "] " + SolrVersion.LATEST_STRING;

private static volatile SSLConfig defaultSSLConfig;
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final String AGENT = "Solr[" + Http2SolrClient.class.getName() + "] 2.0";

private final HttpClient httpClient;

Expand Down Expand Up @@ -251,7 +251,7 @@ private HttpClient createHttpClient(Builder builder) {
httpClient.setFollowRedirects(false);
httpClient.setMaxRequestsQueuedPerDestination(
asyncTracker.getMaxRequestsQueuedPerDestination());
httpClient.setUserAgentField(new HttpField(HttpHeader.USER_AGENT, AGENT));
httpClient.setUserAgentField(new HttpField(HttpHeader.USER_AGENT, USER_AGENT));
httpClient.setIdleTimeout(idleTimeoutMillis);

if (builder.cookieStore != null) {
Expand Down Expand Up @@ -786,18 +786,12 @@ private Request fillContentStream(
}
} else {
// application/x-www-form-urlencoded
Fields fields = new Fields();
Iterator<String> iter = wparams.getParameterNamesIterator();
while (iter.hasNext()) {
String key = iter.next();
String[] vals = wparams.getParams(key);
if (vals != null) {
for (String val : vals) {
fields.add(key, val);
}
}
}
req.body(new FormRequestContent(fields, FALLBACK_CHARSET));
String queryString = wparams.toQueryString();
// remove the leading "?" if there is any
queryString = queryString.startsWith("?") ? queryString.substring(1) : queryString;
req.body(
new StringRequestContent(
"application/x-www-form-urlencoded", queryString, FALLBACK_CHARSET));
}

return req;
Expand Down
Loading

0 comments on commit dbe7c4f

Please sign in to comment.