[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#191930: marked as forwarded (apache-common: mod_proxy breaks on pages with blank Reason-Phrase)



Your message dated Mon, 5 May 2003 11:30:24 +0100
with message-id <20030505103024.GB25559@samizdat.positive-internet.com>
has caused the Debian Bug report #191930,
regarding apache-common: mod_proxy breaks on pages with blank Reason-Phrase
to be marked as having been forwarded to the upstream software
author(s) dev@httpd.apache.org.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

---------------------------------------
Received: (at 191930-forwarded) by bugs.debian.org; 5 May 2003 10:30:30 +0000
>From thom@debian.org Mon May 05 05:30:28 2003
Return-path: <thom@debian.org>
Received: from samizdat.positive-internet.com [213.253.25.2] (postfix)
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 19CdEo-0004Qe-00; Mon, 05 May 2003 05:30:26 -0500
Received: by samizdat.positive-internet.com (Postfix, from userid 1000)
	id 8A9D0898A6; Mon,  5 May 2003 11:30:24 +0100 (BST)
Date: Mon, 5 May 2003 11:30:24 +0100
From: Thom May <thom@debian.org>
To: dev@httpd.apache.org
Cc: 191930-forwarded@bugs.debian.org
Subject: (forw) [martin@snowplow.org: Bug#191930: apache-common: mod_proxy breaks on pages with blank Reason-Phrase]
Message-ID: <20030505103024.GB25559@samizdat.positive-internet.com>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="6TrnltStXW4iwmi0"
Content-Disposition: inline
X-Operating-System: Linux/2.5.66-mm1 (i686)
User-Agent: Mutt/1.5.4i
Delivered-To: 191930-forwarded@bugs.debian.org
X-Spam-Status: No, hits=-18.6 required=4.0
	tests=BAYES_10,HAS_PACKAGE,MAILTO_WITH_SUBJ,PATCH_UNIFIED_DIFF,
	      SIGNATURE_SHORT_SPARSE,USER_AGENT_MUTT
	autolearn=ham version=2.53-bugs.debian.org_2003_04_23
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.53-bugs.debian.org_2003_04_23 (1.174.2.15-2003-03-30-exp)


--6TrnltStXW4iwmi0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline

guys,
just receieved this bug report via the debian bug tracking system; I don't
know the proxy code (or the relevant RFCs for how it's supposed to work) as
well as I'd like, so if anyone would like to comment on the reasoning
and/or the patch, that'd be cool.
Cheers
-Thom

--6TrnltStXW4iwmi0
Content-Type: message/rfc822
Content-Disposition: inline

Return-Path: <bounce-debian-apache=thom=debian.org@lists.debian.org>
Received: from master.debian.org (mail@master.debian.org [146.82.138.7])
	by www2.orbitsolutions.co.uk (8.9.3/8.9.3) with ESMTP id DAA24358
	for <thom@planetarytramp.net>; Mon, 5 May 2003 03:04:21 +0100
Received: from murphy.debian.org [146.82.138.6] 
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 19CVL9-0004Jw-00; Sun, 04 May 2003 21:04:27 -0500
Received: from localhost (localhost [127.0.0.1])
	by murphy.debian.org (Postfix) with QMQP
	id 4993C1FBD9; Sun,  4 May 2003 21:04:15 -0500 (CDT)
Old-Return-Path: <debbugs@master.debian.org>
Received: from master.debian.org (unknown [146.82.138.7])
	by murphy.debian.org (Postfix) with ESMTP
	id 260F21FBDA; Sun,  4 May 2003 21:03:47 -0500 (CDT)
Received: from debbugs by master.debian.org with local (Exim 3.12 1 (Debian))
	id 19CV5H-00030M-00; Sun, 04 May 2003 20:48:03 -0500
X-Loop: owner@bugs.debian.org
Subject: Bug#191930: apache-common: mod_proxy breaks on pages with blank Reason-Phrase
Reply-To: "Daniel Martin" <martin@snowplow.org>, 191930@bugs.debian.org
Resent-From: "Daniel Martin" <martin@snowplow.org>
Original-Sender: Daniel Martin <martin@snowplow.org>
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: Debian Apache Maintainers <debian-apache@lists.debian.org>,
        apache@packages.qa.debian.org
Resent-Date: Mon, 05 May 2003 01:48:02 GMT
Resent-Message-ID: <handler.191930.B.105209868122848@bugs.debian.org>
X-Debian-PR-Message: report 191930
X-Debian-PR-Package: apache-common
X-Debian-PR-Keywords: patch upstream
Received: via spool by submit@bugs.debian.org id=B.105209868122848
          (code B ref -1); Mon, 05 May 2003 01:48:02 GMT
Received: (at submit) by bugs.debian.org; 5 May 2003 01:38:01 +0000
Received: from turkey.mail.pas.earthlink.net [207.217.120.126] 
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 19CUvX-0005mm-00; Sun, 04 May 2003 20:37:59 -0500
Received: from user-2inik4f.dialup.mindspring.com ([165.121.80.143] helo=cush.martinhouse.internal)
	by turkey.mail.pas.earthlink.net with esmtp (Exim 3.33 #1)
	id 19CUvM-0003E3-00; Sun, 04 May 2003 18:37:49 -0700
Received: from martind by cush.martinhouse.internal with local (Exim 3.36 #1 (Debian))
	id 19CUL2-0005HJ-00; Sun, 04 May 2003 21:00:16 -0400
From: "Daniel Martin" <martin@snowplow.org>
To: "Debian Bug Tracking System" <submit@bugs.debian.org>
X-Mailer: reportbug 1.99.47
Date: Sun, 04 May 2003 21:00:16 -0400
Message-Id: <[🔎] E19CUL2-0005HJ-00@cush.martinhouse.internal>
Sender: Daniel Martin <martin@snowplow.org>
Delivered-To: submit@bugs.debian.org
X-Spam-Status: No, hits=-11.2 required=4.0
	tests=BAYES_01,DEBIAN_BTS_BUG,PATCH_UNIFIED_DIFF,X_LOOP
	autolearn=ham version=2.53-lists.debian.org_2003_04_28
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.53-lists.debian.org_2003_04_28 (1.174.2.15-2003-03-30-exp)
X-Mailing-List: <debian-apache@lists.debian.org> archive/latest/744
X-Loop: debian-apache@lists.debian.org
List-Post: <mailto:debian-apache@lists.debian.org>
List-Help: <mailto:debian-apache-request@lists.debian.org?subject=help>
List-Subscribe: <mailto:debian-apache-request@lists.debian.org?subject=subscribe>
List-Unsubscribe: <mailto:debian-apache-request@lists.debian.org?subject=unsubscribe>
Precedence: list
Resent-Sender: debian-apache-request@lists.debian.org

Package: apache-common
Version: 1.3.26-1.1
Severity: normal
Tags: upstream patch

On pages with status lines that have an empty Reason-Phrase (that is,
pages whose status line is simply "HTTP/1.1 200 " or similar),
mod_proxy will insert an extra blank line between the HTTP status line
and the headers.

For example, here is the view of a simple cgi script through a broken
proxy - I pipe the output through cat -vte to show what's going on.

First, using no proxy:

cush:/$ nc cush 80 | cat -vte
GET /cgi-bin/nph-t HTTP/1.1
Host: cush

HTTP/1.1 200 $
Date: Sun May 4 20:27:46 EDT 2003$
Server: Apache/1.3.26 (Unix) Debian GNU/Linux mod_perl/1.26 mod_jk/1.1.0$
Connection: close$
Content-type: text/html$
$
<html><head><title>mytitle</title></head><body><p>Test.</p></body></html>$

Now, using a broken proxy:

cush:/$ nc cush 80 | cat -vte
GET http://localhost/cgi-bin/nph-t HTTP/1.1
Host: localhost

HTTP/1.1 200 $
^M$
Date: Mon, 05 May 2003 00:33:12 GMT^M$
Server: Apache/1.3.26 (Unix) Debian GNU/Linux mod_perl/1.26 mod_jk/1.1.0^M$
Content-type: text/html; charset=iso-8859-1^M$
X-Cache: MISS from www.martinhouse.internal^M$
Transfer-Encoding: chunked^M$
^M$
4a ^M$
<html><head><title>mytitle</title></head><body><p>Test.</p></body></html>$
^M$
0^M$
^M$

The end result of this is that browsers looking through a mod_proxy
proxy end up seeing the html source and headers instead of the
properly rendered HTML.  It gets worse when the response is supposed
to be a redirection of some kind.  (For example, visit
http://www.crosswire.org/sword/ in a browser while looking through a
mod_proxy cache)

This problem comes from a bug in proxy_util.c, in the function
ap_proxy_read_response_line - the problem is that ap_getline leaves
the buffer looking like this:

'H' 'T' 'T' 'P' '/' '1' '.' '1' ' ' '2' '0' '0' '\0' '\n' '\0' <other>

Where <other> is trailing garbage we don't care about.

Anyway, ap_getline leaves the buffer in this state because it trims
all trailing whitespace.  Then, around line 1610 of proxy_util.c, the
code does some short sighted (and, I believe, unnecessary)
manipulations which leave the buffer as:

'H' 'T' 'T' 'P' '/' '1' '.' '1' ' ' '2' '0' '0' ' ' '\n' '\0' <other>

This leads to the problem above.

Anyway, the fix is pretty simple: just drop the following patch in
debian/patches:

--- build-tree/apache_1.3.26/src/modules/proxy/proxy_util.c
+++ build-tree/apache_1.3.26/src/modules/proxy/proxy_util.c
@@ -1607,6 +1607,9 @@
         }
         *backasswards = 0;
 
+        /* Fix for the case when the remote Reason-Phrase (RFC2616) is empty 
+         * In that case, ap_getline trims the space after the status code */
+        if ('\0' == buffer[12]) buffer[13] = '\0';
         buffer[12] = '\0';
         r->status = atoi(&buffer[9]);
         buffer[12] = ' ';

This will ensure that mod_proxy emits an RFC-conformant status line
(the space after the status number is required), and removes the extra
blank line.  Another fix that works on Debian systems is to remove the
two lines that manipulate buffer[12], but I suspect that they're there
to deal with some odd atoi implementations on one of the myriad
machines apache compiles on.

Upstream has a bug (number 10052) in their bugzilla which is another
manifestation of this same bug.  However, the patch attached to that
bug doesn't really address the cause of the problem as much as the
symptom.  Also, the bug has been held in status "NEW" for over six
months, so I don't think that upstream's paying attention to it.

-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux cush 2.4.20 #1 Wed Apr 9 19:06:03 EDT 2003 i686
Locale: LANG=en_US, LC_CTYPE=en_US

Versions of packages apache-common depends on:
ii  libc6                        2.3.1-16    GNU C Library: Shared libraries an
ii  libdb2                       2:2.7.7.0-8 The Berkeley database routines (ru
ii  libexpat1                    1.95.6-4    XML parsing C library - runtime li
ii  perl [perl5]                 5.6.1-8.2   Larry Wall's Practical Extraction 



-- 
To UNSUBSCRIBE, email to debian-apache-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

--6TrnltStXW4iwmi0--



Reply to: