mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Increase the max URI path length to 2048 chars from 1024 chars
This commit is contained in:
parent
d6496632fd
commit
139690ecf9
3 changed files with 24 additions and 5 deletions
|
@ -30,8 +30,8 @@ public class Http11 extends RubyObject {
|
|||
public final static String MAX_REQUEST_URI_LENGTH_ERR = "HTTP element REQUEST_URI is longer than the 12288 allowed length.";
|
||||
public final static int MAX_FRAGMENT_LENGTH = 1024;
|
||||
public final static String MAX_FRAGMENT_LENGTH_ERR = "HTTP element REQUEST_PATH is longer than the 1024 allowed length.";
|
||||
public final static int MAX_REQUEST_PATH_LENGTH = 1024;
|
||||
public final static String MAX_REQUEST_PATH_LENGTH_ERR = "HTTP element REQUEST_PATH is longer than the 1024 allowed length.";
|
||||
public final static int MAX_REQUEST_PATH_LENGTH = 2048;
|
||||
public final static String MAX_REQUEST_PATH_LENGTH_ERR = "HTTP element REQUEST_PATH is longer than the 2048 allowed length.";
|
||||
public final static int MAX_QUERY_STRING_LENGTH = 1024 * 10;
|
||||
public final static String MAX_QUERY_STRING_LENGTH_ERR = "HTTP element QUERY_STRING is longer than the 10240 allowed length.";
|
||||
public final static int MAX_HEADER_LENGTH = 1024 * (80 + 32);
|
||||
|
|
|
@ -52,7 +52,7 @@ DEF_MAX_LENGTH(FIELD_NAME, 256);
|
|||
DEF_MAX_LENGTH(FIELD_VALUE, 80 * 1024);
|
||||
DEF_MAX_LENGTH(REQUEST_URI, 1024 * 12);
|
||||
DEF_MAX_LENGTH(FRAGMENT, 1024); /* Don't know if this length is specified somewhere or not */
|
||||
DEF_MAX_LENGTH(REQUEST_PATH, 1024);
|
||||
DEF_MAX_LENGTH(REQUEST_PATH, 2048);
|
||||
DEF_MAX_LENGTH(QUERY_STRING, (1024 * 10));
|
||||
DEF_MAX_LENGTH(HEADER, (1024 * (80 + 32)));
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class Http11ParserTest < Test::Unit::TestCase
|
|||
assert_equal '/', req['REQUEST_PATH']
|
||||
assert_equal 'HTTP/1.1', req['HTTP_VERSION']
|
||||
assert_equal '/', req['REQUEST_URI']
|
||||
assert_equal 'GET', req['REQUEST_METHOD']
|
||||
assert_equal 'GET', req['REQUEST_METHOD']
|
||||
assert_nil req['FRAGMENT']
|
||||
assert_nil req['QUERY_STRING']
|
||||
|
||||
|
@ -81,7 +81,26 @@ class Http11ParserTest < Test::Unit::TestCase
|
|||
|
||||
return res
|
||||
end
|
||||
|
||||
|
||||
def test_max_uri_path_length
|
||||
parser = HttpParser.new
|
||||
req = {}
|
||||
|
||||
# Support URI path length to a max of 2048
|
||||
path = "/" + rand_data(1000, 100)
|
||||
http = "GET #{path} HTTP/1.1\r\n\r\n"
|
||||
parser.execute(req, http, 0)
|
||||
assert_equal path, req['REQUEST_PATH']
|
||||
parser.reset
|
||||
|
||||
# Raise exception if URI path length > 2048
|
||||
path = "/" + rand_data(2048, 100)
|
||||
http = "GET #{path} HTTP/1.1\r\n\r\n"
|
||||
assert_raises Puma::HttpParserError do
|
||||
parser.execute(req, http, 0)
|
||||
parser.reset
|
||||
end
|
||||
end
|
||||
|
||||
def test_horrible_queries
|
||||
parser = HttpParser.new
|
||||
|
|
Loading…
Add table
Reference in a new issue