Skip to content

Commit

Permalink
fixed a few examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 16, 2013
1 parent 7cc950a commit 8321dd8
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
3 changes: 2 additions & 1 deletion lib/Mojo/Content.pm
Expand Up @@ -589,7 +589,8 @@ Get leftover data from content parser.
=head2 parse
$content = $content->parse("Content-Length: 12\r\n\r\nHello World!");
$content
= $content->parse("Content-Length: 12\x0d\x0a\x0d\x0aHello World!");
Parse content chunk.
Expand Down
7 changes: 4 additions & 3 deletions lib/Mojo/Content/Single.pm
Expand Up @@ -66,7 +66,7 @@ Mojo::Content::Single - HTTP content
use Mojo::Content::Single;
my $single = Mojo::Content::Single->new;
$single->parse("Content-Length: 12\r\n\r\nHello World!");
$single->parse("Content-Length: 12\x0d\x0a\x0d\x0aHello World!");
say $single->headers->content_length;
=head1 DESCRIPTION
Expand Down Expand Up @@ -153,8 +153,9 @@ Get a chunk of content starting from a specfic position.
=head2 parse
$single = $single->parse("Content-Length: 12\r\n\r\nHello World!");
my $multi = $single->parse("Content-Type: multipart/form-data\r\n\r\n");
$single = $single->parse("Content-Length: 12\x0d\x0a\x0d\x0aHello World!");
my $multi
= $single->parse("Content-Type: multipart/form-data\x0d\x0a\x0d\x0a");
Parse content chunk and upgrade to L<Mojo::Content::MultiPart> object if
possible.
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojo/Headers.pm
Expand Up @@ -179,8 +179,8 @@ Mojo::Headers - Headers
# Parse
my $headers = Mojo::Headers->new;
$headers->parse("Content-Length: 42\r\n");
$headers->parse("Content-Type: text/html\r\n\r\n");
$headers->parse("Content-Length: 42\x0d\x0a");
$headers->parse("Content-Type: text/html\x0d\x0a\x0d\x0a");
say $headers->content_length;
say $headers->content_type;
Expand Down Expand Up @@ -441,7 +441,7 @@ Shortcut for the C<Origin> header from RFC 6454.
=head2 parse
$headers = $headers->parse("Content-Type: text/plain\r\n\r\n");
$headers = $headers->parse("Content-Type: text/plain\x0d\x0a\x0d\x0a");
Parse formatted headers.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/IOLoop.pm
Expand Up @@ -318,7 +318,7 @@ Mojo::IOLoop - Minimalistic event loop
});
# Write request
$stream->write("GET / HTTP/1.1\r\n\r\n");
$stream->write("GET / HTTP/1.1\x0d\x0a\x0d\x0a");
});
# Add a timer
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojolicious/Guides/FAQ.pod
Expand Up @@ -69,9 +69,9 @@ variable to change this value.

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
any C<\r\n> terminated part of a HTTP message, such as request line, status
line and headers. This limit is around C<10KB> by default, you can use the
C<MOJO_MAX_LINE_SIZE> environment variable to change this value.
any C<\x0d\x0a> terminated part of a HTTP message, such as request line,
status line and headers. This limit is around C<10KB> by default, you can use
the C<MOJO_MAX_LINE_SIZE> environment variable to change this value.

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

Expand Down

0 comments on commit 8321dd8

Please sign in to comment.