+
+sub get_capa {
+ my ($sock) = @_;
+ syswrite($sock, "CAPABILITIES\r\n");
+ my $capa = '';
+ do {
+ my $r = sysread($sock, $capa, 8192, length($capa));
+ die "unexpected: $!" unless defined($r);
+ die 'unexpected EOF' if $r == 0;
+ } until $capa =~ /\.\r\n\z/;
+
+ my $deflate_capa = qr/\r\nCOMPRESS DEFLATE\r\n/;
+ if ($need_zlib) {
+ unlike($capa, $deflate_capa,
+ 'COMPRESS DEFLATE NOT advertised '.$need_zlib);
+ } else {
+ like($capa, $deflate_capa, 'COMPRESS DEFLATE advertised');
+ }
+ $capa;
+}
+