Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 42771 invoked by uid 500); 18 Jun 2001 12:58:25 -0000 Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-dev@xml.apache.org Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 42757 invoked from network); 18 Jun 2001 12:58:24 -0000 From: "Vadim Gritsenko" To: "Cocoon Developers" Subject: [PATCH] HTTP Headers are case-insensitive Date: Mon, 18 Jun 2001 08:57:52 -0400 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0012_01C0F7D4.C22F96C0" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Importance: Normal X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N ------=_NextPart_000_0012_01C0F7D4.C22F96C0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hello everybody, I found that CommandLineRequest does not treat headers correctly, so "User-Agent" and "user-agent" would be two different headers if using this request. Patch is attached to fix this problem. Also, some request header - related code fixed in TraxTransformer also. I'm not sure about line 13 of the patch, but I think names should be consistent, otherwise it will be hard to guess the name... Please apply these patched assuming that they are feasible. Thanks, Vadim ------=_NextPart_000_0012_01C0F7D4.C22F96C0 Content-Type: application/octet-stream; name="CommandLineRequest.java.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="CommandLineRequest.java.diff" Index: CommandLineRequest.java =================================================================== RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/environment/commandline/CommandLineRequest.java,v retrieving revision 1.2 diff -u -r1.2 CommandLineRequest.java --- CommandLineRequest.java 2001/05/10 22:19:33 1.2 +++ CommandLineRequest.java 2001/06/17 02:43:46 @@ -134,10 +134,10 @@ } public String getHeader(String name) { - return (headers != null) ? (String) headers.get(name) : null; + return (headers != null) ? (String) headers.get(name.toLowerCase()) : null; } public int getIntHeader(String name) { - String header = (headers != null) ? (String) headers.get(name) : null; + String header = (headers != null) ? (String) headers.get(name.toLowerCase()) : null; return (header != null) ? Integer.parseInt(header) : -1; } public long getDateHeader(String name) { ------=_NextPart_000_0012_01C0F7D4.C22F96C0 Content-Type: application/octet-stream; name="TraxTransformer.java.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="TraxTransformer.java.diff" Index: TraxTransformer.java =================================================================== RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/transformation/TraxTransformer.java,v retrieving revision 1.15.2.1 diff -u -r1.15.2.1 TraxTransformer.java --- TraxTransformer.java 2001/06/07 09:20:11 1.15.2.1 +++ TraxTransformer.java 2001/06/17 02:42:35 @@ -483,9 +483,9 @@ accept = request.getHeader("accept"); /* Get the user agent; it's needed to get the browser type. */ - String agent = request.getParameter("user-Agent"); + String agent = request.getParameter("user-agent"); if (agent == null) - agent = request.getHeader("user-Agent"); + agent = request.getHeader("user-agent"); /* add the accept param */ map.put("accept", accept); ------=_NextPart_000_0012_01C0F7D4.C22F96C0 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org For additional commands, email: cocoon-dev-help@xml.apache.org ------=_NextPart_000_0012_01C0F7D4.C22F96C0--