Package io.netty.handler.codec

Examples of io.netty.handler.codec.TooLongFrameException


                if (in.readableBytes() < 4) {
                    return;
                }
                len = packetLength = (int) in.readUnsignedInt();
                if (maxBufferSize != -1 && maxBufferSize < packetLength) {
                    TooLongFrameException ex = new TooLongFrameException(
                            "Frame exceed exceed max buffer size: " + packetLength + " > " + maxBufferSize);
                    ctx.fireExceptionCaught(ex);
                    ctx.close();
                    return;
                }
View Full Code Here


                tooLongFrameFound = true;

                currentMessage.release();
                this.currentMessage = null;

                throw new TooLongFrameException("Memcache content length exceeded " + getMaxContentLength()
                    + " bytes.");
            }

            if (chunk.content().isReadable()) {
                chunk.retain();
View Full Code Here

             if (in.readableBytes() < 4) {
                 return;
             }
             len = packetLength = (int) in.readUnsignedInt();
             if (maxBufferSize != -1 && maxBufferSize < packetLength) {
                 TooLongFrameException ex = new TooLongFrameException(
                         "Frame exceed exceed max buffer size: " + packetLength + " > " + maxBufferSize);
                 ctx.fireExceptionCaught(ex);
                 ctx.close();
                 return;
             }
View Full Code Here

        }
        b0 |= msg.rsv() % 8 << 4;
        b0 |= opcode % 128;

        if (opcode == OPCODE_PING && length > 125) {
            throw new TooLongFrameException("invalid payload for PING (payload length must be <= 125, was "
                    + length);
        }

        int maskLength = maskPayload ? 4 : 0;
        if (length <= 125) {
View Full Code Here

            Object obj = unmarshaller.readObject();
            unmarshaller.finish();
            return obj;
        } catch (LimitingByteInput.TooBigObjectException e) {
            discardingTooLongFrame = true;
            throw new TooLongFrameException();
        } finally {
            // Call close in a finally block as the ReplayingDecoder will throw an Error if not enough bytes are
            // readable. This helps to be sure that we do not leak resource
            unmarshaller.close();
        }
View Full Code Here

            if (content.readableBytes() > maxContentLength - chunk.data().readableBytes()) {
                // TODO: Respond with 413 Request Entity Too Large
                //   and discard the traffic or close the connection.
                //       No need to notify the upstream handlers - just log.
                //       If decoding a response, just throw an exception.
                throw new TooLongFrameException(
                        "HTTP content length exceeded " + maxContentLength +
                        " bytes.");
            }

            // Append the content of the chunk
View Full Code Here

        do {
            b = buffer.readByte();
            frameSize <<= 7;
            frameSize |= b & 0x7f;
            if (frameSize > maxFrameSize) {
                throw new TooLongFrameException();
            }
            lengthFieldSize++;
            if (lengthFieldSize > 8) {
                // Perhaps a malicious peer?
                throw new TooLongFrameException();
            }
        } while ((b & 0x80) == 0x80);

        if (type == (byte) 0xFF && frameSize == 0) {
            receivedClosingHandshake = true;
View Full Code Here

        int delimPos = buffer.indexOf(ridx, ridx + rbytes, (byte) 0xFF);
        if (delimPos == -1) {
            // Frame delimiter (0xFF) not found
            if (rbytes > maxFrameSize) {
                // Frame length exceeded the maximum
                throw new TooLongFrameException();
            } else {
                // Wait until more data is received
                return null;
            }
        }

        int frameSize = delimPos - ridx;
        if (frameSize > maxFrameSize) {
            throw new TooLongFrameException();
        }

        ByteBuf binaryData = ctx.alloc().buffer(frameSize);
        buffer.readBytes(binaryData);
        buffer.skipBytes(1);
View Full Code Here

            if (headerSize >= maxHeaderSize) {
                // TODO: Respond with Bad Request and discard the traffic
                //    or close the connection.
                //       No need to notify the upstream handlers - just log.
                //       If decoding a response, just throw an exception.
                throw new TooLongFrameException(
                        "HTTP header is larger than " +
                        maxHeaderSize + " bytes.");
            }

            sb.append(nextByte);
View Full Code Here

                if (lineLength >= maxLineLength) {
                    // TODO: Respond with Bad Request and discard the traffic
                    //    or close the connection.
                    //       No need to notify the upstream handlers - just log.
                    //       If decoding a response, just throw an exception.
                    throw new TooLongFrameException(
                            "An HTTP line is larger than " + maxLineLength +
                            " bytes.");
                }
                lineLength ++;
                sb.append((char) nextByte);
View Full Code Here

TOP

Related Classes of io.netty.handler.codec.TooLongFrameException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.