From: Justin (
Date: Thu Jul 01 2004 - 20:08:35 CEST

----- Original Message -----
From: "Corin Langosch" <>
To: <>
Sent: Thursday, July 01, 2004 11:44 AM
Subject: important pen bug

Hello Ulric,

first thaks for your great program!

i think i found a but with rewrite_request. looking at our logfiles
i found that a lot of request dont get the "http_x_forwarded_for"
header set. looking at the pen.c code, i think i found the bug.

when a request comes in from a slow connections the read() in
copy_up() might not get the full header. so the following
rewrite_request() doenst detect the header, because of the still
missing termination (\n\n or \r\n\r\n). when copy_up() is called
again for the connection, rewrite_request() cant parse the header
because the methode (GET/POST etc..) and other stuff was already
read from the previous copy_up(). can you confirm this, or did i
misunderstand your code?

my suggestion would be to wait for the full header to be
available, parse the header and then forward the whole
stuff. if the full header isn't avaiable within some timeout,
the connections could/should be closed, the request hadn't
been parsed by the webserver anyway. as the link between
pen and the webserver normally is really fast, there shouldn't
be any performance hit, i think.


Netskin            Web-Programmierung
         Ihr Partner für die Entwicklung von Individualsoftware
                  ...PHP3/4, Perl, VC++ 6, Delphi 5...
                Moltkestr. 34           D-79098 Freiburg
                  Möchten Sie mehr über uns erfahren ?
     Mobil: 0179-6634692, Telefon: 0761-3196306, Fax: 0761-3196306     ·     ·

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

This archive was generated by hypermail 2.1.2 : Thu Jul 01 2004 - 20:21:58 CEST