public class ChunkedInputFilter extends Object implements InputFilter
Modifier and Type | Field and Description |
---|---|
protected byte[] |
buf
Read bytes buffer.
|
protected InputBuffer |
buffer
Next buffer in the pipeline.
|
protected static ByteChunk |
ENCODING |
protected static String |
ENCODING_NAME |
protected boolean |
endChunk
Flag set to true when the end chunk has been read.
|
protected int |
lastValid
Last valid byte in the buffer.
|
protected boolean |
needCRLFParse
Flag set to true if the next call to doRead() must parse a CRLF pair
before doing anything else.
|
protected int |
pos
Position in the buffer.
|
protected ByteChunk |
readChunk
Byte chunk used to read bytes.
|
protected int |
remaining
Number of bytes remaining in the current chunk.
|
protected ByteChunk |
trailingHeaders
Byte chunk used to store trailing headers.
|
Constructor and Description |
---|
ChunkedInputFilter(int maxTrailerSize,
Set<String> allowedTrailerHeaders,
int maxExtensionSize,
int maxSwallowSize) |
Modifier and Type | Method and Description |
---|---|
int |
available()
Amount of bytes still available in a buffer.
|
int |
doRead(ByteChunk chunk,
Request req)
Read bytes.
|
long |
end()
End the current request.
|
ByteChunk |
getEncodingName()
Return the name of the associated encoding; Here, the value is
"identity".
|
protected boolean |
parseChunkHeader()
Parse the header of a chunk.
|
protected boolean |
parseCRLF()
Deprecated.
|
protected void |
parseCRLF(boolean tolerant)
Parse CRLF at end of chunk.
|
protected void |
parseEndChunk()
Parse end chunk data.
|
protected int |
readBytes()
Read bytes from the previous buffer.
|
void |
recycle()
Make the filter ready to process the next request.
|
void |
setBuffer(InputBuffer buffer)
Set the next buffer in the filter pipeline.
|
void |
setRequest(Request request)
Read the content length from the request.
|
protected static final String ENCODING_NAME
protected static final ByteChunk ENCODING
protected InputBuffer buffer
protected int remaining
protected int pos
protected int lastValid
protected byte[] buf
protected ByteChunk readChunk
protected boolean endChunk
protected ByteChunk trailingHeaders
protected boolean needCRLFParse
public int doRead(ByteChunk chunk, Request req) throws IOException
doRead
in interface InputFilter
doRead
in interface InputBuffer
chunk
- The buffer to read data into.req
- The associated requestIOException
- If an I/O error occurs reading from the input streampublic void setRequest(Request request)
setRequest
in interface InputFilter
public long end() throws IOException
end
in interface InputFilter
IOException
public int available()
available
in interface InputBuffer
public void setBuffer(InputBuffer buffer)
setBuffer
in interface InputFilter
public void recycle()
recycle
in interface InputFilter
public ByteChunk getEncodingName()
getEncodingName
in interface InputFilter
protected int readBytes() throws IOException
IOException
protected boolean parseChunkHeader() throws IOException
The letters before CRLF or ';' (whatever comes first) must be valid hex digits. We should not parse F23IAMGONNAMESSTHISUP34CRLF as a valid header according to the spec.
IOException
@Deprecated protected boolean parseCRLF() throws IOException
parseCRLF(boolean)
IOException
protected void parseCRLF(boolean tolerant) throws IOException
tolerant
- Should tolerant parsing (LF and CRLF) be used? This
is recommended (RFC2616, section 19.3) for message
headers.IOException
protected void parseEndChunk() throws IOException
IOException
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.