Navigation Menu

Skip to content

Commit

Permalink
test default value too
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 11, 2015
1 parent af6698e commit 393264c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/Mojolicious/Guides/FAQ.pod
Expand Up @@ -135,15 +135,15 @@ In L<Mojolicious> this event loop is L<Mojo::IOLoop>.

To protect your applications from excessively large requests and responses,
our HTTP parser has a cap after which it will automatically stop accepting new
data, and in most cases force the connection to be closed. This limit is 10MB
data, and in most cases force the connection to be closed. The limit is 10MB
by default, you can use the attribute L<Mojo::Message/"max_message_size"> or
C<MOJO_MAX_MESSAGE_SIZE> environment variable to change this value.

=head2 What does the error "Maximum start-line size exceeded" mean?

This is a very similar protection mechanism to the one described in the
previous answer, but a little more specific. It limits the maximum length of
the start-line for HTTP requests and responses. This limit is 10KB by default,
the start-line for HTTP requests and responses. The limit is 10KB by default,
you can use the attribute L<Mojo::Message/"max_line_size"> or
C<MOJO_MAX_LINE_SIZE> environment variable to change this value.

Expand All @@ -158,10 +158,9 @@ these values.

=head2 What does the error "Maximum buffer size exceeded" mean?

This protection mechanism is very similar to those mentioned in the two
previous answers. It limits how much content the HTTP parser is allowed to
buffer when parsing chunked, compressed and multipart messages. This limit is
around 256KB by default, you can use the attribute
This protection mechanism limits how much content the HTTP parser is allowed
to buffer when parsing chunked, compressed and multipart messages. The limit
is around 256KB by default, you can use the attribute
L<Mojo::Content/"max_buffer_size"> or C<MOJO_MAX_BUFFER_SIZE> environment
variable to change this value.

Expand Down
2 changes: 2 additions & 0 deletions t/mojo/request.t
Expand Up @@ -33,6 +33,7 @@ is $req->cookie('a'), undef, 'no value';
# Parse HTTP 1.1 message with huge "Cookie" header exceeding line limit
$req = Mojo::Message::Request->new;
is $req->headers->max_line_size, 10240, 'right size';
is $req->headers->max_lines, 128, 'right number';
$req->parse("GET / HTTP/1.1\x0d\x0a");
$req->parse("Cookie: @{['a=b; ' x 131072]}\x0d\x0a");
$req->parse("Content-Length: 0\x0d\x0a\x0d\x0a");
Expand Down Expand Up @@ -99,6 +100,7 @@ is $req->body, '', 'no content';
# Parse broken HTTP 1.1 message with start-line exceeding line limit
$req = Mojo::Message::Request->new;
is $req->max_line_size, 10240, 'right size';
is $req->headers->max_lines, 128, 'right number';
$req->parse("GET /@{['abcd' x 131072]} HTTP/1.1");
ok $req->is_finished, 'request is finished';
is $req->error->{message}, 'Maximum start-line size exceeded', 'right error';
Expand Down

0 comments on commit 393264c

Please sign in to comment.