[
https://issues.apache.org/jira/browse/SOLR-13270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16844922#comment-16844922
]
Erlend Garåsen commented on SOLR-13270:
---------------------------------------
[~gerlowskija], I'm sorry for the delay.
I still cannot see any expect continue header, so I'm posting my current
configuration. I also added a security.json file in Solr home and configured
basic auth configuration in case that had to be done for the header to show up,
but with no luck. I will later try to change ManifoldCF's solrj.jar with the
one I have built and test. But here's my sample code.
{code:java}
HttpClientBuilder builder = HttpClients.custom();
builder.setDefaultRequestConfig(RequestConfig.custom().setExpectContinueEnabled(true).build());
AuthScope scope = new AuthScope("localhost", 8983, null);
Credentials creds = new UsernamePasswordCredentials("solr", "SolrRocks");
BasicCredentialsProvider cp = new BasicCredentialsProvider();
cp.setCredentials(scope, creds);
builder.setDefaultCredentialsProvider(cp);
try {
String baseUrl = "http://localhost:8983/solr/test";
HttpSolrClient client = new HttpSolrClient.Builder()
.withHttpClient(httpClient)
.useRequestConfigFromExternalHttpClient(true)
.withBaseSolrUrl(baseUrl).build();
SolrQuery query = new SolrQuery();
query.setQuery("*:*");
client.query(query);
[…]
{code}
{noformat}
DEBUG 21.05.2019 16:45:12:986 (Wire.java:wire:73) - http-outgoing-0 >> "GET
/solr/test/select?q=*%3A*&wt=javabin&version=2 HTTP/1.1[\r][\n]"
DEBUG 21.05.2019 16:45:12:987 (Wire.java:wire:73) - http-outgoing-0 >>
"User-Agent: Solr[org.apache.solr.client.solrj.impl.HttpSolrClient] 1.0[\r][\n]"
DEBUG 21.05.2019 16:45:12:987 (Wire.java:wire:73) - http-outgoing-0 >> "Host:
localhost:8983[\r][\n]"
DEBUG 21.05.2019 16:45:12:988 (Wire.java:wire:73) - http-outgoing-0 >>
"Connection: Keep-Alive[\r][\n]"
DEBUG 21.05.2019 16:45:12:988 (Wire.java:wire:73) - http-outgoing-0 >>
"Accept-Encoding: gzip,deflate[\r][\n]"
DEBUG 21.05.2019 16:45:12:988 (Wire.java:wire:73) - http-outgoing-0 >>
"[\r][\n]"{noformat}
> SolrJ does not send "Expect: 100-continue" header
> -------------------------------------------------
>
> Key: SOLR-13270
> URL: https://issues.apache.org/jira/browse/SOLR-13270
> Project: Solr
> Issue Type: Bug
> Security Level: Public(Default Security Level. Issues are Public)
> Components: SolrJ
> Affects Versions: 7.7
> Reporter: Erlend Garåsen
> Assignee: Jason Gerlowski
> Priority: Major
> Attachments: SOLR-13270.patch
>
>
> SolrJ does not set the "Expect: 100-continue" header, even though it's
> configured in HttpClient:
> {code:java}
> builder.setDefaultRequestConfig(RequestConfig.custom().setExpectContinueEnabled(true).build());{code}
> A HttpClient developer has reviewed the code and says we're setting up
> the client correctly, so we have a reason to believe there is a bug in
> SolrJ. It's actually a problem we are facing in ManifoldCF, explained in:
> https://issues.apache.org/jira/browse/CONNECTORS-1564
> The problem can be reproduced by building and running the following small
> Maven project:
> [http://folk.uio.no/erlendfg/solr/missing-header.zip]
> The application runs SolrJ code where the header does not show up and
> HttpClient code where the header is present.
>
> {code:java}
> HttpClientBuilder builder = HttpClients.custom();
> // This should add an Expect: 100-continue header:
> builder.setDefaultRequestConfig(RequestConfig.custom().setExpectContinueEnabled(true).build());
> HttpClient httpClient = builder.build();
> // Start Solr and create a core named "test".
> String baseUrl = "http://localhost:8983/solr/test";
> // Test using SolrJ — no expect 100 header
> HttpSolrClient client = new HttpSolrClient.Builder()
> .withHttpClient(httpClient)
> .withBaseSolrUrl(baseUrl).build();
> SolrQuery query = new SolrQuery();
> query.setQuery("*:*");
> client.query(query);
> // Test using HttpClient directly — expect 100 header shows up:
> HttpPost httpPost = new HttpPost(baseUrl);
> HttpEntity entity = new InputStreamEntity(new
> ByteArrayInputStream("test".getBytes()));
> httpPost.setEntity(entity);
> httpClient.execute(httpPost);
> {code}
> When using the last HttpClient test, the expect 100 header appears in
> missing-header.log:
> {noformat}
> http-outgoing-1 >> Expect: 100-continue{noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]