From c669390a40d88f09af96447c555a78158cf1edca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Johan=20Sch=C3=B6n?= <js@opera.com>
Date: Mon, 20 Mar 2000 17:44:01 +0100
Subject: [PATCH] Bugfix. headers might not be set all the time.

Rev: lib/modules/Protocols.pmod/HTTP.pmod/Query.pike:1.15
---
 lib/modules/Protocols.pmod/HTTP.pmod/Query.pike | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike b/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike
index cdf766093e..473730b377 100644
--- a/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike
+++ b/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike
@@ -558,11 +558,13 @@ int downloaded_bytes()
 
 int total_bytes()
 {
-   int len=(int)headers["content-length"];
-   if(zero_type(len))
-     return -1;
-   else
-     return len;
+  if(!headers)
+    return -1;
+  int len=(int)headers["content-length"];
+  if(zero_type(len))
+    return -1;
+  else
+    return len;
 }
 
 array|mapping|string cast(string to)
-- 
GitLab