]> granicus.if.org Git - curl/commitdiff
fixed the attribute parser to better handle multiple ones, with or without
authorDaniel Stenberg <daniel@haxx.se>
Thu, 28 Apr 2005 21:05:40 +0000 (21:05 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 28 Apr 2005 21:05:40 +0000 (21:05 +0000)
quotes around the contents

tests/getpart.pm

index d1c8ec8566df76f46f8dbb8d8de083adeeda8c5e..ccfbd7d62871a9a7d6dfc6663e0780b4e0665085 100644 (file)
@@ -34,20 +34,11 @@ sub getpartattr {
              ) {
             $inside++;
             my $attr=$1;
-            my @p=split("[\t]", $attr);
-            my $assign;
 
-            foreach $assign (@p) {
-                # $assign is a 'name="contents"' pair
-
-                if($assign =~ / *([^=]*)=\"([^\"]*)\"/) {
-                    # *with* quotes
-                    $hash{$1}=$2;
-                }
-                elsif($assign =~ / *([^=]*)=([^\"]*)/) {
-                    # *without* quotes
-                    $hash{$1}=$2;
-                }
+            while($attr =~ s/ *([^=]*)= *(\"([^\"]*)\"|([^\"> ]*))//) {
+                my ($var, $cont)=($1, $2);
+                $cont =~ s/^\"(.*)\"$/$1/;
+                $hash{$var}=$cont;
             }
             last;
         }