You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2014/01/08 11:20:30 UTC
[Bug 55976] Broken response from NIO connector in Tomcat 7.0.50
https://issues.apache.org/bugzilla/show_bug.cgi?id=55976
Ognjen Blagojevic <og...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
OS| |All
--- Comment #1 from Ognjen Blagojevic <og...@gmail.com> ---
Java client is used for smoke testing Tomcat 7.0.50. Java client fails with
following exception:
====
Exception in thread "main" java.lang.RuntimeException: java.io.IOException:
Invalid Http response
at webcrawler.WebCrawler.getpage(WebCrawler.java:117)
at webcrawler.WebCrawler.repeat(WebCrawler.java:191)
at webcrawler.WebCrawler.main(WebCrawler.java:30)
Caused by: java.io.IOException: Invalid Http response
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1342)
at java.net.URL.openStream(URL.java:1037)
at webcrawler.WebCrawler.getpage(WebCrawler.java:94)
... 2 more
----
Relevant lines from sun.net.www.protocol.http.HttURLConnection.getInputStream:
====
respCode = getResponseCode();
if (respCode == -1) {
disconnectInternal();
throw new IOException ("Invalid Http response");
}
----
So, getResponseCode returns -1. Relevant part from
sun.net.www.protocol.http.HttURLConnection.getResponseCode():
====
/*
* Examine the status-line - should be formatted as per
* section 6.1 of RFC 2616 :-
*
* Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase
*
* If status line can't be parsed return -1.
*/
if (statusLine.startsWith("HTTP/1.")) {
int codePos = statusLine.indexOf(' ');
if (codePos > 0) {
int phrasePos = statusLine.indexOf(' ', codePos+1);
if (phrasePos > 0 && phrasePos < statusLine.length()) {
responseMessage = statusLine.substring(phrasePos+1);
}
// deviation from RFC 2616 - don't reject status line
// if SP Reason-Phrase is not included.
if (phrasePos < 0)
phrasePos = statusLine.length();
try {
responseCode = Integer.parseInt
(statusLine.substring(codePos+1, phrasePos));
return responseCode;
} catch (NumberFormatException e) { }
}
}
return -1;
----
So it seems that response from Tomcat doesn't contain string "HTTP/1." in the
first line.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org