summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/certtools.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/certtools.py b/tools/certtools.py
index 023bc1e..1523c97 100644
--- a/tools/certtools.py
+++ b/tools/certtools.py
@@ -273,16 +273,23 @@ def http_request(url, data=None, key=None, verifynode=None, publickeydir=".", pa
with requests.sessions.Session() as session:
return http_request_session(url, data=data, key=key, verifynode=verifynode, publickeydir=publickeydir, params=params, session=session)
+def chunk_generator(data, maxsize):
+ while len(data):
+ yield data[:maxsize]
+ data = data[maxsize:]
+
def http_request_session(url, data=None, key=None, verifynode=None, publickeydir=".", params=None, session=None):
(keyname, keyfile) = key
privatekey = get_eckey_from_file(keyfile)
sk = ecdsa.SigningKey.from_der(privatekey)
if data == None:
method = "GET"
+ chunked_data = None
else:
method = "POST"
+ chunked_data = chunk_generator(data, 900000)
assert(params == None)
- req = requests.Request(method, url, params=params, data=data)
+ req = requests.Request(method, url, params=params, data=chunked_data)
prepared_req = session.prepare_request(req)
parsed_url = urlparse.urlparse(prepared_req.url)
if data == None: