This is an automated email from the ASF dual-hosted git repository. elecharny pushed a commit to branch 2.2.X in repository https://gitbox.apache.org/repos/asf/mina.git
commit d50ced082f4bdc35a6e5fe95063ba8767df201ad Author: emmanuel lecharny <elecha...@apache.org> AuthorDate: Sun Apr 30 05:22:20 2023 +0200 Clarified the code by using meaningfull variable nalme --- .../main/java/org/apache/mina/http/HttpServerDecoder.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mina-http/src/main/java/org/apache/mina/http/HttpServerDecoder.java b/mina-http/src/main/java/org/apache/mina/http/HttpServerDecoder.java index 699292447..3556adbb4 100644 --- a/mina-http/src/main/java/org/apache/mina/http/HttpServerDecoder.java +++ b/mina-http/src/main/java/org/apache/mina/http/HttpServerDecoder.java @@ -84,8 +84,8 @@ public class HttpServerDecoder implements ProtocolDecoder { DecoderState state = (DecoderState) session.getAttribute(DECODER_STATE_ATT); if (null == state) { - session.setAttribute(DECODER_STATE_ATT, DecoderState.NEW); - state = (DecoderState) session.getAttribute(DECODER_STATE_ATT); + state = DecoderState.NEW; + session.setAttribute(DECODER_STATE_ATT, state); } switch (state) { @@ -105,9 +105,11 @@ public class HttpServerDecoder implements ProtocolDecoder { LOGGER.debug("decoding NEW"); } - HttpRequestImpl rq = parseHttpRequestHead(msg.buf()); + HttpRequestImpl httpRequest = parseHttpRequestHead(msg.buf()); + session.removeAttribute(DECODER_STATE_ATT); + - if (rq == null) { + if (httpRequest == null) { // we copy the incoming BB because it's going to be recycled by the inner IoProcessor for next reads ByteBuffer partial = ByteBuffer.allocate(msg.remaining()); partial.put(msg.buf()); @@ -117,9 +119,9 @@ public class HttpServerDecoder implements ProtocolDecoder { session.setAttribute(DECODER_STATE_ATT, DecoderState.HEAD); break; } else { - out.write(rq); + out.write(httpRequest); // is it a request with some body content ? - String contentLen = rq.getHeader("content-length"); + String contentLen = httpRequest.getHeader("content-length"); if (contentLen != null) { if (LOGGER.isDebugEnabled()) {