Project

General

Profile

Actions

Bug #1648

closed

Lighty 1.5 drops headers for keep-alive sent from PHP

Added by Psih about 16 years ago. Updated over 15 years ago.

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

Description

I have a script witch shoudn't use keep alive (and other site parts should). As Lighttpd doesn't support conditional keep-alive (Also tested and confirmed by hoffie) I used PHP like this: Header('Connection: close');
That is what i get in reality (I used Firefox extension Live HTTP Headers):


GET /announce.php HTTP/1.1
Host: file.lv
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: uid=280883; __utma=263829531.1162435829.1201506950.1208258425.1208377469.46; pass=2f9bf6d23d01cac56dddd0ce68ad4d9d; __utmz=263829531.1201506950.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)

HTTP/1.x 200 OK
Content-Type: text/plain;charset=windows-1251
Pragma: no-cache
Content-Length: 45
Date: Sat, 19 Apr 2008 07:06:33 GMT

Files

Actions #1

Updated by darix about 16 years ago

how about:


$HTTP["url"] =~ "^/announce\.php" {
  server.max-keep-alive-requests = 0
}

that should solve the problem for you.

Actions #2

Updated by Psih about 16 years ago

It doesn't. Here is my config
Lighttpd config

I tried both ways - inside $HTTPhost == "file.lv" (commented one) and outside the block - it still send's back no Connection header


GET /announce.php HTTP/1.1
Host: file.lv
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: uid=280883; __utma=263829531.1162435829.1201506950.1208377469.1208596902.47; pass=2f9bf6d23d01cac56dddd0ce68ad4d9d; __utmz=263829531.1201506950.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); qwasz=1208596709; gadget_play=1208596709; PHPSESSID=bbf7bd5b96a7d4a1bf3b43730afd78a3; __utmb=263829531.5.10.1208596902484; __utmc=263829531
Cache-Control: max-age=0

HTTP/1.x 200 OK
Content-Type: text/plain;charset=windows-1251
Pragma: no-cache
Content-Length: 45
Date: Sat, 19 Apr 2008 09:24:49 GMT
Actions #3

Updated by Psih about 16 years ago

Maybe we can discuss it on IRC right now - i'm online at this moment. This one was tested with someone of the developers (i don't remember who it was, i think hoffee - he confirmed conditionals are not working for keep-alive)

Actions #4

Updated by stbuehler about 16 years ago

The Connection: header gets dropped by mod_proxy_core (it is used for the backend connection, so if a backend sends "Connection: close" the backend connections gets closed).

Perhaps we should change that behaviour for specific backens like fastcgi, or should add another header to give the backend control over the connection header, or add a config option, ...

The server.max-keep-alive-requests is broken in conditionals (it only works in some of them), see attached patch.

Actions #5

Updated by stbuehler over 15 years ago

  • Status changed from New to Fixed
  • Resolution set to fixed

Fixed in r2233

Actions

Also available in: Atom