Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
improved Mojo::Message::Request to allow pipe symbol in URLs (closes #…
  • Loading branch information
kraih committed Jun 6, 2013
1 parent e2d5912 commit 6ba7319
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,5 +1,6 @@

4.12 2013-06-06
- Improved Mojo::Message::Request to allow pipe symbol in URLs.

4.11 2013-06-03
- Added allow and append methods to Mojo::Headers.
Expand Down
10 changes: 5 additions & 5 deletions lib/Mojo/Message/Request.pm
Expand Up @@ -9,14 +9,14 @@ has env => sub { {} };
has method => 'GET';
has url => sub { Mojo::URL->new };

my $START_LINE_RE = qr|
my $START_LINE_RE = qr/
^
([a-zA-Z]+) # Method
([a-zA-Z]+) # Method
\s+
([0-9a-zA-Z\-._~:/?#[\]\{\}\@!\$&'()*+,;=\%]+) # Path
(?:\s+HTTP/(\d\.\d))? # Version
([0-9a-zA-Z\-._~:\/?#[\]\{\}\@!\$&'()|*+,;=\%]+) # Path
(?:\s+HTTP\/(\d\.\d))? # Version
$
|x;
/x;

sub clone {
my $self = shift;
Expand Down
4 changes: 2 additions & 2 deletions t/mojo/request.t
Expand Up @@ -1893,11 +1893,11 @@ is $req->url->query->params->[0], 'Mojo::Message::Request', 'right value';

# Parse lots of special characters in URL
$req = Mojo::Message::Request->new;
$req->parse('GET /#09azAZ-._~:/?[]{}@!$&\'()*+,;=% ');
$req->parse('GET /#09azAZ-._~:/?[]{}@!$&\'()|*+,;=% ');
$req->parse("HTTP/1.1\x0d\x0a\x0d\x0a");
ok $req->is_finished, 'request is finished';
is $req->method, 'GET', 'right method';
is $req->version, '1.1', 'right version';
is $req->url, '/#09azAZ-._~:/?%5B%5D%7B%7D@!$&\'()*+,;=%', 'right URL';
is $req->url, '/#09azAZ-._~:/?%5B%5D%7B%7D@!$&\'()%7C*+,;=%', 'right URL';

done_testing();

0 comments on commit 6ba7319

Please sign in to comment.