php / php/php-src

php-fpm fail to process uris above 32kb in length

未关闭
#12,982 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Bug SAPI: fpm Status: Needs Triage
主要语言
C
星标
40.4k
派生
8.1k
平均合并
2 天 13 小时
30 天内合并 PR
96

描述

Description

Assuming php-fpm and nginx configured to allow large URLs ( http{ large_client_header_buffers 8 999k; ...} )
The following code:

<?php
$url = "http://localhost/?a=" . str_repeat("a", 33*1024);
$ch = curl_init($url);
curl_exec($ch);

Resulted in

<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.22.1</center>
</body>
</html>

and /var/log/nginx/error.log containing

2023/12/20 06:15:30 [error] 7980#7980: *32033 writev() failed (32: Broken pipe) while sending request to upstream, client: 162.248.164.115, server: localhost, request: "GET /?a=aaaaaaaaaa(...)

and nothing in /var/log/php8.2-fpm.log

But I expected... a notice in the php-fpm log that something went wrong? and maybe a HTTP 414 Request-URL too long error instead of a 502 Bad Gateway ?

PHP Version

PHP 8.2.7

Operating System

Debian 12

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,使用 PHP 8.2.7、php-fpm 以及所述的 nginx 缓冲区配置重现 33 KB 的 URI。跟踪 php-fpm 和 nginx 如何处理超大请求,并检查报告的 nginx 和 php-fpm 日志;完成的标准是错误得到处理并通过适当的响应进行报告,而不是出现无法解释的 502。

由索引模型根据 Issue 内容生成。

评估

技术栈
nginx, php
领域
backend
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。