Karl Wright created SOLR-10973:
----------------------------------

             Summary: SolrJ: ContentType is not parsed properly in 
HttpSolrClient
                 Key: SOLR-10973
                 URL: https://issues.apache.org/jira/browse/SOLR-10973
             Project: Solr
          Issue Type: Bug
      Security Level: Public (Default Security Level. Issues are Public)
          Components: SolrJ
    Affects Versions: 6.6
            Reporter: Karl Wright
            Assignee: Karl Wright


When multipart posting is used, the content type is passed to the constructor 
for InputStreamBody as a simple string:

{code}
            parts.add(new FormBodyPart(name,
                new InputStreamBody(
                    content.getStream(),
                    contentType,
                    content.getName())));
{code}

This is incorrect; HttpClient does not parse that contentType as anything other 
than a mime type and thus blows up when you pass in something like "text/plain; 
charset=utf-8".  The correct code is:

{code}
            parts.add(new FormBodyPart(name,
                new InputStreamBody(
                    content.getStream(),
                    ContentType.parse(contentType),
                    content.getName())));
{code}

This was discovered by a ManifoldCF user.




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to