Search code examples
perlfastcgi

How do I get requestId of FCGI process in Perl using Net::FastCGI?


I have an application that calls FCGI responder to process some tasks and I need to find whether the FCGI responder receives and returns same reqeust IDs.

The FCGI responder is written in Perl and uses FCGI module.

According to FastCGI specification, I can find the information by looking up FastCGI records.

I found Net::FastCGI library may be suitable for solving this issue, but I'm not sure how to utilize the library.

If my fcgi script looks like below, how can I use Net::FastCGI to dump contents of FastCGI record?

use FCGI;

my $count = 0;
my $request = FCGI::Request();

while($request->Accept() >= 0) {
    print("Content-type: text/html\r\n\r\n", ++$count);
}

Solution

  • You wouldn't. There's no sense in using Net::FastCGI when you're already using FCGI. The request ID, if you need it, is available in $request->{id} after calling $request->Accept. It's not clear what you mean by "receives and returns same request IDs" though.