rasta
2018-08-22 12:05:41 UTC
Hi Guys!
Using Mojolicious 7.93 I face a rather mysterious issue:
In my app I call
my $upload = $c->req->upload('file');
my $ua = Mojo::UserAgent->new;
my $post = $ua->post($url => \%headers => form => { file => { file =>
$upload->asset }} );
where $upload->asset is a Mojo::Asset::Memory in my case.
So far so good, Mojolicious makes the post and sends headers a la
Mojolicious (Perl)
multipart/mixed; boundary=S3ylX
Accept-Encoding: gzip
1201
(captured through tcpdump)
At some point, I added a check on some data before posting, using a match
if( $data =~ m/(\w+)\/(\w+)/)...
Suddenly, what came out of Mojolicious was
Mojolicious (Perl)
n; boundary=jthCXf
Accept-Encoding: gzip
1201
Not only 'multipart/mixed' is replaced with 'n', the boundary is actually
wrong too.
In the end I found out it happens because of the capture groups in the
match. If I don't use them
if( $data =~ m/\w+\/\w+/)...
all is fine again.
Is it possible that Mojolicious uses $1 etc somewhere inside the UserAgent
to manipulate headers without calling a match first?
Cheers,
Rasta
Using Mojolicious 7.93 I face a rather mysterious issue:
In my app I call
my $upload = $c->req->upload('file');
my $ua = Mojo::UserAgent->new;
my $post = $ua->post($url => \%headers => form => { file => { file =>
$upload->asset }} );
where $upload->asset is a Mojo::Asset::Memory in my case.
So far so good, Mojolicious makes the post and sends headers a la
Mojolicious (Perl)
multipart/mixed; boundary=S3ylX
Accept-Encoding: gzip
1201
(captured through tcpdump)
At some point, I added a check on some data before posting, using a match
if( $data =~ m/(\w+)\/(\w+)/)...
Suddenly, what came out of Mojolicious was
Mojolicious (Perl)
n; boundary=jthCXf
Accept-Encoding: gzip
1201
Not only 'multipart/mixed' is replaced with 'n', the boundary is actually
wrong too.
In the end I found out it happens because of the capture groups in the
match. If I don't use them
if( $data =~ m/\w+\/\w+/)...
all is fine again.
Is it possible that Mojolicious uses $1 etc somewhere inside the UserAgent
to manipulate headers without calling a match first?
Cheers,
Rasta
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.