mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
rfc7230 compliance, limits, and tests for basic_parser_v1:
New parser set_option function for controlling independent size limits on headers and body. By default request and response parsers are set up with reasonable limits to prevent resource exhaustion attacks. * Parser adheres strictly to rfc7230 * Increased test coverage * Headers and body maximum size limit options
This commit is contained in:
@@ -23,8 +23,8 @@ enum class parse_error
|
||||
bad_crlf,
|
||||
bad_request,
|
||||
|
||||
bad_status_code,
|
||||
bad_status,
|
||||
bad_reason,
|
||||
|
||||
bad_field,
|
||||
bad_value,
|
||||
@@ -33,7 +33,11 @@ enum class parse_error
|
||||
bad_on_headers_rv,
|
||||
|
||||
invalid_chunk_size,
|
||||
invalid_ext_name,
|
||||
invalid_ext_val,
|
||||
|
||||
headers_too_big,
|
||||
body_too_big,
|
||||
short_read,
|
||||
|
||||
general
|
||||
@@ -60,7 +64,7 @@ public:
|
||||
return "bad method";
|
||||
|
||||
case parse_error::bad_uri:
|
||||
return "bad Request-URI";
|
||||
return "bad request-target";
|
||||
|
||||
case parse_error::bad_version:
|
||||
return "bad HTTP-Version";
|
||||
@@ -69,13 +73,13 @@ public:
|
||||
return "missing CRLF";
|
||||
|
||||
case parse_error::bad_request:
|
||||
return "bad Request-Line";
|
||||
|
||||
case parse_error::bad_status_code:
|
||||
return "bad Status-Code";
|
||||
return "bad reason-phrase";
|
||||
|
||||
case parse_error::bad_status:
|
||||
return "bad Status-Line";
|
||||
return "bad status-code";
|
||||
|
||||
case parse_error::bad_reason:
|
||||
return "bad reason-phrase";
|
||||
|
||||
case parse_error::bad_field:
|
||||
return "bad field token";
|
||||
@@ -95,6 +99,18 @@ public:
|
||||
case parse_error::invalid_chunk_size:
|
||||
return "invalid chunk size";
|
||||
|
||||
case parse_error::invalid_ext_name:
|
||||
return "invalid ext name";
|
||||
|
||||
case parse_error::invalid_ext_val:
|
||||
return "invalid ext val";
|
||||
|
||||
case parse_error::headers_too_big:
|
||||
return "headers size limit exceeded";
|
||||
|
||||
case parse_error::body_too_big:
|
||||
return "body size limit exceeded";
|
||||
|
||||
case parse_error::short_read:
|
||||
return "unexpected end of data";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user