Hello, If soemone has some hints to help me to solve the problem described below, it woule be very apreciated ;)
Alex On Mon, Jul 30, 2018 at 09:16:02AM -0700, [email protected] wrote: > Hello, > On a "back-end" server, I have an application responsible to manage > large files (some Gigabytes). > On a "front-end" server, I want to allow the end-users to download > files stored on the back-end, but without making the back-end server > directly accessible from all Internet. > On the front-end server. > On the front-end, I tried the following piece of code : > use Mojolicious::Lite; > use Mojo::UserAgent; > get '/dl' => sub { > my $c = shift; > my $ua = Mojo::UserAgent->new; > my $tx = $ua->build_tx(GET => 'https://BACKEND/my_file.zip'); > $tx->res->content->unsubscribe('read')->on(read => sub { > my ($content, $bytes) = @_; > $c->write($bytes); > }); > $tx = $ua->start($tx); > }; > app->start; > The problem is that the whole file seems to be downloaded and stored in > memory, before being sent. I would like to be able to write a chunk of > data just after receiving it from the back-end server, without waiting > the end of the whole file download. I thought that redefining the > "read" event would do the job but something is probably missing. Does > anyone have any suggestions? > Alex > > -- > 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 [1][email protected]. > To post to this group, send email to [2][email protected]. > Visit this group at [3]https://groups.google.com/group/mojolicious. > For more options, visit [4]https://groups.google.com/d/optout. > > Références > > 1. mailto:[email protected] > 2. mailto:[email protected] > 3. https://groups.google.com/group/mojolicious > 4. 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
