My sincere apologies. The two scraps are:
$tx->res->content->unsubscribe('read')->on(read => sub {
my($content, $bytes) = @_;
our $globalC;
our $digester;
our $transferLength;
our $contentLength;
if (!$content->headers->header('headersWritten')) {
foreach my $name (@{$content->headers->names}) {
my $value = $content->headers->header($name);
# $globalC should receive
the streamed file
# This is setting the
headers from the S3
# presigned URL.
$globalC->res->headers->header($name => $value);
if ($name =~ /[cC]ontent-[lL]ength/) {
$contentLength = $value;
}
}
$content->headers->header('headersWritten' => 1);
$globalC->write;
}
$digester->add($bytes);
$transferLength += length($bytes);
$globalC->write($bytes);
print "$transferLength bytes written...\n";
});
Which fails after reading 668MB,
and
$c->proxy->get_p($url => $headers)->catch(sub {
my $err = shift;
print "Proxy error is $err\n";
$c->render(text => "Error: $err\n");
});
Which fails after trying three or four times with a Connection refused.
Thanks,
Joe Fridy
On Sunday, May 10, 2020 at 6:53:42 AM UTC-4, Sebastian Riedel wrote:
>
> Please don't use HTML for formatting, the code is completely unreadable.
>
> --
> 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/mojolicious/6d17adda-fd0e-4e82-acc0-81e2f04617f2%40googlegroups.com.