if($res->_has_response_cb) {
## we have not called the response callback yet, so we are safe to send
## the whole body to PSGI
-
+
my @headers;
$res->headers->scan(sub { push @headers, @_ });
# In the past, Catalyst only looked for ->read not ->getline. It is very possible
# that one might have an object that respected read but did not have getline.
# As a result, we need to handle this case for backcompat.
-
+
# We will just do the old loop for now. In a future version of Catalyst this support
- # will be removed and one will have to rewrite their custom object or use
+ # will be removed and one will have to rewrite their custom object or use
# Plack::Middleware::AdaptFilehandleRead. In anycase support for this is officially
# deprecated and described as such as of 5.90060
-
+
my $got;
do {
$got = read $body, my ($buffer), $CHUNKSIZE;
} else {
# Looks like for backcompat reasons we need to be able to deal
# with stringyfiable objects.
- $body = ["$body"];
+ $body = ["$body"];
}
} elsif(ref $body) {
if( (ref($body) eq 'GLOB') or (ref($body) eq 'ARRAY')) {
## for backcompat we still need to handle a ->body. I guess I could see
## someone calling ->write to presend some stuff, and then doing the rest
## via ->body, like in a template.
-
+
## We'll just use the old, existing code for this (or most of it)
if(my $body = $res->body) {
close $body;
}
else {
-
+
# Case where body was set after calling ->write. We'd prefer not to
# support this, but I can see some use cases with the way most of the
# views work. Since body has already been encoded, we need to do
-path => $val->{path},
-secure => $val->{secure} || 0,
-httponly => $val->{httponly} || 0,
+ -samesite => $val->{samesite},
)
);
if (!defined $cookie) {
$c->res->content_type('text/html; charset=utf-8');
my $name = ref($c)->config->{name} || join(' ', split('::', ref $c));
-
+
# Prevent Catalyst::Plugin::Unicode::Encoding from running.
# This is a little nasty, but it's the best way to be clean whether or
# not the user has an encoding plugin.
? $env->{QUERY_STRING}
: '';
- # Check for keywords (no = signs)
- # (yes, index() is faster than a regex :))
- if ( index( $query_string, '=' ) < 0 ) {
- my $keywords = $self->unescape_uri($query_string);
- $keywords = $decoder->($keywords);
- $c->request->query_keywords($keywords);
- return;
- }
-
$query_string =~ s/\A[&;]+//;
- my $p = Hash::MultiValue->new(
- map { defined $_ ? $decoder->($self->unescape_uri($_)) : $_ }
- map { ( split /=/, $_, 2 )[0,1] } # slice forces two elements
- split /[&;]+/, $query_string
- );
+ my @unsplit_pairs = split /[&;]+/, $query_string;
+ my $p = Hash::MultiValue->new();
+
+ my $is_first_pair = 1;
+ for my $pair (@unsplit_pairs) {
+ my ($name, $value)
+ = map { defined $_ ? $decoder->($self->unescape_uri($_)) : $_ }
+ ( split /=/, $pair, 2 )[0,1]; # slice forces two elements
+
+ if ($is_first_pair) {
+ # If the first pair has no equal sign, then it means the isindex
+ # flag is set.
+ $c->request->query_keywords($name) unless defined $value;
+
+ $is_first_pair = 0;
+ }
+
+ $p->add( $name => $value );
+ }
+
$c->encoding($old_encoding) if $old_encoding;
$c->request->query_parameters( $c->request->_use_hash_multivalue ? $p : $p->mixed );