Class HttpParser
java.lang.Object
org.netpreserve.jwarc.MessageParser
org.netpreserve.jwarc.HttpParser
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionheaders()booleanisError()booleanvoidConfigures the parser to read a HTTP request while allowing some deviations from the standard: The number of spaces in the request line may vary Any character except space and newline is allowed in the target Lines may end with LF instead of CRLF Any byte except LF is allowed in header field values Whitespace is allowed between the field name and colonvoidConfigures the parser to read a HTTP response while allowing some deviations from the standard: The number of spaces in the status line may vary Lines may end with LF instead of CRLF Any byte except LF is allowed in header field values Whitespace is allowed between the field name and colonmethod()voidparse(ByteBuffer data) Runs the parser on a buffer of data.voidparse(ReadableByteChannel channel, ByteBuffer buffer) reason()voidreset()intstatus()voidConfigures the parser to read a HTTP request while rejecting deviations from the standard.voidConfigures the parser to read a HTTP response while rejecting deviations from the standard.target()version()Methods inherited from class org.netpreserve.jwarc.MessageParser
emitWarning, getErrorContext, getErrorContext
-
Constructor Details
-
HttpParser
public HttpParser()
-
-
Method Details
-
reset
public void reset() -
headers
-
version
-
status
public int status() -
reason
-
target
-
method
-
isFinished
public boolean isFinished() -
isError
public boolean isError() -
strictRequest
public void strictRequest()Configures the parser to read a HTTP request while rejecting deviations from the standard. -
strictResponse
public void strictResponse()Configures the parser to read a HTTP response while rejecting deviations from the standard. -
lenientRequest
public void lenientRequest()Configures the parser to read a HTTP request while allowing some deviations from the standard:- The number of spaces in the request line may vary
- Any character except space and newline is allowed in the target
- Lines may end with LF instead of CRLF
- Any byte except LF is allowed in header field values
- Whitespace is allowed between the field name and colon
-
lenientResponse
public void lenientResponse()Configures the parser to read a HTTP response while allowing some deviations from the standard:- The number of spaces in the status line may vary
- Lines may end with LF instead of CRLF
- Any byte except LF is allowed in header field values
- Whitespace is allowed between the field name and colon
-
parse
Runs the parser on a buffer of data. Passing null as the buffer indicates the end of input. -
parse
- Throws:
IOException
-