On Sun, 12 Apr 2015, Jan Henning Thorsen wrote:

> Are you building a proxy..? Maybe you want to have a look at either of 
> these:
> 
> https://metacpan.org/pod/Mojolicious::Plugin::Proxy

It looks to me that will proxy only get requests. It would be interesting 
to see that extended for post, etc.

> https://github.com/mojoconf/MCT/blob/master/lib/MCT/Plugin/ACT.pm

I can't quite tell what that does, and the pod isn't helpful :-)

> 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 
> > > > 
> > > 
> > > 
> >
> 

Reply via email to