Package org.jboss.netty.handler.codec.frame

Examples of org.jboss.netty.handler.codec.frame.TooLongFrameException


            return null;
        } finally {
            if (buffer.readerIndex() - messageStartReaderIndex > maxFrameSize) {
                Channels.fireExceptionCaught(
                        ctx,
                        new TooLongFrameException("Maximum frame size of " + maxFrameSize +
                                                  " exceeded")
                );
            }

            buffer.readerIndex(messageStartReaderIndex);
View Full Code Here


       
        final int endOfLength = buf.indexOf(12, buf.readableBytes(), (byte) '\01');
        if(endOfLength==-1){
            if(buf.readableBytes()>maxlength){
                //too many characters read, but no length field found
                throw new TooLongFrameException("End of length field not found within "+(maxlength+12)+" bytes");
            }
            //end of length field not found
            return null;
        }
       
        final String lengthStr = buf.slice(12, endOfLength-12).toString(Charset.forName("US-ASCII"));
       
        final int length = Integer.parseInt(lengthStr);
       
        final int totalLength = length+endOfLength+8;
       
        if(totalLength>9999){
            throw new TooLongFrameException("Frame length may not be greater than 9999 bytes");
        }

        if (buf.readableBytes() < totalLength) {
            return null;
        }
View Full Code Here

                return sb.toString();
            }
            else {
                // Abort decoding if the header part is too large.
                if (headerSize >= maxHeaderSize) {
                    throw new TooLongFrameException(
                            "HTTP header is larger than " +
                            maxHeaderSize + " bytes.");

                }
                headerSize ++;
View Full Code Here

            else if (nextByte == HttpCodecUtil.LF) {
                return sb.toString();
            }
            else {
                if (lineLength >= maxLineLength) {
                    throw new TooLongFrameException(
                            "An HTTP line is larger than " + maxLineLength +
                            " bytes.");
                }
                lineLength ++;
                sb.append((char) nextByte);
View Full Code Here

    final int buffered = buffer.readableBytes();
    if (!discarding && buffered > max_length) {
      discarding = true;
      Channels.fireExceptionCaught(ctx.getChannel(),
        new TooLongFrameException("Frame length exceeds " + max_length + " ("
                                  + buffered + " bytes buffered already)"));
    }
    if (discarding) {
      buffer.skipBytes(buffer.readableBytes());
    }
View Full Code Here

            ChannelBuffer content = currentMessage.getContent();

            if (content.readableBytes() > maxContentLength - chunk.getContent().readableBytes()) {
                tooLongFrameFound = true;

                throw new TooLongFrameException(
                        "HTTP content length exceeded " + maxContentLength +
                        " bytes.");
            }

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

            }

            ChannelBuffer content = httpMessage.getContent();
            if (content.readableBytes() > maxContentLength - spdyDataFrame.getData().readableBytes()) {
                removeMessage(streamId);
                throw new TooLongFrameException(
                        "HTTP content length exceeded " + maxContentLength + " bytes.");
            }

            if (content == ChannelBuffers.EMPTY_BUFFER) {
                content = ChannelBuffers.dynamicBuffer(channel.getConfig().getBufferFactory());
View Full Code Here

                return sb.toString();
            }
            else {
                // Abort decoding if the header part is too large.
                if (headerSize >= maxHeaderSize) {
                    throw new TooLongFrameException(
                            "HTTP header is larger than " +
                            maxHeaderSize + " bytes.");

                }
                headerSize ++;
View Full Code Here

            else if (nextByte == HttpCodecUtil.LF) {
                return sb.toString();
            }
            else {
                if (lineLength >= maxLineLength) {
                    throw new TooLongFrameException(
                            "An HTTP line is larger than " + maxLineLength +
                            " bytes.");
                }
                lineLength ++;
                sb.append((char) nextByte);
View Full Code Here

        if (dataLen <= 0) {
            throw new StreamCorruptedException("invalid data length: " + dataLen);
        }
        // safety against too large frames being sent
        if (dataLen > NINETY_PER_HEAP_SIZE) {
            throw new TooLongFrameException(
                    "transport content length received [" + new ByteSizeValue(dataLen) + "] exceeded [" + new ByteSizeValue(NINETY_PER_HEAP_SIZE) + "]");
        }

        if (buffer.readableBytes() < dataLen + 4) {
            return null;
View Full Code Here

TOP

Related Classes of org.jboss.netty.handler.codec.frame.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.