Fixed response status message string, that was trimmed after the first

space.
This commit is contained in:
Simone Bordet 2014-05-21 17:44:56 +02:00
parent 9e1cac33d0
commit 65e13ce08f
1 changed files with 6 additions and 4 deletions

View File

@ -166,12 +166,14 @@ public class ResponseContentParser extends StreamContentParser
// Need to set the response status so the // Need to set the response status so the
// HttpParser can handle the content properly. // HttpParser can handle the content properly.
String[] parts = httpField.getValue().split(" "); String value = httpField.getValue();
int code = Integer.parseInt(parts[0]); String[] parts = value.split(" ");
String status = parts[0];
int code = Integer.parseInt(status);
httpParser.setResponseStatus(code); httpParser.setResponseStatus(code);
String reason = parts.length > 1 ? parts[1] : HttpStatus.getMessage(code); String reason = parts.length > 1 ? value.substring(status.length()) : HttpStatus.getMessage(code);
notifyBegin(code, reason); notifyBegin(code, reason.trim());
notifyHeaders(fields); notifyHeaders(fields);
} }
} }