Project

General

Profile

Bug #771

closed

lighty glues headers with equal names!

Added by Anonymous about 14 years ago. Updated about 14 years ago.

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

Description

PHP code (test.php):


<?
  header('a: 1', false);
  header('a: 2', false); // false means "do not overwrite header with the same name (if exists)" 
?>

Let's check the result headers:


wget --spider -S http://localhost/test.php

Compiled lighty from svn, revision 1127:


  HTTP/1.0 200 OK
  Connection: keep-alive
  aa: 1
  aa: 2
  Content-type: text/html
  Content-Length: 0
  Date: Fri, 28 Jul 2006 09:05:03 GMT
  Server: lighttpd/1.4.12

Compiled newest lighty from svn, revision 1229:


  HTTP/1.0 200 OK
  Connection: keep-alive
  aa: 1, 2
  Content-type: text/html
  Content-Length: 0
  Date: Fri, 28 Jul 2006 09:05:03 GMT
  Server: lighttpd/1.4.12

The real problem is with cookies. When php sends more than one cookie, lighty glues all of them into one string:


Set-Cookie: a=1; expires=Fri, 28-Jul-2006 10:05:03 GMT, b=2; expires=Fri, 28-Jul-2006 10:05:03 GMT

This behaviour block normal working of most PHP applications, because browsers actually do not accept cookies, received this way.

#1

Updated by chernousov about 14 years ago

Well, I fixed it:


# svn diff src/http_resp_parser.y
Index: src/http_resp_parser.y
===================================================================
--- src/http_resp_parser.y      (revision 1229)
+++ src/http_resp_parser.y      (working copy)
@@ -118,7 +118,7 @@
     array_insert_unique(HDRS, (data_unset *)HDR);
 }
 header(HDR) ::= STRING(A) COLON STRING(B) CRLF. {
-    HDR = data_string_init();
+    HDR = data_response_init();

     buffer_copy_string_buffer(HDR->key, A);
     buffer_copy_string_buffer(HDR->value, B);

(btw, I created this titket, not anonymous ;))

#2

Updated by jan about 14 years ago

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

fixed in r1250

Also available in: Atom