Skip to content

Commit c32767a

Browse files
Both HTTP method and query can have a value of '0'
The Method ABNF is in https://datatracker.ietf.org/doc/html/rfc9110#appendix-A and is equivalent to the regex: ^[a-zA-Z0-9!#$%&'*+.^_`|~-]+$
1 parent 834a1f3 commit c32767a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Mojo/Message/Request.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ sub _parse_env {
176176
$headers->content_length($env->{CONTENT_LENGTH}) if $env->{CONTENT_LENGTH};
177177

178178
# Query
179-
$url->query->parse($env->{QUERY_STRING}) if $env->{QUERY_STRING};
179+
$url->query->parse($env->{QUERY_STRING}) if length $env->{QUERY_STRING};
180180

181181
# Method
182-
$self->method($env->{REQUEST_METHOD}) if $env->{REQUEST_METHOD};
182+
$self->method($env->{REQUEST_METHOD}) if defined $env->{REQUEST_METHOD};
183183

184184
# Scheme/Version
185185
$base->scheme($1) and $self->version($2) if ($env->{SERVER_PROTOCOL} // '') =~ m!^([^/]+)/([^/]+)$!;

0 commit comments

Comments
 (0)