Project

General

Profile

Actions

Bug #3030

closed

Fastcgi fails if server.tag is empty

Added by flynn over 3 years ago. Updated over 3 years ago.

Status:
Fixed
Priority:
Normal
Category:
mod_fastcgi
Target version:
ASK QUESTIONS IN Forums:
No

Description

Updating to the upcoming version 1.4.56 all my php-Script fail with a return code 400.

Reducing my setup I found, that this configuration line is the problem:

server.tag = "" 

Using strace I can see the following, that fastcgi socket is opened, but nothing is written to:

stat("/var/www/phpinfo.php", {st_mode=S_IFREG|0644, st_size=24, ...}) = 0
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 16
connect(16, {sa_family=AF_UNIX, sun_path="/var/run/php/php7.4-fpm.sock"}, 31) = 0
getsockname(15, {sa_family=AF_INET, sin_port=htons(8888), sin_addr=inet_addr("192.168.33.3")}, [112->16]) = 0
writev(15, [{iov_base="HTTP/1.1 400 Bad Request\r\nContent-Type: text/html\r\nContent-Length: 345\r\nDate: Mon, 09 Nov 2020 12:54:24 GMT\r\n\r\n", iov_len=111}, {iov_base="<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n         \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n <head>\n  <title>400 Bad Request</title>\n </head>\n <body>\n  <h1>400 Bad Request</h1>\n </body>\n</html>\n", iov_len=345}], 2) = 456

This setup (empty server.tag) worked until version 1.4.55.
Version 1.4.56 works only with any none empty server.tag.


Files

3030-uwsgi.patch (342 Bytes) 3030-uwsgi.patch flynn, 2020-11-10 06:32
Actions #1

Updated by gstrauss over 3 years ago

  • Status changed from New to Patch Pending

Thanks for tracking that down.

I've modified the code to accept a 0-length value with NULL ptr when creating the CGI gateway environment. Prior versions (<= 1.4.55) got "" with 0-length and did not have to handle the NULL ptr case.

Actions #2

Updated by gstrauss over 3 years ago

  • Status changed from Patch Pending to Fixed
Actions #3

Updated by flynn over 3 years ago

Thank for your quick response and fix.

Tested and works for fastcgi/php, but uwsgi is missing, see my attached patch.

Actions #4

Updated by gstrauss over 3 years ago

I didn't fix the one place you needed it! Sorry.
I applied a reverse patch from yours.

Actions

Also available in: Atom