comparison proxy_upgrade.t @ 280:3dd8c7acf3ad

Tests: fix couple of possible warnings in proxy_upgrade.t.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 16 Apr 2013 17:28:30 +0400
parents c754b1c79efe
children a9621dbbd0d4
comparison
equal deleted inserted replaced
279:c754b1c79efe 280:3dd8c7acf3ad
154 my $got = ''; 154 my $got = '';
155 $buf = ''; 155 $buf = '';
156 156
157 while (1) { 157 while (1) {
158 $buf = upgrade_getline($s); 158 $buf = upgrade_getline($s);
159 last unless length $buf; 159 last unless defined $buf and length $buf;
160 log_in($buf); 160 log_in($buf);
161 $got .= $buf; 161 $got .= $buf;
162 last if $got =~ /\x0d?\x0a\x0d?\x0a$/; 162 last if $got =~ /\x0d?\x0a\x0d?\x0a$/;
163 } 163 }
164 164
166 166
167 return if $got !~ m!HTTP/1.1 101!; 167 return if $got !~ m!HTTP/1.1 101!;
168 168
169 # make sure next line is "handshaked" 169 # make sure next line is "handshaked"
170 170
171 return if upgrade_read($s) ne 'handshaked'; 171 $buf = upgrade_read($s);
172
173 return if !defined $buf or $buf ne 'handshaked';
172 return $s; 174 return $s;
173 } 175 }
174 176
175 sub upgrade_getline { 177 sub upgrade_getline {
176 my ($s) = @_; 178 my ($s) = @_;