[ 
https://issues.apache.org/jira/browse/SOLR-16019?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17538756#comment-17538756
 ] 

ASF subversion and git services commented on SOLR-16019:
--------------------------------------------------------

Commit fda43baea953727b3b813b81a6a8da518ec4fdff in lucene-solr's branch 
refs/heads/branch_8_11 from Jan Høydahl
[ https://gitbox.apache.org/repos/asf?p=lucene-solr.git;h=fda43baea95 ]

SOLR-16019 Query parsing exception return HTTP 400 instead of 500 (#2642)

Back-port from 
https://github.com/apache/solr/commit/cb49a7d855e222dfebe373a0c0dfa7c95989ea8e

> UTF-8 parsing errors for parameters should cause a HTTP 400 status code, not 
> 500
> --------------------------------------------------------------------------------
>
>                 Key: SOLR-16019
>                 URL: https://issues.apache.org/jira/browse/SOLR-16019
>             Project: Solr
>          Issue Type: Bug
>            Reporter: Matthias Pigulla
>            Assignee: Jan Høydahl
>            Priority: Trivial
>             Fix For: 9.0
>
>          Time Spent: 4h
>  Remaining Estimate: 0h
>
> When I make a request to an URI like {{{}/solr/my_core/query?q=%C0{}}}, I get 
> a HTTP 500 status code with a stack trace originating at
> {{org.apache.solr.common.SolrException: URLDecoder: Invalid character 
> encoding detected after position 2 of query string / form data (while parsing 
> as UTF-8)}}
> {{at 
> org.apache.solr.servlet.SolrRequestParsers.decodeChars(SolrRequestParsers.java:421)}}
> {{…}}
> The obvious reason is that the {{q}} parameter value looks like the first 
> byte in a multibyte utf-8 sequence, but that sequence is incomplete/invalid. 
> -I have seen a few more instances of this in our monitoring, also with 
> different places where the problem surfaces.- [Other issues unrelated, will 
> file separate issues.]
> Instead of the HTTP 500 status code, something like e. g. HTTP 400 (Bad 
> Request) would be more appropriate. It would also make processing in 
> downstream systems (that have to deal with Solr’s response) much easier if 
> this class of errors could be recognized.
> Also, if I look at the place where the exception is being thrown 
> ([https://github.com/apache/solr/blob/releases/lucene-solr/7.7.3/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java#L419-L422]),
>  care was taken to use the `ErrorCode.BAD_REQUEST` status. This information, 
> however, seems to be lost along the way.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

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

Reply via email to