Skip to content

Commit

Permalink
improved Mojo::Message::Request to allow curly brackets in URLs (closes
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed May 30, 2013
1 parent 790e80e commit a4aa654
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Changes
@@ -1,5 +1,6 @@

4.08 2013-05-28
4.08 2013-05-30
- Improved Mojo::Message::Request to allow curly brackets in URLs.
- Improved HMAC-SHA1 performance in Mojo::Util.

4.07 2013-05-26
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojo/Message/Request.pm
Expand Up @@ -11,10 +11,10 @@ has url => sub { Mojo::URL->new };

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;

Expand Down
6 changes: 3 additions & 3 deletions t/mojo/request.t
Expand Up @@ -1680,7 +1680,7 @@ is $req->param('Zuname'), '', 'right value';
is $req->param('Text'), '', 'right value';
is $req->content->parts->[0]->asset->slurp, 'T', 'right content';

# Google Chrome 5 multipart/form-data request (UTF-8)
# Chrome 5 multipart/form-data request (UTF-8)
$req = Mojo::Message::Request->new;
my ($fname, $sname, $sex, $avatar, $submit)
= map { encode 'UTF-8', $_ } 'Иван', 'Иванов', 'мужской',
Expand Down Expand Up @@ -1934,11 +1934,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@!$&\'()*+,;=%', 'right URL';
is $req->url, '/#09azAZ-._~:/?%5B%5D%7B%7D@!$&\'()*+,;=%', 'right URL';

done_testing();

0 comments on commit a4aa654

Please sign in to comment.