Bug #1412

mod_fastcgi or lighttpd mangling 307 replies

Added by Anonymous about 7 years ago. Updated over 6 years ago.

Status:FixedStart date:
Priority:HighDue date:
Assignee:-% Done:

0%

Category:core
Target version:1.4.19
Missing in 1.5.x:

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&lt;html&gt;\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.

-- cjs

lighttpd-307.diff Magnifier - attached patch for direct linking -- rkitover (344 Bytes) Anonymous, 2007-11-28 07:30

History

#1 Updated by darix about 7 years ago

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 */
]]]

#2 Updated by darix about 7 years ago

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 */

#3 Updated by stbuehler over 6 years ago

  • Status changed from New to Fixed
  • Resolution set to fixed
Two bugs:
  1. Removes body without reason r2097
  2. Sends wrong content-length r2098

Also available in: Atom