diff --git a/src/ostree/ot-builtin-trivial-httpd.c b/src/ostree/ot-builtin-trivial-httpd.c
index d6f85f5..c8ed024 100644
--- a/src/ostree/ot-builtin-trivial-httpd.c
+++ b/src/ostree/ot-builtin-trivial-httpd.c
@@ -29,6 +29,7 @@
 static char *opt_port_file = NULL;
 static gboolean opt_daemonize;
 static gboolean opt_autoexit;
+static int opt_chop_size = -1; /* Use -1 to signify not chopping at all. */
 
 typedef struct {
   GFile *root;
@@ -39,6 +40,7 @@ static GOptionEntry options[] = {
   { "daemonize", 'd', 0, G_OPTION_ARG_NONE, &opt_daemonize, "Fork into background when ready", NULL },
   { "autoexit", 0, 0, G_OPTION_ARG_NONE, &opt_autoexit, "Automatically exit when directory is deleted", NULL },
   { "port-file", 'p', 0, G_OPTION_ARG_FILENAME, &opt_port_file, "Write port number to PATH", "PATH" },
+  { "chop-files", 'c', 0, G_OPTION_ARG_INT, &opt_chop_size, "Stop serving files after X Megabytes", "Number of Megabytes to serve" },
   { NULL }
 };
 
@@ -199,7 +201,9 @@ do_get (OtTrivialHttpd  *self,
         {
           GMappedFile *mapping;
           SoupBuffer *buffer;
-
+          gsize buffer_length, file_size;
+          SoupRange *ranges;
+          int ranges_length;
           mapping = g_mapped_file_new (safepath, FALSE, NULL);
           if (!mapping)
             {
@@ -207,8 +211,33 @@ do_get (OtTrivialHttpd  *self,
               goto out;
             }
 
+          file_size = g_mapped_file_get_length (mapping);
+          if (opt_chop_size == -1 || g_mapped_file_get_length (mapping) < opt_chop_size * 1000000)
+              buffer_length = file_size;
+          else
+              buffer_length = opt_chop_size * 1000000;
+          if (soup_message_headers_get_ranges(msg->request_headers, 0, &ranges, &ranges_length))
+            {
+              goffset start, end;
+              gsize size;
+              start = ranges[0].start;
+              end = ranges[0].end;
+              if (end == -1)
+                end = file_size;
+              if (start > file_size || start > end || end > file_size)
+                {
+                  soup_message_set_status (msg, SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE);
+                  goto out;
+                } else {
+                  soup_message_set_status (msg, SOUP_STATUS_PARTIAL_CONTENT);
+                  soup_message_headers_set_content_range (msg->response_headers, start, end, file_size);
+                }
+              buffer_length += start;
+              if (buffer_length > file_size)
+                buffer_length = file_size;
+            }
           buffer = soup_buffer_new_with_owner (g_mapped_file_get_contents (mapping),
-                                               g_mapped_file_get_length (mapping),
+                                               buffer_length,
                                                mapping, (GDestroyNotify)g_mapped_file_unref);
           soup_message_body_append_buffer (msg->response_body, buffer);
           soup_buffer_free (buffer);
