diff --git a/lib/service.c b/lib/service.c
index 1b3fc40e7e8b7c20e3a59b13b80b6d23c3bbc55e..72d78c97528d7df1b75d470aa78a593711f86039 100644
--- a/lib/service.c
+++ b/lib/service.c
@@ -610,7 +610,10 @@ spin_chunks:
 	if (wsi->chunked)
 		return 0;
 
-	wsi->u.http.content_remain -= n;
+	/* if we know the content length, decrement the content remaining */
+	if (wsi->u.http.content_length > 0)
+		wsi->u.http.content_remain -= n;
+
 	if (wsi->u.http.content_remain || !wsi->u.http.content_length)
 		return 0;