You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Michael Ryan (JIRA)" <ji...@apache.org> on 2014/08/11 04:10:12 UTC

[jira] [Updated] (SOLR-6360) Unnecessary Content-Charset header in HttpSolrServer

     [ https://issues.apache.org/jira/browse/SOLR-6360?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Ryan updated SOLR-6360:
-------------------------------

    Description: 
The httpclient code in HttpSolrServer currently sets a "Content-Charset" header when making a POST request:
{code}post.setHeader("Content-Charset", "UTF-8");{code}
As far as I know this is not a real header and is not necessary. It seems this was a mistake in the original implementation of this class, when converting from httpclient v3 to httpclient v4. CommonsHttpSolrServer did this, which is what the line of code above seems to have been based on:
{code}post.getParams().setContentCharset("UTF-8");{code}
The actual way to set the charset in httpclient v4 is already being done correctly, with these lines:
{code}parts.add(new FormBodyPart(p, new StringBody(v, StandardCharsets.UTF_8)));
post.setEntity(new UrlEncodedFormEntity(postParams, StandardCharsets.UTF_8));{code}

So basically, the Content-Charset line can just be removed.

(I think the explicit setting of the Content-Type header also might be unnecessary, but I haven't taken the time to investigate that.)

  was:
The httpclient code in HttpSolrServer currently sets a "Content-Charset" header when making a POST request:
{code}post.setHeader("Content-Charset", "UTF-8");{code}
As far as I know this is not a real header and is not necessary. It seems this was a mistake in the original implementation of this class, when converting from httpclient v3 to httpclient v4. CommonsHttpSolrServer did this, which is what the line of code above seems to have been on:
{code}post.getParams().setContentCharset("UTF-8");{code}
The actual way to set the charset in httpclient v4 is already being done correctly, with these lines:
{code}parts.add(new FormBodyPart(p, new StringBody(v, StandardCharsets.UTF_8)));
post.setEntity(new UrlEncodedFormEntity(postParams, StandardCharsets.UTF_8));{code}

So basically, the Content-Charset line can just be removed.

(I think the explicit setting of the Content-Type header also might be unnecessary, but I haven't taken the time to investigate that.)


> Unnecessary Content-Charset header in HttpSolrServer
> ----------------------------------------------------
>
>                 Key: SOLR-6360
>                 URL: https://issues.apache.org/jira/browse/SOLR-6360
>             Project: Solr
>          Issue Type: Bug
>          Components: clients - java
>    Affects Versions: 3.6, 4.9
>            Reporter: Michael Ryan
>            Priority: Minor
>
> The httpclient code in HttpSolrServer currently sets a "Content-Charset" header when making a POST request:
> {code}post.setHeader("Content-Charset", "UTF-8");{code}
> As far as I know this is not a real header and is not necessary. It seems this was a mistake in the original implementation of this class, when converting from httpclient v3 to httpclient v4. CommonsHttpSolrServer did this, which is what the line of code above seems to have been based on:
> {code}post.getParams().setContentCharset("UTF-8");{code}
> The actual way to set the charset in httpclient v4 is already being done correctly, with these lines:
> {code}parts.add(new FormBodyPart(p, new StringBody(v, StandardCharsets.UTF_8)));
> post.setEntity(new UrlEncodedFormEntity(postParams, StandardCharsets.UTF_8));{code}
> So basically, the Content-Charset line can just be removed.
> (I think the explicit setting of the Content-Type header also might be unnecessary, but I haven't taken the time to investigate that.)



--
This message was sent by Atlassian JIRA
(v6.2#6252)

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