Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __create_string_from_buffer(self):
return Utils.util_create_string_from_buffer(self.__charBuffer)
def __create_string_from_buffer(self):
return Utils.util_create_string_from_buffer(self.__charBuffer)
port = 80
if itemsSize == 1:
serverContext = ""
tapContext = ""
elif itemsSize == 2:
serverContext = "/"+items[1]
tapContext = ""
elif itemsSize == 3:
serverContext = "/"+items[1]
tapContext = "/"+items[2]
else:
data = []
for i in range(1, itemsSize-1):
data.append("/"+items[i])
serverContext = utils.util_create_string_from_buffer(data)
tapContext = "/"+items[itemsSize-1]
if verbose:
print("protocol: '%s'" % protocol)
print("host: '%s'" % host)
print("port: '%d'" % port)
print("server context: '%s'" % serverContext)
print("tap context: '%s'" % tapContext)
return protocol, host, port, serverContext, tapContext
def __create_string_from_buffer(self):
return Utils.util_create_string_from_buffer(self.__charBuffer)
def __create_string_from_buffer(self):
return Utils.util_create_string_from_buffer(self.__charBuffer)
multiparItems.append(CRLF)
multiparItems.append(fields[key]+CRLF)
for (key, filename, value) in files:
multiparItems.append('--' + boundary + CRLF)
multiparItems.append(
'Content-Disposition: form-data; name="%s"; filename="%s"%s' %
(key, filename, CRLF))
multiparItems.append(
'Content-Type: %s%s' %
(mimetypes.guess_extension(filename), CRLF))
multiparItems.append(CRLF)
multiparItems.append(value)
multiparItems.append(CRLF)
multiparItems.append('--' + boundary + '--' + CRLF)
multiparItems.append(CRLF)
body = utils.util_create_string_from_buffer(multiparItems)
contentType = 'multipart/form-data; boundary=%s' % boundary
return contentType, body