From 2ca435800ad2e88fdff36cdc1e7c4479ab2e6078 Mon Sep 17 00:00:00 2001 From: Neil Mansilla Date: Wed, 12 Aug 2015 11:23:53 -0700 Subject: [PATCH 1/2] Set 10MB limit on /drip --- httpbin/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httpbin/core.py b/httpbin/core.py index efbb800..baad8f0 100644 --- a/httpbin/core.py +++ b/httpbin/core.py @@ -454,7 +454,7 @@ def drip(): """Drips data over a duration after an optional initial delay.""" args = CaseInsensitiveDict(request.args.items()) duration = float(args.get('duration', 2)) - numbytes = int(args.get('numbytes', 10)) + numbytes = min(int(args.get('numbytes', 10)),(10 * 1024 * 1024)) # set 10MB limit code = int(args.get('code', 200)) pause = duration / numbytes From d733461295a47b3404c28dac31d025d0c87087bf Mon Sep 17 00:00:00 2001 From: Neil Mansilla Date: Wed, 12 Aug 2015 11:32:41 -0700 Subject: [PATCH 2/2] Document max MB for /drip function --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 9ca8b3f..4239b72 100644 --- a/README.rst +++ b/README.rst @@ -37,7 +37,7 @@ Endpoint Description `/digest-auth/:qop/:user/:passwd`_ Challenges HTTP Digest Auth. `/stream/:n`_ Streams *n* – 100 lines. `/delay/:n`_ Delays responding for *n* – 10 seconds. -`/drip`_ Drips data over a duration after an optional initial delay, then (optionally) returns with the given status code. +`/drip`_ Drips up to 10MB data over a duration after an optional initial delay, then (optionally) returns with the given status code. `/range/:n`_ Streams *n* bytes, and allows specifying a *Range* header to select a subset of the data. Accepts a *chunk\_size* and request *duration* parameter. `/html`_ Renders an HTML Page. `/robots.txt`_ Returns some robots.txt rules.