From 8cb30afa43ec0436356fa4162ad99f704017605f Mon Sep 17 00:00:00 2001 From: Daina <60326190+ddaina@users.noreply.github.com> Date: Tue, 9 Nov 2021 15:54:41 +0100 Subject: [PATCH] pass file instead of data to curl request (fix #5105) (#5110) --- src/python/CRABClient/CrabRestInterface.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/python/CRABClient/CrabRestInterface.py b/src/python/CRABClient/CrabRestInterface.py index a4340615..22fbf31e 100644 --- a/src/python/CRABClient/CrabRestInterface.py +++ b/src/python/CRABClient/CrabRestInterface.py @@ -11,6 +11,7 @@ from ServerUtilities import encodeRequest import json import re +import tempfile from CRABClient.ClientExceptions import RESTInterfaceException @@ -137,16 +138,20 @@ def makeRequest(self, uri=None, data=None, verb='GET'): # if it is a dictionary, we need to encode it to string if isinstance(data, dict): data = encodeRequest(data) + self.logger.debug("Encoded data for curl request: %s" %data) + + fh, path = tempfile.mkstemp(dir='/tmp', prefix='curlData') + with open(path, 'w') as f: + f.write(data) if verb in ['GET', 'HEAD']: url = url + '?' + data command = '' - # command below will return 2 values separated by comma: 1) curl result and 2) HTTP code command += 'curl -v -X {0}'.format(verb) command += ' -H "User-Agent: %s/%s"' % (self['userAgent'], self['version']) command += ' -H "Accept: */*"' - command += ' --data "%s"' % data + command += ' --data @%s' % path command += ' --cert "%s"' % self['cert'] command += ' --key "%s"' % self['key'] command += ' --capath "%s"' % caCertPath