Skip Menu |

This queue is for tickets about the FCGI CPAN distribution.

Report information
The Basics
Id: 24347
Status: resolved
Priority: 0/
Queue: FCGI

People
Owner: Nobody in particular
Requestors: DDICK [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.67
Fixed in: (no value)



Subject: Patch to return correct values when printing output
Without this patch, the following code in a CGI script will fail unless(print("HTMLDATA")) { die("Failed to write:$!"); }
Subject: fcgi_print.patch
diff -Naur old/FCGI.XL new/FCGI.XL --- old/FCGI.XL 2002-11-12 00:51:20.000000000 +1100 +++ new/FCGI.XL 2007-01-13 09:26:09.000000000 +1100 @@ -529,22 +529,34 @@ #ifndef USE_SFIO -void +int PRINT(stream, ...) FCGI::Stream stream; PREINIT: int n; + int retval; + int bytes_written; CODE: - for (n = 1; n < items; ++n) { + retval = 0; + bytes_written = 0; + for (n = 1; n < items && bytes_written >= 0; ++n) { STRLEN len; register char *tmps = (char *)SvPV(ST(n),len); - FCGX_PutStr(tmps, len, stream); + bytes_written = FCGX_PutStr(tmps, len, stream); + if (bytes_written > 0) { + retval += bytes_written; + } } if (SvTRUEx(perl_get_sv("|", FALSE))) FCGX_FFlush(stream); + RETVAL = retval; + + OUTPUT: + RETVAL + int WRITE(stream, bufsv, len, ...) FCGI::Stream stream;
An alternate and more correct patch to this issue is present in the latest release.