Ticket #1412 (closed defect: fixed)

Opened 9 months ago

Last modified 5 months ago

mod_fastcgi or lighttpd mangling 307 replies

Reported by: cjs@starling-software.com Assigned to: jan
Priority: high Milestone: 1.4.19
Component: core Version: 1.4.18
Severity: critical Keywords: patch
Cc: Blocking:
Need Feedback: 0

Description

If I send the following to lighttpd as a FastCGI response:

{{{"Status: 302\r\nContent-Type: text/html; charset=Shift_JIS\r\nContent-Length: 104\r\nContent-Language: ja\r\nExpires: Mon, 15 Oct 2007 10:42:32 GMT\r\nlocation: http://localhost:8080/ja/page/gallery/image/5/image.jpg/240\r\n\r\n<html>\n <head><title>Redirect</title></head>\n <body>Click <a href=\"....\">here</a>.</body>\n</html>\n"}}}

lightpd generates pretty much what one would expect as a response:

HTTP/1.1 302 Found
Content-Type: text/html; charset=Shift_JIS
Content-Length: 104
Content-Language: ja
Expires: Mon, 15 Oct 2007 11:06:41 GMT
location: http://localhost:8080/ja/page/gallery/image/5/image.jpg/240
Date: Mon, 15 Oct 2007 11:06:41 GMT
Server: lighttpd/1.4.18

<html>    <head><title>Redirect</title></head>    <body>Click <a
href="....">here</a>.</body></html>

If instead I send back this:

{{{"Status: 307\r\nContent-Type: text/html; charset=UTF-8\r\nContent-Length: 104\r\nExpires: Mon, 15 Oct 2007 10:42:08 GMT\r\nlocation: http://localhost:8080/ja/page/gallery/image/5/image.jpg/240\r\n\r\n<html>\n <head><title>Redirect</title></head>\n <body>Click <a href=\"....\">here</a>.</body>\n</html>\n"}}}

lighttpd or mod_fastcgi (I don't know which) strips off the body, but leaves the content length the same:

HTTP/1.1 307 Temporary Redirect
Content-Type: text/html; charset=UTF-8
Content-Length: 104
Expires: Mon, 15 Oct 2007 11:07:23 GMT
location: http://localhost:8080/ja/page/gallery/image/5/image.jpg/240
Date: Mon, 15 Oct 2007 11:07:23 GMT
Server: lighttpd/1.4.18

This is illegal, and also annoying, as it stalls the keep-alive connection, pausing the browser for five seconds or more every time it happens.

Attachments

lighttpd-307.diff (344 bytes) - added by rkitover on 11/28/2007 07:30:56 AM.
attached patch for direct linking

Change History

10/18/2007 03:38:58 AM changed by darix

try that patch please: [[[ Index: src/connections.c =================================================================== --- src/connections.c (revision 2000) +++ src/connections.c (working copy) @@ -501,6 +501,7 @@

case 301: case 302: case 303:

+ case 307:

break;

case 206: /* write_queue is already prepared */

]]]

10/18/2007 03:40:10 AM changed by darix

wrong brackets. try that patch:

Index: src/connections.c
===================================================================
--- src/connections.c   (revision 2000)
+++ src/connections.c   (working copy)
@@ -501,6 +501,7 @@
        case 301:
        case 302:
        case 303:
+       case 307:
                break;

        case 206: /* write_queue is already prepared */

11/28/2007 07:30:56 AM changed by rkitover

  • attachment lighttpd-307.diff added.

attached patch for direct linking

02/17/2008 08:59:07 PM changed by stbuehler

  • keywords set to patch.

02/27/2008 12:59:10 PM changed by stbuehler

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

Two bugs:

  1. Removes body without reason [2097]
  2. Sends wrong content-length [2098]

Add/Change #1412 (mod_fastcgi or lighttpd mangling 307 replies)




Change Properties
Action