diff --git a/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike b/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike
index 51193c9e594e0a230e775e84ed5848da6ffe8458..1db1046fa4a0b26cff1a00137f23bc868f4a2900 100644
--- a/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike
+++ b/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike
@@ -84,6 +84,13 @@
 **! method string data()
 **!	Gives back the data as a string.
 **!
+**! metohd int downloaded_bytes()
+**!	Gives back the number of downloaded bytes.
+**!
+**! method int total_bytes()
+**!     Gives back the size of a file if a content-length header is present
+**!     and parsed at the time of evaluation. Otherwise returns -1.
+**!
 **! object(pseudofile) file()
 **! object(pseudofile) file(mapping newheaders,void|mapping removeheaders)
 **! object(pseudofile) datafile();
@@ -535,6 +542,23 @@ string data()
    return buf[datapos..];
 }
 
+int downloaded_bytes()
+{
+  if(datapos)
+    return sizeof(buf)-datapos;
+  else
+    return 0;
+}
+
+int total_bytes()
+{
+   int len=(int)headers["content-length"];
+   if(zero_type(len))
+     return -1;
+   else
+     return len;
+}
+
 array|mapping|string cast(string to)
 {
    switch (to)