[
https://issues.apache.org/jira/browse/SOLR-8213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15188048#comment-15188048
]
Kevin Risden commented on SOLR-8213:
------------------------------------
[~joel.bernstein] - Maybe you can shed some light on a 401 Unauthorized being
swallowed in HttpSolrClient.java.
In HttpSolrClient.java, the httpStatus switch on line 497 doesn't account for
HttpStatus.SC_UNAUTHORIZED and then the stream is returned on lines 516-524.
{code}
if (processor == null || processor instanceof InputStreamResponseParser) {
// no processor specified, return raw stream
NamedList<Object> rsp = new NamedList<>();
rsp.add("stream", respBody);
// Only case where stream should not be closed
shouldClose = false;
return rsp;
}
{code}
The stream returned is pure HTML from the 401 unauthorized response which looks
like:
{code}
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 401 </title>
</head>
<body>
<h2>HTTP ERROR: 401</h2>
<p>Problem accessing /collection1/select. Reason:
<pre> Unauthorized request, Response code: 401</pre></p>
<hr /><a href="http://eclipse.org/jetty">Powered by Jetty://
9.3.6.v20151106</a><hr/>
</body>
</html>
{code}
This then causes the JSONTupleStream to blow up in the next() method since it
can't parse the stream. The JSONTupleStream create method doesn't throw an
exception since the response is actually valid just the stream contains content
we don't want.
I think the fix is to bail out earlier in HttpSolrClient on a 401 unauthorized.
This would propagate the error back up to the JSONTupleStream and further up
the stack during open() instead of read() for the streams.
I was able to modify the JdbcTest to enable basic authentication and rules
based authorization to show this exception and the same modification should
work for the StreamingTest as well. I will upload a patch in a little bit.
> SolrJ JDBC support authentication
> ---------------------------------
>
> Key: SOLR-8213
> URL: https://issues.apache.org/jira/browse/SOLR-8213
> Project: Solr
> Issue Type: Improvement
> Components: SolrJ
> Affects Versions: master
> Reporter: Kevin Risden
>
> SolrJ JDBC doesn't support authentication where as Solr supports Basic and
> Kerberos authentication currently.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]