Skip Menu |

This queue is for tickets about the CGI-Emulate-PSGI-Streaming CPAN distribution.

Report information
The Basics
Id: 133593
Status: resolved
Priority: 0/
Queue: CGI-Emulate-PSGI-Streaming

People
Owner: Nobody in particular
Requestors: dcook [...] prosentient.com.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.0.1



Subject: Data in response truncated if longer than 32KB
Date: Thu, 22 Oct 2020 16:16:54 +1100
To: <bug-CGI-Emulate-PSGI-Streaming [...] rt.cpan.org>
From: <dcook [...] prosentient.com.au>
I'm working on a PSGI application, and CGI::Emulate::PSGI::Streaming looked like exactly what I needed. However, I notice in CGI::Parse::PSGI::Streaming::Handle that the data is being truncated from 33750 to 32768 characters at this point: https://metacpan.org/source/CGI::Parse::PSGI::Streaming::Handle#L41. The $buf variables contains the 33750 characters (HTTP headers and body), but after 'print {$self->{fh}} substr($buf, $offset, $len);', you can see that $self->{buffer} only contains 32768 characters. This leads to an incomplete response being sent to the browser. This is happening on Debian 9 Stretch (Perl v5.24.1) using CGI-Emulate-PSGI-Streaming-1.0.0. I'm surprised by the 32KB limit, and I actually can't reproduce the problem when I write my own programs from scratch using a similar $self->{fh}/$self->{buffer} setup. Using Devel::Peek, I see that my string in $buf has the UTF8 flag, while $self->{buffer} does not. My $buf had CUR = 33750 and LEN = 33752, whereas $self->{buffer} has a massive discrepancy where CUR = 32768 but LEN is 34576. I'm out of ideas at this point though. I like the idea of CGI::Emulate::PSGI::Streaming, since CGI::Emulate::PSGI isn't practical for many use cases, but I can't use this as it stands, unfortunately. David Cook Software Engineer Prosentient Systems 72/330 Wattle St Ultimo, NSW 2007 Australia Office: 02 9212 0899 Online: 02 8005 0595
apologies for the delay! Thank you for the report, I'll be looking at this next week
I've just uploaded release 1.0.1 which should fix your problem. Please test and report!
On Mon Nov 16 09:19:08 2020, DAKKAR wrote: Show quoted text
> I've just uploaded release 1.0.1 which should fix your problem. Please > test and report!
I can confirm that release 1.0.1 fixes the problem! The HTML response outputs correctly now, and the streaming handler streamed out 65MB of data. Great work!