summaryrefslogtreecommitdiff
path: root/indra/llcorehttp/tests/test_llcorehttp_peer.py
diff options
context:
space:
mode:
authorMonty Brandenberg <monty@lindenlab.com>2013-05-06 12:12:05 -0400
committerMonty Brandenberg <monty@lindenlab.com>2013-05-06 12:12:05 -0400
commitf5e8457e4e4fad1d823c51d86c01fdc2ae08401c (patch)
treef74cba7085bc46ca4f71a6a5c083cfda876c01f5 /indra/llcorehttp/tests/test_llcorehttp_peer.py
parentf9850aa5d2fbed3e039ac1a1015ff73065664f17 (diff)
BUG-2295/MAINT-2624 unexpected crash around Content-Range: header processing
Not certain what the source of the short data is with one resident but I'm going to make these problems retryable as they are transport-related. Lift the retry detection into a method that should be reusable by others interested in determining what is retryable. Trace output handling on the libcurl debug callback was attrocious. Some unsafe length handling on my part was protected by a second layer of defense. Made that correct and more useful by logging actual data sizes during trace.
Diffstat (limited to 'indra/llcorehttp/tests/test_llcorehttp_peer.py')
-rw-r--r--indra/llcorehttp/tests/test_llcorehttp_peer.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/indra/llcorehttp/tests/test_llcorehttp_peer.py b/indra/llcorehttp/tests/test_llcorehttp_peer.py
index 7f8f765366..8796ae57c7 100644
--- a/indra/llcorehttp/tests/test_llcorehttp_peer.py
+++ b/indra/llcorehttp/tests/test_llcorehttp_peer.py
@@ -35,6 +35,10 @@ import time
import select
import getopt
from threading import Thread
+try:
+ from cStringIO import StringIO
+except ImportError:
+ from StringIO import StringIO
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from SocketServer import ThreadingMixIn
@@ -64,6 +68,7 @@ class TestHTTPRequestHandler(BaseHTTPRequestHandler):
-- '/bug2295/00000018/0/' Generates PARTIAL_FILE (18) error in libcurl.
"Content-Range: bytes 0-75/2983",
"Content-Length: 76"
+ -- '/bug2295/inv_cont_range/0/' Generates HE_INVALID_CONTENT_RANGE error in llcorehttp.
Some combinations make no sense, there's no effort to protect
you from that.
@@ -150,6 +155,7 @@ class TestHTTPRequestHandler(BaseHTTPRequestHandler):
# appear in the body without actually getting the body.
# Library needs to defend against this case.
#
+ body = None
if "/bug2295/0/" in self.path:
self.send_response(206)
self.send_header("Content-Range", "bytes 0-75/2983")
@@ -164,6 +170,10 @@ class TestHTTPRequestHandler(BaseHTTPRequestHandler):
self.send_response(206)
self.send_header("Content-Range", "bytes 0-75/2983")
self.send_header("Content-Length", "76")
+ elif "/bug2295/inv_cont_range/0/" in self.path:
+ self.send_response(206)
+ self.send_header("Content-Range", "bytes 0-75/2983")
+ body = "Some text, but not enough."
else:
# Unknown request
self.send_response(400)
@@ -171,7 +181,8 @@ class TestHTTPRequestHandler(BaseHTTPRequestHandler):
self.reflect_headers()
self.send_header("Content-type", "text/plain")
self.end_headers()
- # No data
+ if body:
+ self.wfile.write(body)
else:
# Normal response path
data = data.copy() # we're going to modify