Ticket #1656 (closed defect: invalid)

Opened 2 weeks ago

Last modified 2 weeks ago

mod_proxy_backend_fastcgi strange behaver in lighttpd.git/stbuehler

Reported by: tx Assigned to: jan
Priority: normal Milestone: 1.5.0
Component: mod_proxy_backend_fastcgi Version: 1.5.x-svn
Severity: normal Keywords: mod_proxy_backend_fastcgi git
Cc: Blocking:
Need Feedback: 0

Description

While debugging #1655 i've found some inconsistency in how mod_proxy_backend_fastcgi (lighttpd.git branch stbuehler) setting response headers. Content-Length was not set every time.

first run

for i in `seq 1 4`; do wget -S -O /dev/null http://192.168.0.91/php5-fastcgi.php 2>&1 | egrep "^\ \ HTTP|^\ \ Content\-Length"; done
  HTTP/1.0 200 OK
  HTTP/1.0 200 OK
  HTTP/1.0 200 OK
  HTTP/1.0 200 OK

after several additional runs

for i in `seq 1 4`; do wget -S -O /dev/null http://192.168.0.91/php5-fastcgi.php 2>&1 | egrep "^\ \ HTTP|^\ \ Content\-Length"; done
  HTTP/1.0 200 OK
  Content-Length: 4
  HTTP/1.0 200 OK
  Content-Length: 4
  HTTP/1.0 200 OK
  Content-Length: 4
  HTTP/1.0 200 OK
  Content-Length: 4

after another several runs

for i in `seq 1 4`; do wget -S -O /dev/null http://192.168.0.91/php5-fastcgi.php 2>&1 | egrep "^\ \ HTTP|^\ \ Content\-Length"; done
  HTTP/1.0 200 OK
  Content-Length: 4
  HTTP/1.0 200 OK
  Content-Length: 4
  HTTP/1.0 200 OK
  HTTP/1.0 200 OK

lighttpd configuration

var.PID              = 24464
var.CWD              = "/root"
server.modules       = (
    "mod_indexfile",
    "mod_rewrite",
    "mod_access",
    "mod_uploadprogress",
    "mod_auth",
    "mod_setenv",
    "mod_accesslog",
    "mod_proxy_core",
    "mod_proxy_backend_fastcgi",
    "mod_cgi",
    "mod_dirlisting",
    "mod_staticfile",
    "mod_chunked",
    # 13
)
server.document-root = "/var/www/"
server.errorlog      = "/var/log/lighttpd/error.log"
server.indexfiles    = ("index.php", "index.html", "index.htm", "default.htm")
accesslog.filename   = "/var/log/lighttpd/access.log"
url.access-deny      = ("~", ".inc")
server.pid-file      = "/var/run/lighttpd.pid"
server.dir-listing   = "disable"
server.username      = "www-data"
server.groupname     = "www-data"


$PHYSICAL["existing-path"] =~ "\.php$" {
    # block 1
    proxy-core.balancer         = "round-robin"
    proxy-core.protocol         = "fastcgi"
    proxy-core.allow-x-sendfile = "enable"
    proxy-core.backends         = ("unix:/tmp/php-fastcgi.sock")
    proxy-core.max-pool-size    = 16

} # end of $PHYSICAL["existing-path"] =~ "\.php$"

$HTTP["url"] == "/php5-cgi.php" {
    # block 2
    proxy-core.backends = ()
    cgi.assign          = (
        ".php" => "/usr/bin/php5-cgi",
    )

} # end of $HTTP["url"] == "/php5-cgi.php"

source of php5-fastcgi.php

<?
        print('asdf');
?>

compiled with gcc version 4.2.3 (Debian 4.2.3-1)

Attachments

Change History

05/03/2008 08:34:54 PM changed by stbuehler

  • status changed from new to closed.
  • resolution set to invalid.

There are some different ways how content is provided by a server:

  1. no content-length, close connection after response
  2. no content-length but chunked-encoding instead. may use keep-alive (requires http/1.1)
  3. content-length, may use keep-alive

Now, lighty tries to use the third method, but it needs the complete content as soon as it starts sending the content; so if php (your fastcgi backend) doesn't close the content stream fast enough after sending the content, lighty doesn't know if there may be more content and cannot know the content-length.

Thanks for testing my branch! (There are some heavy changes in it regarding the chunks api, so you should be careful with it ;-) )


Add/Change #1656 (mod_proxy_backend_fastcgi strange behaver in lighttpd.git/stbuehler)




Change Properties
Action