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

Hoss Man commented on SOLR-453:
-------------------------------

i just rememberd i had a tomcat 6.0.14 instance setup from apachecon, and i 
cannot reproduce this.

tomcat seems to be correctly stripping the newlines when generating the HTTP 
status reason (admitedly, it does leave the tab characters in palce which is a 
little weird, but not illegal)

Tomer: which version of tomcat are you using?

{noformat}
[EMAIL PROTECTED]:/var/tmp/ac-demo$ curl -o /dev/null -sD - 
"http://localhost:8080/books-solr/select?q=a&start=-1";
HTTP/1.1 500 null  java.lang.NullPointerException       at 
org.apache.solr.search.SolrQueryParser.getFieldQuery(SolrQueryParser.java:73)   
    at org.apache.lucene.queryParser.QueryParser.Term(QueryParser.java:1092)    
     at org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:979)  
     at org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:907)   
     at 
org.apache.lucene.queryParser.QueryParser.TopLevelQuery(QueryParser.java:896)   
     at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:146)   
     at org.apache.solr.search.QueryParsing.parseQuery(QueryParsing.java:94)    
     at 
org.apache.solr.request.StandardRequestHandler.handleRequestBody(StandardRequestHandler.java:109)
    at 
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:77)
         at org.apache.solr.core.SolrCore.execute(SolrCore.java:658)     at 
org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:191) 
     at 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:159)
     at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
  at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
  at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)   
     at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)   
     at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)  at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)  at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
      at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)      at 
java.lang.Thread.run(Thread.java:595)
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=utf-8
Content-Length: 6976
Date: Wed, 09 Jan 2008 19:07:46 GMT
Connection: close

[EMAIL PROTECTED]:/var/tmp/ac-demo$ 
{noformat}

Take the cat to the vet to prove it's not just my shell...

{noformat}
[EMAIL PROTECTED]:/var/tmp/ac-demo$ curl -o /dev/null -sD - 
"http://localhost:8080/books-solr/select?q=a&start=-1"; | cat -vet
HTTP/1.1 500 null  java.lang.NullPointerException ^Iat 
org.apache.solr.search.SolrQueryParser.getFieldQuery(SolrQueryParser.java:73) 
^Iat org.apache.lucene.queryParser.QueryParser.Term(QueryParser.java:1092) ^Iat 
org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:979) ^Iat 
org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:907) ^Iat 
org.apache.lucene.queryParser.QueryParser.TopLevelQuery(QueryParser.java:896) 
^Iat org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:146) ^Iat 
org.apache.solr.search.QueryParsing.parseQuery(QueryParsing.java:94) ^Iat 
org.apache.solr.request.StandardRequestHandler.handleRequestBody(StandardRequestHandler.java:109)
 ^Iat 
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:77)
 ^Iat org.apache.solr.core.SolrCore.execute(SolrCore.java:658) ^Iat 
org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:191) 
^Iat 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:159)
 ^Iat 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 ^Iat 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 ^Iat 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 ^Iat 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
 ^Iat 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) 
^Iat 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
^Iat 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 ^Iat 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) 
^Iat org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) 
^Iat 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
 ^Iat org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) 
^Iat java.lang.Thread.run(Thread.java:595) ^M$
Server: Apache-Coyote/1.1^M$
Content-Type: text/html;charset=utf-8^M$
Content-Length: 6976^M$
Date: Wed, 09 Jan 2008 19:08:42 GMT^M$
Connection: close^M$
^M$
[EMAIL PROTECTED]:/var/tmp/ac-demo$
{noformat}


> Solr may send invalid HTTP error responses on exceptions
> --------------------------------------------------------
>
>                 Key: SOLR-453
>                 URL: https://issues.apache.org/jira/browse/SOLR-453
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 1.2
>         Environment: Apache Tomcat 6.0.14 (on Windows Vista Business x86)
>            Reporter: Tomer Gabel
>            Assignee: Ryan McKinley
>         Attachments: SolrErrorHandling-1.2.0.patch
>
>
> Solr sends error messages to the client via HttpServlet.sendError, with the 
> message parameter comprised of both the error message and the stack trace.
> I don't know if this is an issue with other servlet containers, but when 
> Tomcat generates the response it uses the message parameter for both the HTTP 
> 500 status line and the generated error message itself; the problem with this 
> is that, according to the HTTP 1.1 RFC 
> (http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1), the "reason 
> phrase" cannot contain CRs or LFs. The stack trace does.
> I suspect the reason this wasn't reported earlier is that the Java library's 
> HTTP client (URL.openConnection) appears to be lax when parsing the HTTP 
> response and will accept the error message without flinching. Contrariwise 
> the .NET HttpWebRequest object will, unless configured for unsafe header 
> parsing, throw an exception ("The server committed a protocol violation. 
> Section=ResponseStatusLine"). Wireshark also does not recognize this as an 
> HTTP response and will show the packets as "TCP segment[s] of a reassembled 
> PDU".
> I'm attaching a patch that uses HttpServlet.setStatus instead and then writes 
> the stack trace to the response stream, but I think a longer-term solution is 
> to have the response formatters handle the body formatting (similar to the 
> work done by Hoss Man on SOLR-141 here: 
> http://issues.apache.org/jira/browse/SOLR-141). At any rate, I suppose that 
> whether or not to write the stack trace should be a configurable option for 
> security reasons.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to