@@ -93,6 +93,37 @@ subtest 'Parse Apache CGI environment variables and body' => sub {
93
93
' right absolute URL' ;
94
94
};
95
95
96
+ subtest ' Parse CGI environment with maximum message size' => sub {
97
+ my $req = Mojo::Message::Request-> new;
98
+ $req -> max_message_size(10);
99
+ $req -> parse({
100
+ CONTENT_LENGTH => 26,
101
+ CONTENT_TYPE => ' application/x-www-form-urlencoded' ,
102
+ HTTP_DNT => 1,
103
+ PATH_INFO => ' /test/index.cgi/foo/bar' ,
104
+ QUERY_STRING => ' lalala=23&bar=baz' ,
105
+ REQUEST_METHOD => ' POST' ,
106
+ SCRIPT_NAME => ' /test/index.cgi' ,
107
+ HTTP_HOST => ' localhost:8080' ,
108
+ SERVER_PROTOCOL => ' HTTP/1.0'
109
+ });
110
+ $req -> parse(' abcdefghijklm' );
111
+ $req -> parse(' nopqrstuvwxyz' );
112
+ ok $req -> is_finished, ' request is finished' ;
113
+ ok $req -> is_limit_exceeded, ' limit exceeded' ;
114
+ is $req -> method, ' POST' , ' right method' ;
115
+ is $req -> url-> path, ' foo/bar' , ' right path' ;
116
+ is $req -> url-> base-> path, ' /test/index.cgi/' , ' right base path' ;
117
+ is $req -> url-> base-> host, ' localhost' , ' right base host' ;
118
+ is $req -> url-> base-> port, 8080, ' right base port' ;
119
+ is $req -> url-> query, ' lalala=23&bar=baz' , ' right query' ;
120
+ is $req -> version, ' 1.0' , ' right version' ;
121
+ is $req -> headers-> dnt, 1, ' right "DNT" value' ;
122
+ is $req -> body, ' abcdefghijklm' , ' right content' ;
123
+ is $req -> url-> to_abs-> to_string, ' http://localhost:8080/test/index.cgi/foo/bar?lalala=23&bar=baz' ,
124
+ ' right absolute URL' ;
125
+ };
126
+
96
127
subtest ' Parse Apache CGI environment variables and body (file storage)' => sub {
97
128
local $ENV {MOJO_MAX_MEMORY_SIZE } = 10;
98
129
my $req = Mojo::Message::Request-> new;
0 commit comments