来自Apache的CGI,管道破损 [英] CGI from Apache, broken pipe

查看:158
本文介绍了来自Apache的CGI,管道破损的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当客户端(我的意思是浏览器或TCP网关)在中间断开连接时,运行CGI脚本的Apache(或Nginx)会发生什么?

What does happen with Apache (or Nginx) running a CGI script when the client (I mean a browser or a TCP gateway) disconnects in the middle?

  1. Apache/Nginx是否记录错误? (如果是,是哪一个?在哪里?)

  1. Does Apache/Nginx log an error? (If yes, which one and where?)

CGI脚本是否已将SIGPIPE发送给?

Is the CGI script sent SIGPIPE to?

推荐答案

Apache CGI脚本中断时,没有SIGPIPE.

There is no SIGPIPE when Apache CGI script is interrupted.

使用以下代码进行了测试:

Tested with the following code:

#!/usr/bin/perl

use strict;
use warnings;

$| = 1;

#$SIG{PIPE} = "IGNORE";
$SIG{PIPE} = sub {
  open my $f, '>', 'log.txt';
  print $f "PIPE: $ENV{SERVER_NAME}\n";
  close $f;
};

print "Content-Type: text/plain\n\n";

sleep 10;

print "OK";

这篇关于来自Apache的CGI,管道破损的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆