final boolean lineComplete = this.sessionBuffer.readLine(this.lineBuf, this.endOfStream);
final int maxLineLen = this.constraints.getMaxLineLength();
if (maxLineLen > 0 &&
(this.lineBuf.length() > maxLineLen ||
(!lineComplete && this.sessionBuffer.length() > maxLineLen))) {
throw new MessageConstraintException("Maximum line length limit exceeded");
}
if (!lineComplete) {
break;
}
switch (this.state) {
case READ_HEAD_LINE:
try {
parseHeadLine();
} catch (final ParseException px) {
throw new ProtocolException(px.getMessage(), px);
}
this.state = READ_HEADERS;
break;
case READ_HEADERS:
if (this.lineBuf.length() > 0) {
final int maxHeaderCount = this.constraints.getMaxHeaderCount();
if (maxHeaderCount > 0 && headerBufs.size() >= maxHeaderCount) {
throw new MessageConstraintException("Maximum header count exceeded");
}
parseHeader();
} else {
this.state = COMPLETED;