Are you building a proxy..? Maybe you want to have a look at either of 
these:

https://metacpan.org/pod/Mojolicious::Plugin::Proxy
https://github.com/mojoconf/MCT/blob/master/lib/MCT/Plugin/ACT.pm

On Saturday, April 11, 2015 at 11:06:03 PM UTC+2, Charlie Brady wrote:
>
>
> On Sat, 11 Apr 2015, Dan Book wrote: 
>
> > Perhaps this way: 
> > my $tx = $ua->build_tx($method => ... normal get/post/etc args ...); 
> > $ua->start($tx => sub { 
> >   ... 
> > }); 
>
> Thanks. I'll try that. 
>
> Next problem is what needs to be done to read the request body and 
> transfer it to the ua. Would that happen automatigically if the req is 
> cloned? In this case, would Mojo buffer the request? Does anyone have a 
> gist which proxies a request without reading and caching the request body? 
>
> I've found this which deals with some of these issues: 
>
> https://larig.wordpress.com/2012/08/01/a-mini-proxy-via-mojolicious/ 
>
> Thanks all. 
>
> > 
> > On Fri, Apr 10, 2015 at 4:01 PM, Charlie Brady < 
> > [email protected]> wrote: 
> > 
> > > 
> > > https://github.com/kraih/mojo/wiki/Blocking-vs-non-blocking-101 
> > > 
> > > I see I can do this to have a non-blocking get handler: 
> > > 
> > > ... 
> > >   $self->render_later; 
> > > 
> > >   $self->ua->get('http://www.superhugepage.com/blah.html' => sub {}); 
> > > ... 
> > > 
> > > But I don't understand how to use Mojo::UserAgent in an 'any' handler, 
> > > where method might be 'get', 'put', 'delete', etc. Do I build a tx, 
> attach 
> > > the callback to 'finish', then start it? Or just do: 
> > > 
> > > $method = $self->req->method; 
> > > $self->ua->$method() 
> > > 
> > > ? 
> > > 
> > > Thanks 
> > > 
> > 
> > 
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to