chiark / gitweb /
dgit: WWW::Curl: Double check that $response_body was set
[dgit.git] / dgit
diff --git a/dgit b/dgit
index d24c4e64eb08c2bc08076b85550c458e3be2553b..4bd2e0534ff21e14f564f0a7eefa81f5e380fe5f 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -1191,7 +1191,7 @@ sub url_fetch ($;@) {
        confess "$k $v ".$curl->strerror($x)." ?" if $x;
     };
 
-    my $response_body;
+    my $response_body = '';
     $setopt->(CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS|CURLPROTO_HTTP);
     $setopt->(CURLOPT_URL,             $url);
     $setopt->(CURLOPT_NOSIGNAL,        1);
@@ -1223,6 +1223,8 @@ sub url_fetch ($;@) {
     
     fail f_ "fetch of %s gave HTTP code %s", $url, $code
        unless $url =~ m#^file://# or $code =~ m/^2/;
+
+    confess unless defined $response_body;
     return $response_body;
 }