summaryrefslogtreecommitdiff
path: root/tests/getpart.pm
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-04-28 21:05:40 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-04-28 21:05:40 +0000
commit967ec296c036b6ce45e03a6e7b7116876c01a878 (patch)
tree4c094c1c4a71c0ca61c8fc2735f45c3a9000c69f /tests/getpart.pm
parentc6aae9b1d77814122be706971eab743410d8ebff (diff)
downloadcurl-967ec296c036b6ce45e03a6e7b7116876c01a878.tar.gz
fixed the attribute parser to better handle multiple ones, with or without
quotes around the contents
Diffstat (limited to 'tests/getpart.pm')
-rw-r--r--tests/getpart.pm17
1 files changed, 4 insertions, 13 deletions
diff --git a/tests/getpart.pm b/tests/getpart.pm
index d1c8ec856..ccfbd7d62 100644
--- a/tests/getpart.pm
+++ b/tests/getpart.pm
@@ -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;
}