Project

General

Profile

Bug #1412

mod_fastcgi or lighttpd mangling 307 replies

Added by Anonymous over 8 years ago. Updated over 8 years ago.

Status:
Fixed
Priority:
High
Assignee:
-
Category:
core
Target version:
Start date:
Due date:
% Done:

0%

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 View - attached patch for direct linking -- rkitover (344 Bytes) Anonymous, 2007-11-28 07:30

Associated revisions

Revision f570913e (diff)
Added by stbuehler over 8 years ago

Fix #1412: do not suppress content for "307 Temporary Redirect"

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2097 152afb58-edef-0310-8abb-c4023f1b3aa9

Revision d1bb9110 (diff)
Added by stbuehler over 8 years ago

Fix Content-Length header if response body gets removed in connections.c (#1412, part 2)

- do not touch if it is a HEAD request (but set file_finished)
- body gets removed for req method OPTION and some status codes

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2098 152afb58-edef-0310-8abb-c4023f1b3aa9

History

#1 Updated by darix over 8 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 over 8 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 8 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