initialise sendfile ssl with a simple GET request

This commit is contained in:
Frédéric Péters 2020-03-11 11:11:01 +01:00
parent 22047121cd
commit 9368a1c3bb
1 changed files with 8 additions and 0 deletions

View File

@ -85,6 +85,14 @@ class GLCartaDSCS(AbstractCartaDSCS):
return token
def upload_zip(self, zip_filename):
# But you should really design your site to ensure that the first
# request to a client-cert-protected area is not a POST request with a
# large body; make it a GET or something. Any request body has to be
# buffered into RAM to handle this case, so represents an opportunity
# to DoS the server.
# -- https://bz.apache.org/bugzilla/show_bug.cgi?id=39243
# and that's why there's a seemingly unnecessary GET request first.
self.requests.get(self.sendfile_ws_url)
b64_zip = base64.b64encode(open(zip_filename, 'rb').read())
chunk_size = 16777216 # 16MB
for n in range(0, len(b64_zip), chunk_size):