[interchange-cvs] interchange - kwalsh modified lib/Vend/Server.pm

interchange-core@interchange.redhat.com interchange-core@interchange.redhat.com
Fri May 10 14:30:01 2002


User:      kwalsh
Date:      2002-05-10 18:29:00 GMT
Modified:  lib/Vend Server.pm
Log:
	* This patch clears the following intermittent error:

		CGI mapping error: multipart/form-data sent incorrectly

	  Some browsers, like Opera, use non-word characters like '+' in
	  form-data MIME boundaries, which cause the regexes to fail.
	  I have taken the "safe" route and escaped all non-word characters
	  in the specified boundary, even though I have only seen the '+'
	  character in use.

Revision  Changes    Path
2.4       +4 -2      interchange/lib/Vend/Server.pm


rev 2.4, prev_rev 2.3
Index: Server.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Server.pm,v
retrieving revision 2.3
retrieving revision 2.4
diff -u -r2.3 -r2.4
--- Server.pm	17 Apr 2002 17:49:52 -0000	2.3
+++ Server.pm	10 May 2002 18:29:00 -0000	2.4
@@ -1,6 +1,6 @@
 # Vend::Server - Listen for Interchange CGI requests as a background server
 #
-# $Id: Server.pm,v 2.3 2002/04/17 17:49:52 jon Exp $
+# $Id: Server.pm,v 2.4 2002/05/10 18:29:00 kwalsh Exp $
 #
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -25,7 +25,7 @@
 package Vend::Server;
 
 use vars qw($VERSION);
-$VERSION = substr(q$Revision: 2.3 $, 10);
+$VERSION = substr(q$Revision: 2.4 $, 10);
 
 use POSIX qw(setsid strftime);
 use Vend::Util;
@@ -226,6 +226,7 @@
 		# even though it's sent as non-multipart data
 		# Contributed by Bill Randle
 		my ($boundary) = $CGI::content_type =~ /boundary=\"?([^\";]+)\"?/;
+		$boundary =~ s/(\W)/\\$1/g;
 		$boundary = "--$boundary";
 		return parse_multipart($sref) if $$sref =~ /^\s*$boundary\s+/;
 	}
@@ -296,6 +297,7 @@
 sub parse_multipart {
 	my $sref = shift;
 	my ($boundary) = $CGI::content_type =~ /boundary=\"?([^\";]+)\"?/;
+	$boundary =~ s/(\W)/\\$1/g;
 #::logDebug("got to multipart");
 	# Stolen from CGI.pm, thanks Lincoln
 	$boundary = "--$boundary"