Discussion:
user agent & capture groups
(too old to reply)
rasta
2018-08-22 12:05:41 UTC
Permalink
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
--
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.
sri
2018-08-22 13:56:11 UTC
Permalink
If you can make a script replicating the problem please open an issue on
GitHub and report it as a bug.

--
sebastian
--
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.
Rastislav Hudak
2018-08-23 08:26:27 UTC
Permalink
Ok, thanks sebastian, here it is: https://github.com/kraih/mojo/issues/1253
Post by sri
If you can make a script replicating the problem please open an issue on
GitHub and report it as a bug.
--
sebastian
--
You received this message because you are subscribed to a topic in the
Google Groups "Mojolicious" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/mojolicious/SsqdpiTy_3w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
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.
Rastislav Hudak
2018-08-23 08:27:47 UTC
Permalink
Oh wait, I did a mistake
Post by Rastislav Hudak
https://github.com/kraih/mojo/issues/1253
Post by sri
If you can make a script replicating the problem please open an issue on
GitHub and report it as a bug.
--
sebastian
--
You received this message because you are subscribed to a topic in the
Google Groups "Mojolicious" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/mojolicious/SsqdpiTy_3w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
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.
Rastislav Hudak
2018-08-23 08:30:46 UTC
Permalink
Ok, I've fixed the example ;)
Post by Rastislav Hudak
Oh wait, I did a mistake
On Thu, Aug 23, 2018 at 10:26 AM Rastislav Hudak <
Post by Rastislav Hudak
https://github.com/kraih/mojo/issues/1253
Post by sri
If you can make a script replicating the problem please open an issue on
GitHub and report it as a bug.
--
sebastian
--
You received this message because you are subscribed to a topic in the
Google Groups "Mojolicious" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/mojolicious/SsqdpiTy_3w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
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.
Continue reading on narkive:
Loading...