Eirik Lygre created SOLR-12659:
----------------------------------

             Summary: HttpSolrClient.createMethod does not handle both stream 
and large data
                 Key: SOLR-12659
                 URL: https://issues.apache.org/jira/browse/SOLR-12659
             Project: Solr
          Issue Type: Bug
      Security Level: Public (Default Security Level. Issues are Public)
          Components: SolrJ
    Affects Versions: 7.4, 6.6.2
            Reporter: Eirik Lygre


When using a ContentStreamUpdateRequest with stream data (through 
addContentStream()), all other parameters are passed on the URL, leading to the 
server failing with "URI is too large".

The code below provokes the error using Solrj 7.4, but was first seen on Solr 
6.6.2. The problem is in HttpSolrClient.createMethod(), where the presence of 
stream data leads to all other fields being put on the URL

h2. Example code

{code:java}
String stringValue = StringUtils.repeat('X', 16*1024);

SolrClient solr = new HttpSolrClient.Builder(BASE_URL).build();

ContentStreamUpdateRequest updateRequest = new 
ContentStreamUpdateRequest("/update/extract");
updateRequest.setParam("literal.id", "UriTooLargeTest-simpleTest");
updateRequest.setParam("literal.field", stringValue);
updateRequest.addContentStream(new ContentStreamBase.StringStream(stringValue));

updateRequest.process(solr);
{code}

h2. The client sees the following error:

{code:java}
org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error 
from server at http://server/solr/core: Expected mime type 
application/octet-stream but got text/html. <h1>Bad Message 
414</h1><pre>reason: URI Too Long</pre>
{code}

h2. Error fragment from HttpSolrClient.createMethod

{code}
      if(contentWriter != null) {
        String fullQueryUrl = url + wparams.toQueryString();
        HttpEntityEnclosingRequestBase postOrPut = SolrRequest.METHOD.POST == 
request.getMethod() ?
            new HttpPost(fullQueryUrl) : new HttpPut(fullQueryUrl);
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to